Exemplo n.º 1
0
def test_linear_ts():
    """
    compute a first approximation to the TS.
    """
    # Read the Molecule from file
    cnc = Molecule('test/test_files/C-N-C.mol', 'mol')

    # User define Settings
    settings = Settings()
    settings.functional = "pbe"
    settings.basis = "SZ"
    settings.specific.dftb.dftb.scc

    constraint1 = Distance(1, 5)
    constraint2 = Distance(3, 4)

    # scan input
    pes = PES(cnc, constraints=[constraint1, constraint2],
              offset=[2.3, 2.3], get_current_values=False,
              nsteps=2, stepsize=[0.1, 0.1])

    # returns a set of results object containing the output of
    # each point in the scan
    lt = pes.scan([dftb, adf], settings)

    # Gets the object presenting the molecule
    # with the maximum energy calculated from the scan
    apprTS = select_max(lt, "energy")

    # Run the TS optimization, using the default TS template
    ts = run(apprTS)

    expected_energy = -3.219708290363864

    assert abs(ts.energy - expected_energy) < 0.02
Exemplo n.º 2
0
scan = {
    'constraint': [constraint1, constraint2],
    'surface': {
        'nsteps': 6,
        'start': [2.3, 2.3],
        'stepsize': [0.1, 0.1]
    }
}

# returns a set of results object containing the output of
# each point in the scan
lt = PES_scan([dftb, adf], settings, cnc, scan)

# Gets the object presenting the molecule
# with the maximum energy calculated from the scan
apprTS = select_max(lt, "energy")

appr_hess = dftb(templates.freq.overlay(settings), apprTS.molecule)

t = Settings()
t.specific.adf.geometry.inithess = appr_hess.archive.path

# Run the TS optimization with ADF, using initial hessian from DFTB freq calculation
ts = run(adf(templates.ts.overlay(settings).overlay(t), appr_hess.molecule),
         n_processes=1)

# Retrieve the molecular coordinates
mol = ts.molecule
r1 = mol.atoms[0].coords
r2 = mol.atoms[4].coords
Exemplo n.º 3
0
    p_freq = adf(templates.freq.overlay(settings), p.molecule, job_name=name + "_p_freq")

# Prepare scan
    pes_jobs = []
    for d in range(6):
        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
Exemplo n.º 4
0
    pjob = adf(
        templates.geometry.overlay(settings),
        dftb(templates.geometry.overlay(settings),
             pmol, job_name=name + "_p_DFTB").molecule,
        job_name=name + "_p")

  # Prepare TS jobs
    # Define PES
    pes = PES(pjob.molecule, constraints=[bond1, bond2],
              offset=[2.0, 2.0], get_current_values=False, nsteps=5, stepsize=[0.1, 0.1])

    # pesscan: gathered (promised) result objects for each point in the scan
    pesscan = pes.scan([dftb, adf], settings, job_name=name + "_PES")

    # Get the result with the maximum energy
    apprTS = select_max(pesscan, 'energy')

    # Calculate the DFTB hessian
    DFTBfreq = dftb(templates.freq.overlay(settings), apprTS.molecule, job_name=name + "_DFTBfreq")

    # 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
    TSfreq = adf(templates.freq.overlay(settings), TS.molecule, job_name=name + "_freq")

  # Add the jobs to the job list
    job_list.append(gather(r1job, r2job, pjob, TSfreq, TS.optcycles))