def test_find_tss(): Config.num_conformers = 1 # Spoof ORCA install Config.ORCA.path = here # Don't run the calculation without a working XTB install if shutil.which('xtb') is None or not shutil.which('xtb').endswith('xtb'): return if os.path.exists('/dev/shm'): Config.ll_tmp_dir = '/dev/shm' Config.XTB.path = shutil.which('xtb') Config.ORCA.implicit_solvation_type = cpcm Config.make_ts_template = False Config.num_complex_sphere_points = 2 Config.num_complex_random_rotations = 1 # SN2 example flouride = Reactant(name='F-', smiles='[F-]') methyl_chloride = Reactant(name='CH3Cl', smiles='ClC') chloride = Product(name='Cl-', smiles='[Cl-]') methyl_flouride = Product(name='CH3F', smiles='CF') reaction = Reaction(flouride, methyl_chloride, chloride, methyl_flouride, name='sn2', solvent_name='water') # Will work in data/locate_ts/transition_states reaction.locate_transition_state() assert reaction.ts is not None os.chdir('transition_states') assert reaction.ts.is_true_ts() os.chdir('..') reaction.ts.save_ts_template(folder_path=os.getcwd()) assert os.path.exists('template0.txt') # There should now be a saved template templates = get_ts_templates(folder_path=os.getcwd()) assert len(templates) == 1 template = templates[0] assert template.solvent.name == 'water' assert template.mult == 1 assert template.charge == -1 assert template.graph.number_of_nodes() == 6 # Reset the configuration Config.ll_tmp_dir = None
def test_isomorphic_reactant_product(): r_water = Reactant(name='h2o', smiles='O') r_methane = Reactant(name='methane', smiles='C') p_water = Product(name='h2o', smiles='O') p_methane = Product(name='methane', smiles='C') # Reaction where the reactant and product complexes are isomorphic # should return no TS reaction = Reaction(r_water, r_methane, p_water, p_methane) reaction.locate_transition_state() assert reaction.ts is None
def test_find_tss(): os.chdir(os.path.join(here, 'data', 'locate_ts')) Config.num_conformers = 1 # Spoof ORCA install Config.ORCA.path = here # Don't run the calculation without a working XTB install if shutil.which('xtb') is None or not shutil.which('xtb').endswith('xtb'): return Config.XTB.path = shutil.which('xtb') Config.ORCA.implicit_solvation_type = 'cpcm' Config.make_ts_template = False Config.num_complex_sphere_points = 2 Config.num_complex_random_rotations = 1 # SN2 example flouride = Reactant(name='F-', smiles='[F-]') methyl_chloride = Reactant(name='CH3Cl', smiles='ClC') chloride = Product(name='Cl-', smiles='[Cl-]') methyl_flouride = Product(name='CH3F', smiles='CF') reaction = Reaction(flouride, methyl_chloride, chloride, methyl_flouride, name='sn2', solvent_name='water') # Will work in data/locate_ts/transition_states reaction.locate_transition_state() assert reaction.ts is not None os.chdir(os.path.join(here, 'data', 'locate_ts', 'transition_states')) for filename in os.listdir(os.getcwd()): if filename.endswith(('.inp', '.png')): os.remove(filename) assert reaction.ts.is_true_ts() reaction.ts.save_ts_template(folder_path=os.getcwd()) assert os.path.exists('template0.obj') # There should now be a saved template templates = get_ts_templates(folder_path=os.getcwd()) assert len(templates) == 1 template = templates[0] assert template.solvent.name == 'water' assert template.mult == 1 assert template.charge == -1 assert template.graph.number_of_nodes() == 6 # Tidy the generated files os.remove('template0.obj') os.chdir(here)