Exemplo n.º 1
0
def test_ADFGeometry_Constraint():
    """
    Test "freeze" and "selected_atoms" keywords for constrained geometry
    optimizations.
    """
    an = plams.Molecule('test/test_files/an.xyz', 'xyz')
    # optimize only H atoms
    s = Settings()
    s.freeze = [1, 2, 3]
    result1 = adf(templates.geometry.overlay(s), an)
    geom1 = result1.molecule

    # optimize only H atoms
    s = Settings()
    s.selected_atoms = ['H']
    result2 = adf(templates.geometry.overlay(s), an)
    geom2 = result2.molecule

    r = run(gather(geom1, geom2), n_processes=1)

    assert str(r[0]) == str(r[1])
Exemplo n.º 2
0
HH = plams.Molecule("H_Mes2PCBH2_TS3series1.xyz")
HH.guess_bonds()
newmol = rdkitTools.apply_template(HH, template)
# Change the 2 hydrogens to dummy atoms
temp = rdkitTools.modify_atom(newmol, 47, '*')
temp = rdkitTools.modify_atom(temp, 48, '*')
# Put coordinates of dummy atoms to 0.0, this will force generating new
# coordinates for the new atoms
temp.atoms[47].move_to((0.0, 0.0, 0.0))
temp.atoms[48].move_to((0.0, 0.0, 0.0))

# Replace dummy atoms by new groups, generate coordinates only for new atoms
job_list = []
for mod, smirks in list_of_modifications.items():
    print(mod)
    temp2 = rdkitTools.apply_smirks(temp, smirks)[0]
    temp2 = rdkitTools.apply_smirks(temp2, smirks)[0]
    freeze = rdkitTools.gen_coords(temp2)
    # rdkitTools.write_molblock(temp2)
    # generate job
    s = Settings()
    s.freeze = [a + 1 for a in freeze]
    partial_geometry = adf(templates.geometry.overlay(s),
                           temp2,
                           job_name="partial_opt_" + mod)
    job_list.append(
        adf(templates.ts, partial_geometry.molecule, job_name="ts_" + mod))

results = run(gather(*job_list), n_processes=1)