Exemple #1
0
def test_keywords():

    Config.keyword_prefixes = True
    keywords = Keywords(keyword_list=None)
    assert keywords.keyword_list == []

    assert isinstance(GradientKeywords(None), Keywords)
    assert isinstance(OptKeywords(None), Keywords)
    assert isinstance(SinglePointKeywords(None), Keywords)

    keywords = Keywords(keyword_list=['test'])

    # Should not add a keyword that's already there
    keywords.append('test')
    assert len(keywords.keyword_list) == 1

    assert hasattr(keywords, 'copy')

    # Should have reasonable names
    assert 'opt' in str(OptKeywords(None)).lower()
    assert 'hess' in str(HessianKeywords(None)).lower()
    assert 'grad' in str(GradientKeywords(None)).lower()
    assert 'sp' in str(SinglePointKeywords(None)).lower()
    Config.keyword_prefixes = False
Exemple #2
0
def test_keywords():

    keywords = Keywords(keyword_list=None)
    assert keywords.keyword_list == []

    assert isinstance(GradientKeywords(None), Keywords)
    assert isinstance(OptKeywords(None), Keywords)
    assert isinstance(SinglePointKeywords(None), Keywords)

    keywords = Keywords(keyword_list=['test'])

    # Should not readd a keyword that's already there
    keywords.append('test')
    assert len(keywords.keyword_list) == 1

    assert hasattr(keywords, 'copy')
Exemple #3
0
    ethene and butadiene"""
    ade.Config.n_cores = 8
    ade.Config.ORCA.keywords.set_functional('PBE')

    rxn = ade.Reaction('C=CC=C.C=C>>C1=CCCCC1', name='DA')
    rxn.locate_transition_state()
    rxn.ts.print_xyz_file(filename='ts.xyz')
    return None


# First find the transition state and save ts.xyz
find_ts()

# Set the keywords to use for an ORCA energy and gradient calculation as low-
# level PBE with a double zeta basis set
gt.GTConfig.orca_keywords = GradientKeywords(['PBE', 'def2-SVP', 'EnGrad'])

# Initialise a cubic box 10x10x10 Å containing a single methane molecule
da_ts = gt.System(box_size=[10, 10, 10])
da_ts.add_molecules(gt.Molecule('ts.xyz'))

# and train the GAP using a 0.1 eV threshold (~2 kcal mol-1), here the initial
# configuration from which dynamics is propagated from needs to be fixed to
# the TS (i.e. the first configuration) for good sampling around the TS
data, gap = gt.active.train(da_ts,
                            method_name='orca',
                            temp=500,
                            active_e_thresh=0.1,
                            max_time_active_fs=200,
                            fix_init_config=True)
Exemple #4
0
import gaptrain as gt
from autode.wrappers.keywords import GradientKeywords

gt.GTConfig.n_cores = 8

if __name__ == '__main__':

    gt.GTConfig.orca_keywords = GradientKeywords(
        ['PBE', 'ma-def2-SVP', 'EnGrad'])

    # large box to ensure no self-interaction
    sn2_ts = gt.System(box_size=[20, 20, 20])
    sn2_ts.add_molecules(gt.Molecule('ts.xyz', charge=-1))

    gap = gt.GAP(name='sn2_gap', system=sn2_ts, default_params=False)
    gap.params.soap['C'] = gt.GTConfig.gap_default_soap_params
    gap.params.soap['C']['other'] = ['H', 'Cl']
    gap.params.soap['C']['cutoff'] = 6.0

    data, gap = gt.active.train(sn2_ts,
                                method_name='orca',
                                temp=500,
                                active_e_thresh=0.1,
                                max_time_active_fs=500,
                                fix_init_config=True)

    # 'uplift' the configurations obtained at PBE/DZ to MP2/TZ
    gt.GTConfig.orca_keywords = GradientKeywords(
        ['DLPNO-CCSD(T)', 'ma-def2-TZVPP', 'NumGrad', 'AutoAux', 'EnGrad'])
    data.parallel_orca()
    gap.train(data)
Exemple #5
0
"""Train a GAP for a gas phase methane molecule with a PBE/def2-SVP ground
truth and compare the accuracy along a trajectory"""
import gaptrain as gt
from autode.wrappers.keywords import GradientKeywords
gt.GTConfig.n_cores = 8

# Set the keywords to use for an ORCA energy and gradient calculation
gt.GTConfig.orca_keywords = GradientKeywords(['PBE', 'def2-SVP', 'EnGrad'])

# Initialise a cubic box 10x10x10 Å containing a single methane molecule
methane = gt.System(box_size=[10, 10, 10])
methane.add_molecules(gt.Molecule('methane.xyz'))

# Train a GAP at 1000 K
data, gap = gt.active.train(methane, method_name='orca', temp=1000)

# Run 1 ps molecular dynamics using the GAP at 300 K using a 0.5 fs time-step.
# The initial configuration is methane located at a random position in the box
traj = gt.md.run_gapmd(
    configuration=methane.random(),
    gap=gap,
    temp=500,  # Kelvin
    dt=0.5,  # fs
    interval=1,  # frames
    fs=50,
    n_cores=4)

# save the trajectory with no energies
traj.save(filename='traj.xyz')

# create sets of data from the trajectory containing predicted & true energies