From 23413362bc3d4c40665316a0454d850dd9d1242e Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Wed, 6 Dec 2023 16:13:31 -0800 Subject: [PATCH] improvements --- pynta/calculator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pynta/calculator.py b/pynta/calculator.py index 8408770e..152bbde5 100644 --- a/pynta/calculator.py +++ b/pynta/calculator.py @@ -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 @@ -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 @@ -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