Exemplo n.º 1
0
def test_hessian_transfer():
    """Test DFTB -> Orca hessian transfer."""
    h2o = molkit.from_smiles('O')
    h2o.properties.symmetry = 'C1'

    h2o_freq = dftb(templates.freq, h2o, job_name="freq").hessian

    s = Settings()
    s.inithess = h2o_freq

    h2o_opt = orca(templates.geometry.overlay(s), h2o, job_name="opt")

    energy = h2o_opt.energy
    dipole = h2o_opt.dipole

    wf = gather(energy, dipole)

    logger.info(run(wf))
Exemplo n.º 2
0
def test_orca_init_hessian():
    """Test the translation from settings to CP2K specific keywords."""
    # Read Hessian from DFTB
    PATH_RKF = PATH / "output_dftb" / "dftb_freq" / "dftb.rkf"
    assertion.truth(PATH_RKF.exists())
    hess = kfreader(PATH_RKF, section="AMSResults", prop="Hessian")
    water = molkit.from_smiles('[OH2]', forcefield='mmff')

    # Tess Hessian initialization
    s = Settings()
    hess = np.array(hess).reshape(9, 9)
    s.inithess = hess
    ORCA.handle_special_keywords(s, "inithess", hess, water)

    # Test that the hessian is readable
    new_hess = parse_hessian(s.specific.orca.geom.InHessName)
    new_hess = np.array(new_hess, dtype=np.float64)
    assertion.truth(np.allclose(hess, new_hess, atol=1e-5))
Exemplo n.º 3
0
def test_hessian_transfer():
    """
    Test DFTB -> Orca hessian transfer
    """
    h2o = molkit.from_smiles('O')
    h2o.properties.symmetry = 'C1'

    h2o_freq = dftb(templates.freq, h2o, job_name="freq").hessian

    s = Settings()
    s.inithess = h2o_freq

    h2o_opt = orca(templates.geometry.overlay(s), h2o, job_name="opt")

    energy = h2o_opt.energy
    dipole = h2o_opt.dipole

    wf = gather(energy, dipole)

    print(run(wf))
Exemplo n.º 4
0
def example_H2O2_TS():
    """
    This example generates an approximate TS for rotation in hydrogen peroxide
    using DFTB, and performs a full TS optimization in Orca.
    It illustrates using a hessian from one package, DFTB in this case,
    to initialize a TS optimization in another, i.e. Orca in this case
    """

    # Generate hydrogen peroxide molecule
    h2o2 = molkit.from_smarts('[H]OO[H]')

    # Define dihedral angle
    dihe = Dihedral(1, 2, 3, 4)

    # Constrained geometry optimization with DFTB
    # The dihedral is set to 0.0 to obtain an approximate TS
    s1 = Settings()
    s1.constraint.update(dihe.get_settings(0.0))
    dftb_opt = dftb(templates.geometry.overlay(s1), h2o2)

    # Calculate the DFTB hessian
    dftb_freq = dftb(templates.freq, dftb_opt.molecule)

    # Transition state calculation using the DFTB hessian as starting point
    s2 = Settings()
    s2.inithess = dftb_freq.hessian
    orca_ts = orca(templates.ts.overlay(s2), dftb_opt.molecule)

    # Execute the workflow
    result = run(orca_ts)

    # Analyse the result
    ts_dihe = round(dihe.get_current_value(result.molecule))
    n_optcycles = result.optcycles

    print('Dihedral angle (degrees): {:.0f}'.format(ts_dihe))
    print('Number of optimization cycles: {:d}'.format(n_optcycles))

    return ts_dihe, n_optcycles
Exemplo n.º 5
0
        consset = Settings()
        consset.constraint.update(bond1.get_settings(2.0 + d * 0.1))
        consset.constraint.update(bond2.get_settings(2.0 + d * 0.1))

        pes_name = name + "_pes_" + str(d)
        pes_dftb = dftb(templates.geometry.overlay(settings).overlay(consset), p.molecule, job_name=pes_name + "_DFTB")
        pes =      adf(templates.singlepoint.overlay(settings), pes_dftb.molecule, job_name=pes_name)
        pes_jobs.append(pes)

  # Get the result with the maximum energy
    apprTS = select_max(gather(*pes_jobs), 'energy')
  # Calculate the DFTB hessian
    DFTBfreq = dftb(templates.freq.overlay(settings), apprTS.molecule, job_name=name + "_freq_DFTB")
  # Run the TS optimization, using the initial hession from DFTB
    t = Settings()
    t.inithess = DFTBfreq.hessian
    TS = adf(templates.ts.overlay(settings).overlay(t), DFTBfreq.molecule, job_name=name + "_TS")

  # Perform a freq calculation
  #   freq_setting = Settings()
  #   freq_setting.specific.adf.geometry.frequencies = ""
  #   freq_setting.specific.adf.geometry.__block_replace = True
  #   TSfreq = adf(templates.geometry.overlay(settings).overlay(freq_setting), TS.molecule, job_name=name + "_freq")
    TSfreq = adf(templates.freq.overlay(settings), TS.molecule, job_name=name + "_freq")

  # Add the jobs to the job list
    job_list.append(gather(r1_freq, r2_freq, p_freq, TS, TSfreq))

# Finalize and draw workflow
wf = gather(*job_list)
draw_workflow("wf.svg", wf._workflow)
Exemplo n.º 6
0
dftb_set.specific.dftb.dftb.scc

# Calculate the DFTB hessian
freq_dftb = dftb(templates.freq.overlay(dftb_set),
                 guessTS,
                 job_name="freq_dftb")

# User define Settings
settings = Settings()
settings.functional = "b3lyp"
settings.specific.orca.basis.basis = "_3_21G"
settings.specific.orca.basis.pol = "_d"
settings.specific.orca.basis.diff = "_p"

# Run the TS optimization, using the initial hessian from DFTB
settings.inithess = freq_dftb.hessian

# Define job
ts = orca(templates.ts.overlay(settings), guessTS, job_name="ts")

# Actual execution of the jobs
ts_result = run(ts)

# Bonds to be formed (based on atom numbers in de product)
bond1 = Distance(0, 1)
bond2 = Distance(3, 4)
d1 = bond1.get_current_value(ts_result.molecule)
d2 = bond2.get_current_value(ts_result.molecule)

optcycles = ts_result.optcycles
Exemplo n.º 7
0
# 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, freeze = molkit.apply_reaction_smarts(temp, smirks, complete=True)
    # generate job
    s = Settings()
    s.freeze = freeze
    s.specific.dftb.dftb.resourcesdir = 'QUASINANO2015'
    partial_geometry = dftb(templates.geometry.overlay(s),
                            temp2,
                            job_name="partial_opt_" + mod)
    freq_dftb = dftb(templates.freq.overlay(s),
                     partial_geometry.molecule,
                     job_name="freq_" + mod)
    s = Settings()
    s.specific.orca.main = "B97-D"
    s.specific.orca.basis.basis = "_6_31G"
    s.specific.orca.basis.pol = "_d"
    s.inithess = freq_dftb.hessian
    ts = orca(templates.ts.overlay(s),
              freq_dftb.molecule,
              job_name="ts_" + mod)
    freq = orca(templates.freq.overlay(s), ts.molecule, job_name="freq" + mod)
    job_list.append(freq)

results = run(gather(*job_list), folder="Chris_results", n_processes=1)