예제 #1
0
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
예제 #2
0
파일: opt_orca.py 프로젝트: miroi/qmworks
def test_opt_orca():
    """
    Test Orca input generation and run functions.
    """
    h2o = Molecule('test/test_files/h2o.xyz', 'xyz', charge=0, multiplicity=1)

    h2o_geometry = dftb(templates.geometry, h2o)

    s = Settings()
    # generic keyword "basis" must be present in the generic dictionary
    s.basis = "sto_dzp"
    # "specific" allows the user to apply specific keywords for a
    # package that are not in a generic dictionary
    # s.specific.adf.basis.core = "large"

    r = templates.singlepoint.overlay(s)
    h2o_singlepoint = orca(r, h2o_geometry.molecule)

    dipole = h2o_singlepoint.dipole

    final_result = run(dipole, n_processes=1)

    expected_dipole = [0.82409, 0.1933, -0.08316]
    diff = sqrt(sum((x - y)**2 for x, y in zip(final_result, expected_dipole)))
    print("Expected dipole computed with Orca 3.0.3 is:", expected_dipole)
    print("Actual dipole is:", final_result)

    assert diff < 1e-2
예제 #3
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
예제 #4
0
def calc_reactant(name):
    smiles = {'C': '[CH2]=', 'N': '[NH]=', 'O': 'O='}[name[0]] +\
             {'N': '[NH+]', 'O': '[O+]', 'S': '[S+]'}[name[1]] +\
             {'C': '[CH2-]', 'N': '[NH-]', 'O': '[O-]'}[name[2]]
    mol = rdkitTools.smiles2plams(smiles)
    mol.properties.smiles = smiles
    return dftb(templates.geometry.overlay(settings),
                mol,
                job_name=name + "_reactant")
예제 #5
0
def calc_reactant(name):
    smiles = {'C': '[CH]#', 'N': '[N]#'}[name[0]] + "[N+]" +\
             {'C': '[CH2-]', 'N': '[NH-]', 'O': '[O-]'}[name[2]]
    mol = rdkitTools.smiles2plams(smiles)
    mol.properties.smiles = smiles
    reactant = adf(templates.geometry.overlay(settings),
                   dftb(templates.geometry.overlay(settings), mol,
                        job_name=name + "_reactant_DFTB").molecule,
                   job_name=name + "_reactant")
    return reactant
예제 #6
0
            if reverse in reaction_names:  # skip duplicates
                continue
            reaction_names.add(name)
            print(name)

# generate all jobs
job_list = []
for name in reaction_names:
    reactant = calc_reactant(name)
    product, TS = calc_productAndTS(name)
    job_list.append(gather(reactant, product, TS))

# Need also the energy of ethene
ethene = rdkitTools.smiles2plams('C=C')
E_ethene_job = dftb(templates.geometry.overlay(settings),
                    ethene,
                    job_name="ethene").energy

# Actual execution of the jobs
E_ethene, results = run(gather(E_ethene_job, gather(*job_list)), n_processes=1)


def bond_distance(r1, r2):
    return sqrt(sum((x - y)**2 for x, y in zip(r1, r2)))


# extract table from results
table = {}
for reactant, product, TS in results:

    # Retrieve the molecular coordinates
예제 #7
0
plams.init()

hartree2kcal = 627.5095


def bond_distance(r1, r2):
    return sqrt(sum((x - y)**2 for x, y in zip(r1, r2)))


startvalue = {'C': 2.1, 'N': 1.9, 'O': 1.8}

settings = Settings()
settings.specific.dftb.dftb.scc

ethene = rdkitTools.smiles2plams('C=C')
E_ethene = run(dftb(templates.geometry.overlay(settings), ethene)).energy

