|
1 | 1 | import isicle |
2 | 2 |
|
3 | 3 | # Load example structure |
4 | | -geom = isicle.load('CCCC(=O)O') |
| 4 | +geom = isicle.load("CCCC(=O)O") |
5 | 5 |
|
6 | 6 | # Initial optimization |
7 | 7 | geom = geom.initial_optimize(embed=True, forcefield="UFF", ff_iter=200) |
8 | 8 |
|
9 | 9 | # Molecular dynamics |
10 | | -md_result = geom.md(program='xtb', |
11 | | - task='conformer', |
12 | | - forcefield='gff', |
13 | | - ewin=1, |
14 | | - optlevel='Normal') |
| 10 | +md = isicle.md.md( |
| 11 | + geom, |
| 12 | + backend="xtb", |
| 13 | + forcefield="gff", |
| 14 | + optlevel="Normal", |
| 15 | + ewin=3, |
| 16 | + task="conformer", |
| 17 | + solvation="water", |
| 18 | + processes=4, |
| 19 | +) |
| 20 | +# Recommend saving, joblib or pkl |
| 21 | +isicle.save("nmr_conformers.joblib", md) |
| 22 | + |
| 23 | +# Parse molecular dynamics |
| 24 | +# Now separate from isicle.md.md() |
| 25 | +md_parsed = md.parse() |
| 26 | + |
| 27 | +# Using all conformers from CREST |
| 28 | +conformers = md_parsed["geometry"]["conformers"] |
15 | 29 |
|
16 | 30 | # Density functional theory |
17 | | -dft_result = md_result.get_structures().apply(func=isicle.qm.dft, |
18 | | - tasks=['energy', 'shielding'], |
19 | | - functional='b3lyp', |
20 | | - basis_set='3-21g*', |
21 | | - ao_basis='cartesian', |
22 | | - charge=0, |
23 | | - atoms=['C', 'H'], |
24 | | - temp=298.15, |
25 | | - processes=8) |
26 | | - |
27 | | -# Combine shielding result across conformers |
28 | | -shielding = dft_result.get_structures().reduce('shielding', func='boltzmann') |
| 31 | +dft = conformers.apply( |
| 32 | + func=isicle.qm.dft, |
| 33 | + backend="nwchem", |
| 34 | + tasks=["energy", "shielding"], |
| 35 | + functional="b3lyp", |
| 36 | + basis_set="6-31g*", |
| 37 | + ao_basis="cartesian", |
| 38 | + solvent="h2o", |
| 39 | + gas=False, |
| 40 | + atoms=["C", "H"], |
| 41 | + temp=298.15, |
| 42 | + scratch_dir="/tmp", |
| 43 | + processes=8, |
| 44 | +) |
| 45 | + |
| 46 | +# Recommended saving, joblib or pkl |
| 47 | +isicle.save("nmr_dft_conformers.joblib", dft) |
| 48 | + |
| 49 | +# Parse density functional theory results |
| 50 | +dft_parsed = [x.parse() for x in dft] |
| 51 | + |
| 52 | +# Create conformational ensemble, which enable func mapping |
| 53 | +# Combine shielding result across conformers with Boltzmann weighting |
| 54 | +shielding = isicle.conformers.ConformationalEnsemble( |
| 55 | + [x["geometry"] for x in dft_parsed] |
| 56 | +).reduce("_shielding") |
| 57 | + |
| 58 | +# Apply scaling factor to translate tensors to shifts |
| 59 | +shifts = isicle.conformers.transform( |
| 60 | + shielding["mean"], |
| 61 | + m={"H": -0.9921, "C": -0.9816}, |
| 62 | + b={"H": 32.2773, "C": 180.4295}, |
| 63 | + atom=shielding["atom"], |
| 64 | + index=shielding["index"], |
| 65 | +) |
| 66 | + |
| 67 | +# Save results |
| 68 | +isicle.save("shifts.csv", shifts) |
0 commit comments