diff --git a/architector/arch_xtb_text_ase_calc.py b/architector/arch_xtb_text_ase_calc.py index c090939..7a36443 100644 --- a/architector/arch_xtb_text_ase_calc.py +++ b/architector/arch_xtb_text_ase_calc.py @@ -87,7 +87,7 @@ def calculate(self, atoms=None, *args, **kwargs): file1.write(" gbsa=true\n") # Run xtb - execStr = "{} structure.xyz {} --chrg {} --uhf {} --alpb {} -P 1 -a {} --etemp {} --iterations {} --grad -I solv_options.txt> output.xtb".format( + execStr = "{} structure.xyz {} --chrg {} --uhf {} --alpb {} -P 1 -a {} --etemp {} --iterations {} --grad -I solv_options.txt".format( xtbPath, methods_dict[self.parameters.get("xtb_method", "GFN2-xTB")], int(charge), @@ -98,7 +98,7 @@ def calculate(self, atoms=None, *args, **kwargs): self.parameters["xtb_max_iterations"], ) else: - execStr = "{} structure.xyz {} --chrg {} --uhf {} -P 1 -a {} --etemp {} --iterations {} --grad> output.xtb".format( + execStr = "{} structure.xyz {} --chrg {} --uhf {} -P 1 -a {} --etemp {} --iterations {} --grad".format( xtbPath, methods_dict[self.parameters.get("xtb_method", "GFN2-xTB")], int(charge), @@ -108,9 +108,11 @@ def calculate(self, atoms=None, *args, **kwargs): self.parameters["xtb_max_iterations"], ) - sub.run( - execStr, shell=True, check=True, stderr=sub.DEVNULL, stdout=sub.DEVNULL - ) + with open('output.xtb', 'w') as file1: + sub.run( + execStr.split(), check=True, + stderr=sub.DEVNULL, stdout=file1 + ) outpath = pathlib.Path(".") diff --git a/architector/io_calc.py b/architector/io_calc.py index ddc2df3..2423ae3 100644 --- a/architector/io_calc.py +++ b/architector/io_calc.py @@ -315,15 +315,8 @@ def calculate(self): max_iterations=self.xtb_max_iterations, electronic_temperature=self.xtb_electronic_temperature, # spin_polarization=1.0, # Have spin polarization on if desired. - verbosity=self.parameters['debug']) - # No xtb-python - elif (not has_xtb_python) and (self.method != 'GFN-FF'): - print('Warning: Defaulting to TBLite with no solvent since xtb-python is not installed.') - calc = TBLite(method=self.method, - max_iterations=self.xtb_max_iterations, - electronic_temperature=self.xtb_electronic_temperature, - # spin_polarization=1.0, # Have spin polarization on if desired. - verbosity=self.parameters['debug']) + # verbosity=self.parameters['debug']) + verbosity=-1) elif (not has_xtb_python): calc = XTB_Calculator( xtb_method=self.method, diff --git a/architector/io_lig.py b/architector/io_lig.py index 6076295..a39c63f 100644 --- a/architector/io_lig.py +++ b/architector/io_lig.py @@ -37,7 +37,14 @@ from ase import Atom from ase.optimize.bfgslinesearch import BFGSLineSearch import ase.constraints as ase_con -from xtb.ase.calculator import XTB +has_xtb_python = False +try: + from xtb.ase.calculator import XTB + has_xtb_python = True +except: + pass + +from architector.arch_xtb_text_ase_calc import XTB_Calculator # from tblite.ase import TBLite -> No GFN-FF support yet. import warnings @@ -107,7 +114,10 @@ def set_XTB_calc(ase_atoms): """ ase_atoms.set_initial_charges(np.zeros(len(ase_atoms))) ase_atoms.set_initial_magnetic_moments(np.zeros(len(ase_atoms))) - calc = XTB(method="GFN-FF") + if has_xtb_python: + calc = XTB(method="GFN-FF") + else: + calc = XTB_Calculator(xtb_method="GFN-FF") # Default to only GFN-FF for ligand conformer relaxation. ase_atoms.calc = calc return ase_atoms