molecules = set()
result = {}
for a1 in ('C', 'N', 'O'):
    for a2 in ('N', 'O', 'S'):
        for a3 in ('C', 'N', 'O'):
            # reactant
            smiles = 'C1' + a1 + a2 + a3 + 'C1'
            reverse = 'C1' + a3 + a2 + a1 + 'C1'
            if reverse in molecules:  # skip duplicates
                continue
            molecules.add(smiles)
            print(smiles)
            product = rdkitTools.smiles2plams(smiles)
            E_product = dftb(templates.geometry.overlay(settings),
예제 #8
0
    '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

print("TS Bond distance:", bond_distance(r1, r2))
print("TS Energy:", ts.energy)
예제 #9
0
# User define Settings
settings = Settings()
settings.functional = "pbe"
settings.basis = "TZ2P"
settings.specific.dftb.dftb.scc


job_list = []
# Loop over all reactions
for name, reactant1, reactant2, product in reactions:

  # Prepare reactant1 job
    r1mol = rdkitTools.smiles2plams(reactant1)
    r1job = adf(
        templates.geometry.overlay(settings),
        dftb(templates.geometry.overlay(settings), r1mol,
             job_name=name + "_r1_DFTB").molecule,
        job_name=name + "_r1")

  # Prepare reactant2 job
    r2mol = rdkitTools.smiles2plams(reactant2)
    r2job = adf(
        templates.geometry.overlay(settings),
        dftb(templates.geometry.overlay(settings), r2mol,
             job_name=name + "_r2_DFTB").molecule,
        job_name=name + "_r2")

  # Prepare product job
    pmol = rdkitTools.smiles2plams(product)
    pmol.properties.name = name
    pjob = adf(
        templates.geometry.overlay(settings),
예제 #10
0
plams.init()

# User Defined imports
from qmworks.packages.SCM import dftb, adf

# from qmworks.components import adffragmentsjob

rdmol = Chem.MolFromPDBFile('Dialanine.pdb')
supermol = rdopp.add_prot_Hs(rdmol)

# settings = Settings ()
# settings.functional = 'bp86'
#
# settings.basis = 'DZP'
# settings.specific.adf.basis.core = 'Large'

# supermolecule calculation
# supermol_job =  adf(templates.singlepoint.overlay(settings), supermol, job_name = 'supermol_singlepoint')
supermol_job =  dftb(templates.singlepoint, supermol, job_name = 'supermol_singlepoint')
# supermol_dipole = supermol_results.get_dipole_vector()

#frags,caps = rdkitTools.partition_protein(supermol, cap=None)
frags, caps = rdopp.partition_protein(supermol, cap=None)
# mfcc_job = mfcc(adf, frags, caps, settings)
mfcc_job = mfcc(dftb, frags, caps)

supermol_result, mfcc_result = run(gather(supermol_job, mfcc_job))

print(supermol_result.dipole)
print(mfcc_result.dipole)
예제 #11
0
# User define Settings
settings = Settings()
settings.functional = "pbe"
settings.basis = "TZ2P"
settings.specific.dftb.dftb.scc

job_list = []
for s1 in ('C', 'N', 'O'):
    n1 = rdkitTools.modify_atom(cnc_ts, 0, s1)
    for s2 in ('N', 'O', 'S'):
        n2 = rdkitTools.modify_atom(n1, 1, s2)
        for s3 in ('C', 'N', 'O'):
            n3 = rdkitTools.modify_atom(n2, 2, s3)
            name = s1 + '-' + s2 + '-' + s3
            n3.properties.name = name
            dftb_freq = dftb(templates.freq.overlay(settings), n3,
                             job_name=name + "_dftb_freq")
            t = Settings()
            t.specific.adf.geometry.inithess = dftb_freq.archive.path
            job_list.append(adf(templates.ts.overlay(settings).overlay(t), n3,
                                job_name=name + "_ts"))

wf = gather(*job_list)

# Actual execution of the jobs
results = run(wf, n_processes=1)


def bond_distance(r1, r2):
    return sqrt(sum((x - y) ** 2 for x, y in zip(r1, r2)))

# extract table from results