def test_get_ts_guess_neb(): reactant = Reactant(name='inital', charge=-1, mult=0, solvent_name='water', atoms=xyz_file_to_atoms(init_xyz)) product = Reactant(name='final', charge=-1, mult=0, solvent_name='water', atoms=xyz_file_to_atoms(final_xyz)) xtb = XTB() # Don't run the NEB without a working XTB install if shutil.which('xtb') is None or not shutil.which('xtb').endswith('xtb'): return xtb.path = shutil.which('xtb') ts_guess = neb.get_ts_guess_neb(reactant, product, method=xtb, n=10) assert ts_guess is not None # Approximate distances at the TS guess assert 1.8 < ts_guess.get_distance(0, 2) < 2.2 # C-F assert 1.9 < ts_guess.get_distance(2, 1) < 2.3 # C-Cl if os.path.exists('NEB'): shutil.rmtree('NEB') if os.path.exists('neb.xyz'): os.remove('neb.xyz')
def test_full_calc_with_xtb(): sn2_neb = neb.NEB( initial_species=Species(name='inital', charge=-1, mult=0, atoms=xyz_file_to_atoms('sn2_init.xyz')), final_species=Species(name='final', charge=-1, mult=0, atoms=xyz_file_to_atoms('sn2_final.xyz')), num=14) sn2_neb.interpolate_geometries() xtb = XTB() # Don't run the NEB without a working XTB install if shutil.which('xtb') is None or not shutil.which('xtb').endswith('xtb'): return xtb.path = shutil.which('xtb') sn2_neb.calculate(method=xtb, n_cores=2) # There should be a peak in this surface assert len(list(sn2_neb.get_species_saddle_point())) > 0 assert all(image.energy is not None for image in sn2_neb.images) energies = [image.energy for image in sn2_neb.images] path_energy = sum(energy - min(energies) for energy in energies) assert 0.35 < path_energy < 0.45
def test_get_ts_guess_neb(): reactant = Reactant(name='inital', charge=-1, mult=0, solvent_name='water', atoms=xyz_file_to_atoms('sn2_init.xyz')) product = Reactant(name='final', charge=-1, mult=0, solvent_name='water', atoms=xyz_file_to_atoms('sn2_final.xyz')) xtb = XTB() # Don't run the NEB without a working XTB install if shutil.which('xtb') is None or not shutil.which('xtb').endswith('xtb'): return xtb.path = shutil.which('xtb') ts_guess = get_ts_guess_neb(reactant, product, method=xtb, n=10) assert ts_guess is not None # Approximate distances at the TS guess assert 1.8 < ts_guess.distance(0, 2) < 2.3 # C-F assert 1.9 < ts_guess.distance(2, 1) < 2.5 # C-Cl if os.path.exists('NEB'): shutil.rmtree('NEB') if os.path.exists('neb.xyz'): os.remove('neb.xyz') # Trying to get a TS guess with an unavailable method should return None # as a TS guess orca = ORCA() orca.path = None orca_ts_guess = get_ts_guess_neb(reactant, product, method=orca, n=10) assert orca_ts_guess is None