Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnson541 committed Dec 7, 2023
1 parent cc1a75a commit 2341336
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pynta/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,10 @@ def add_sella_constraint(cons,d):
constructor(**constraint_dict)
return

def get_lattice_parameters(metal,surface_type,software,software_kwargs,da=0.1,options={"xatol":1e-4},a0=None):
def get_lattice_parameters(metal,surface_type,software,software_kwargs,da=0.1,a0=None):
soft = name_to_ase_software(software)(**software_kwargs)
if surface_type != "hcp0001":
options={"xatol":1e-4}
def f(a):
slab = bulk(metal,surface_type[:3],a=a)
slab.calc = soft
Expand Down Expand Up @@ -382,6 +383,7 @@ def f(a):
print("Optimized a: {}".format(out.x))
return out.x
else:
options={"gtol":1e-6}
def f(a):
slab = bulk(metal,surface_type[:3],a=a[0],c=a[1])
slab.calc = soft
Expand All @@ -392,7 +394,7 @@ def f(a):
cpera = reference_states[chemical_symbols.index(metal)]['c/a']
c0 = cpera * a0
init_guess = [a0,c0]
out = opt.minimize(f,x0=init_guess,options=options)
out = opt.minimize(f,x0=init_guess,method="BFGS",options=options)
print(out)
print("Optimized a,c: {}".format(out.x))
return out.x

0 comments on commit 2341336

Please sign in to comment.