Пример #1
0
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
Пример #2
0
def test_opt_orca():
    """Test Orca input generation and run functions."""
    h2o = Molecule(PATH_MOLECULES / "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"
    # 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)))
    logger.info(
        f"Expected dipole computed with Orca 3.0.3 is: {expected_dipole}")
    logger.info(f"Actual dipole is: {final_result}")

    assertion.lt(diff, 1e-2)
Пример #3
0
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
Пример #4
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))
Пример #5
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))
Пример #6
0
def example_ADF3FDE_Dialanine():
    # For the purpose of the example, define the pdb file here.

    dialanine_pdb = io.StringIO(
'''HEADER    OXIDOREDUCTASE                          06-JUL-94   1PBE
TITLE     CRYSTAL STRUCTURE OF THE P-HYDROXYBENZOATE HYDROXYLASE-SUBSTRATE
TITLE    2 COMPLEX REFINED AT 1.9 ANGSTROMS RESOLUTION. ANALYSIS OF THE ENZYME-
TITLE    3 SUBSTRATE AND ENZYME-PRODUCT COMPLEXES
ATOM    937  N   ALA A 124      28.566 107.090  69.900  1.00 19.62           N
ATOM    938  CA  ALA A 124      28.940 106.368  71.140  1.00 19.55           C
ATOM    939  C   ALA A 124      30.169 105.591  70.700  1.00 21.08           C
ATOM    940  O   ALA A 124      29.935 104.701  69.852  1.00 22.09           O
ATOM    941  CB  ALA A 124      27.826 105.376  71.472  1.00 28.37           C
ATOM    942  N   ALA A 125      31.330 105.921  71.145  1.00 22.72           N
ATOM    943  CA  ALA A 125      32.573 105.296  70.663  1.00 22.82           C
ATOM    944  C   ALA A 125      33.073 104.318  71.705  1.00 26.31           C
ATOM    945  O   ALA A 125      32.743 104.415  72.876  1.00 22.69           O
ATOM    946  CB  ALA A 125      33.596 106.405  70.359  1.00 22.03           C
END
''')

    supermol = molkit.readpdb(dialanine_pdb)

    supermol = molkit.add_Hs(supermol)

    # Calculate dipole normally
    supermol_job = dftb(templates.singlepoint, supermol,
                        job_name='supermol_singlepoint')

    # Calculate dipole with mfcc approach
    frags, caps = molkit.partition_protein(supermol)
    mfcc_job = mfcc(dftb, frags, caps)

    supermol_dipole, mfcc_dipole = run(gather(supermol_job.dipole, mfcc_job.dipole))

    print("Supermolecule dipole: ", supermol_dipole)
    print("mfcc dipole: ", mfcc_dipole)

    return supermol_dipole, mfcc_dipole
Пример #7
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)
Пример #8
0
settings.functional = "b3lyp"
settings.specific.orca.basis.basis = "_6_31G"
settings.specific.orca.basis.pol = "_d"
settings.specific.orca.basis.diff = "_p"
settings.specific.dftb.dftb.scc.ndiis = 4
settings.specific.dftb.dftb.scc.Mixing = 0.1
settings.specific.dftb.dftb.scc.iterations = 300


job_list = []
# Loop over all reactions
for name, r1_smiles, r2_smiles, p_smiles in reactions:

  # Prepare reactant1 job
    r1_mol =  molkit.from_smiles(r1_smiles)
    r1_dftb = dftb(templates.geometry.overlay(settings), r1_mol, job_name=name + "_r1_DFTB")
    r1 =      adf(templates.geometry.overlay(settings), r1_dftb.molecule, job_name=name + "_r1")
    r1_freq = adf(templates.freq.overlay(settings), r1.molecule, job_name=name + "_r1_freq")

  # Prepare reactant2 job
    r2s_mol =  molkit.from_smiles(r2_smiles, nconfs=10, forcefield='mmff', rms=0.1)
    r2s_dftb = [dftb(templates.geometry.overlay(settings), r2_mol, job_name=name + "_r2_DFTB") for r2_mol in r2s_mol]
    r2_dftb = select_min(gather(*r2s_dftb), 'energy')
    r2 =      adf(templates.geometry.overlay(settings), r2_dftb.molecule, job_name=name + "_r2")
    r2_freq = adf(templates.freq.overlay(settings), r2.molecule, job_name=name + "_r2_freq")

# Prepare product job
    ps_mol =  molkit.from_smiles(p_smiles, nconfs=10, forcefield='mmff', name=name, rms=0.1)
    ps_dftb = [dftb(templates.geometry.overlay(settings), p_mol, job_name=name + "_ps_DFTB") for p_mol in ps_mol]
    p_dftb = select_min(gather(*ps_dftb), 'energy')
    p =      adf(templates.geometry.overlay(settings), p_dftb.molecule, job_name=name + "_p")
Пример #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[:1]:

  # Prepare reactant1 job
    r1mol = molkit.from_smiles(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 = molkit.from_smiles(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 = molkit.from_smiles(product)
    pmol.properties.name = name
    pjob = adf(
        templates.geometry.overlay(settings),
Пример #10
0
  O    0.93874565776916      0.76907359603763     -0.48055185294869
  C   -0.93375384866586     -0.24065248892727     -1.32868508338709
  H   -2.06330249766107     -1.10524960979939      0.46177231972758
  H   -0.61425226052981      0.06238167064304     -2.30462642727095
''')

guessTS = plams.Molecule()
guessTS.readxyz(xyz_file, 1)

# Some dftb specific settings
dftb_set = Settings()
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")