Exemplo n.º 1
0
def test_has_correct_mode_no_calc():

    bond_rearr = BondRearrangement(breaking_bonds=[(2, 1)],
                                   forming_bonds=[(0, 2)])
    calc = Calculation(molecule=ts,
                       method=method,
                       keywords=method.keywords.opt_ts,
                       name='tmp')

    # Calculation has no output so should not have the correct mode
    assert not imag_mode_has_correct_displacement(
        calc, bond_rearrangement=bond_rearr)
Exemplo n.º 2
0
def test_correct_imag_mode():
    os.chdir(os.path.join(here, 'data'))

    bond_rearrangement = BondRearrangement(breaking_bonds=[(4, 1), (4, 18)],
                                           forming_bonds=[(1, 18)])
    g09 = G09()
    g09.available = True

    calc = Calculation(name='tmp',
                       molecule=ReactantComplex(
                           Reactant(smiles='CC(C)(C)C1C=CC=C1')),
                       method=g09,
                       keywords=Config.G09.keywords.opt_ts)
    calc.output.filename = 'correct_ts_mode_g09.log'
    calc.output.set_lines()

    f_displaced_atoms = get_displaced_atoms_along_mode(calc,
                                                       mode_number=6,
                                                       disp_magnitude=1.0)
    f_species = Species(name='f_displaced',
                        atoms=f_displaced_atoms,
                        charge=0,
                        mult=1)  # Charge & mult are placeholders

    b_displaced_atoms = get_displaced_atoms_along_mode(calc,
                                                       mode_number=6,
                                                       disp_magnitude=-1.0)
    b_species = Species(name='b_displaced',
                        atoms=b_displaced_atoms,
                        charge=0,
                        mult=1)

    # With the correct mode no other bonds are made
    assert not imag_mode_generates_other_bonds(
        ts=calc.molecule,
        f_species=f_species,
        b_species=b_species,
        bond_rearrangement=bond_rearrangement)

    calc.output.filename = 'incorrect_ts_mode_g09.log'
    calc.output.set_lines()

    assert not imag_mode_has_correct_displacement(calc, bond_rearrangement)

    os.chdir(here)
Exemplo n.º 3
0
def has_correct_mode(name, fbonds, bbonds):

    reac = Reactant(name='r', atoms=xyz_file_to_atoms(f'{name}.xyz'))

    calc = Calculation(name=name,
                       molecule=reac,
                       method=orca,
                       keywords=orca.keywords.opt_ts,
                       n_cores=1)

    calc.output.filename = f'{name}.out'
    calc.output.file_lines = open(f'{name}.out', 'r').readlines()

    bond_rearr = BondRearrangement(breaking_bonds=bbonds,
                                   forming_bonds=fbonds)

    # Don't require all bonds to be breaking/making in a 'could be ts' function
    return imag_mode_has_correct_displacement(calc, bond_rearr,
                                              delta_threshold=0.05,
                                              req_all=False)