def calc_productAndTS(name):
    smiles = 'C1' + name + 'C1'
    mol = rdkitTools.smiles2plams(smiles)
    mol.properties.smiles = smiles
    product = dftb(templates.geometry.overlay(settings),
                   mol,
                   job_name=name + "_product")

    constraint1 = "dist 1 2"
    constraint2 = "dist 4 5"

    sv1 = startvalue[name[0]]
    sv2 = startvalue[name[2]]

    # scan input
    if name[0] == name[2]:
        # symmetric molecule
        scan = {
            'constraint': [constraint1, constraint2],
            'surface': {
                'nsteps': 4,
                'start': [sv1, sv2],
                'stepsize': [0.1, 0.1]
            }
        }
    else:
        scan = {
            'constraint': constraint1,
            'surface': {
                'nsteps': 4,
                'start': sv1,
                'stepsize': 0.1
            },
            'scan': {
                'constraint': constraint2,
                'surface': {
                    'nsteps': 4,
                    'start': sv2,
                    'stepsize': 0.1
                }
            }
        }

    # PES = gathered (promised) result objects for each point in the scan
    PES = PES_scan(dftb,
                   settings,
                   product.molecule,
                   scan,
                   job_name=name + "_PESscan")

    # get the object presenting the molecule with the maximum energy calculated from the scan
    apprTS = select_max(PES, 'energy')

    # perform the TS optimization using the default TS template
    TS = dftb(templates.ts.overlay(settings),
              apprTS.molecule,
              job_name=name + "_TS")
    return product, TS
Beispiel #2
0
def calc_productAndTS(name):
    smiles = 'C1' + name[0] + "=" + name[1:] + 'C1'
    mol = rdkitTools.smiles2plams(smiles)
    mol.properties.smiles = smiles
    product = adf(templates.geometry.overlay(settings),
                  dftb(templates.geometry.overlay(settings),
                       mol,
                       job_name=name + "_product_DFTB").molecule,
                  job_name=name + "_product")

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

    # scan input
    pes = PES(product.molecule,
              constraints=[constraint1, constraint2],
              offset=[2.0, 2.0],
              get_current_values=False,
              nsteps=5,
              stepsize=[0.1, 0.1])

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

    # get the object presenting the molecule with the maximum energy
    # calculated from the scan
    apprTS = select_max(pesscan, 'energy')

    DFTB_freq = dftb(templates.freq.overlay(settings),
                     apprTS.molecule,
                     job_name=name + "_DFTBfreq")

    t = Settings()
    t.specific.adf.geometry.inithess = DFTB_freq.kf.path

    # Run the TS optimization, using the default TS template
    TS = adf(templates.ts.overlay(settings).overlay(t),
             DFTB_freq.molecule,
             job_name=name + "_TS")

    adf_freq = adf(templates.freq.overlay(settings),
                   TS.molecule,
                   job_name=name + "_freq")

    return product, adf_freq
Beispiel #3
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(0, 4)
    constraint2 = Distance(2, 3)

    # 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
Beispiel #4
0
                        'constraint': constraint2,
                        'surface': {
                            'nsteps': 4,
                            'start': sv2,
                            'stepsize': 0.1
                        }
                    }
                }

            # returns a set of results object containing the output of
            # each point in the scan
            LT = PES_scan(dftb, settings, product, scan)

            # 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 = dftb(templates.ts.overlay(settings), apprTS.molecule)

            # Actual execution of the jobs
            reactives = [E_reactant, E_product, TS]
            E_reactant, E_product, TS = run(gather(*reactives), n_processes=1)

            # Retrieve the molecular coordinates
            mol = TS.molecule
            d1 = bond_distance(mol.atoms[0].coords, mol.atoms[1].coords)
            d2 = bond_distance(mol.atoms[3].coords, mol.atoms[4].coords)

            Eact = (TS.energy - E_ethene - E_reactant) * hartree2kcal
            Ereact = (E_product - E_ethene - E_reactant) * hartree2kcal
Beispiel #5
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
Beispiel #6
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.specific.adf.geometry.inithess = DFTBfreq.kf.path
    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))