venuspython 1.0.1__tar.gz → 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {venuspython-1.0.1 → venuspython-1.0.3}/PKG-INFO +17 -17
  2. {venuspython-1.0.1 → venuspython-1.0.3}/README.md +16 -16
  3. {venuspython-1.0.1 → venuspython-1.0.3}/pyproject.toml +7 -7
  4. venuspython-1.0.3/venuspy/__init__.py +1 -0
  5. venuspython-1.0.3/venuspy/calc/bagelcalc.py +198 -0
  6. venuspython-1.0.3/venuspy/calc/chempotpycalc.py +108 -0
  7. venuspython-1.0.3/venuspy/calc/minisgdmlcalc.py +84 -0
  8. venuspython-1.0.3/venuspy/calc/mopaccalc.py +154 -0
  9. venuspython-1.0.3/venuspy/calc/nwchemcalc.py +314 -0
  10. venuspython-1.0.3/venuspy/calc/nwchemexcalc.py +431 -0
  11. venuspython-1.0.3/venuspy/calc/original_nwchemexcalc.py +282 -0
  12. venuspython-1.0.3/venuspy/calc/physnetcalc.py +289 -0
  13. venuspython-1.0.3/venuspy/calc/psi4calc.py +227 -0
  14. venuspython-1.0.3/venuspy/calc/qcengineGAMESScalc.py +213 -0
  15. venuspython-1.0.3/venuspy/calc/xtbcalc.py +358 -0
  16. venuspython-1.0.3/venuspy/cli.py +577 -0
  17. {venuspython-1.0.1 → venuspython-1.0.3}/venuspy/initialSampling.py +3 -1
  18. {venuspython-1.0.1 → venuspython-1.0.3}/venuspython.egg-info/PKG-INFO +17 -17
  19. venuspython-1.0.3/venuspython.egg-info/SOURCES.txt +23 -0
  20. venuspython-1.0.1/venuspy/__init__.py +0 -1
  21. venuspython-1.0.1/venuspython.egg-info/SOURCES.txt +0 -11
  22. {venuspython-1.0.1 → venuspython-1.0.3}/cli.py +0 -0
  23. {venuspython-1.0.1 → venuspython-1.0.3}/setup.cfg +0 -0
  24. {venuspython-1.0.1 → venuspython-1.0.3}/venuspy/md.py +0 -0
  25. {venuspython-1.0.1 → venuspython-1.0.3}/venuspython.egg-info/dependency_links.txt +0 -0
  26. {venuspython-1.0.1 → venuspython-1.0.3}/venuspython.egg-info/entry_points.txt +0 -0
  27. {venuspython-1.0.1 → venuspython-1.0.3}/venuspython.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: venuspython
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: VENUSpy Initial Sampling and Molecular Dynamics
5
5
  Keywords: moleculardynamics,initialsampling
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -33,11 +33,11 @@ Inside the downloaded folder, you can install VENUSpy with the Atomic Simulation
33
33
 
34
34
  ```
35
35
  cd VENUSpy
36
- pip install venuspy
36
+ pip install venuspython
37
37
  pip install ase
38
38
  ```
39
39
 
40
- The file `cli.py` can be run with your favourite Python environment so long as the appropriate packages can be installed. Then, input files and command line arguments can be supplied to it.
40
+ The file `cli.py` can be run with your favourite Python environment so long as the appropriate packages can be installed; if installed with pip, then it can also be accessed with the alias `venuspy-cli`. Then, input files and command line arguments can be supplied to it.
41
41
 
42
42
  There are three key features in VENUSpy:
43
43
  - [Sampling Methods](#sampling-methods)
@@ -67,7 +67,7 @@ pip install tblite
67
67
  Water is a nonlinear molecule with three atoms, so it has three normal modes. The vibrational quanta of each mode will be sampled from a canonical ensemble with the `--INITQPa "thermal"` argument, which assumes energies in each mode are related by a temperature. The frequency of the modes dictates the distribution of quanta and their energies. With xTB, these frequencies are 3653 cm<sup>-1</sup> > 3645 cm<sup>-1</sup> > 1538 cm<sup>-1</sup> for the symmetric stretch, asymmetric stretch, and bending modes, respectively. VENUSpy can sample these with:
68
68
 
69
69
  ```
70
- python -u cli.py examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --TVIBa 298.0 --TROTa 0.001 --n_threads 1 > production.log
70
+ venuspy-cli examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --TVIBa 298.0 --TROTa 0.001 --n_threads 1 > production.log
71
71
  ```
72
72
 
73
73
  While tracking the normal mode breakdown of energies over the entire trajectory is slow (this requires a Hessian calculation at each step), this can be done for the first frame from the initial sampling. Search for the `Evibs` keyword in the output to see energies of each mode (in eV).
@@ -94,7 +94,7 @@ The resulting distribution of vibrational energies in each mode is shown in the
94
94
  Water is a nonlinear molecule with three atoms, so it has three normal modes. The vibrational energies of each mode will be sampled from a microcanonical ensemble with the `--INITQPa "microcanonical"` argument, which assumes uniform mixing of energies between all modes. The frequency of the modes dictates the absolute amount of energy ultimately given to a mode. With xTB, these frequencies are 3653 cm<sup>-1</sup> > 3645 cm<sup>-1</sup> > 1538 cm<sup>-1</sup> for the symmetric stretch, asymmetric stretch, and bending modes, respectively. VENUSpy can sample these with:
95
95
 
96
96
  ```
97
- python -u cli.py examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "microcanonical" --EVIBa 12.6372 --EROTa 0.00001 --n_threads 1 > production.log
97
+ venuspy-cli examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "microcanonical" --EVIBa 12.6372 --EROTa 0.00001 --n_threads 1 > production.log
98
98
  ```
99
99
 
100
100
  While tracking the normal mode breakdown of energies over the entire trajectory is slow (this requires a Hessian calculation at each step), this can be done for the first frame from the initial sampling. Search for the `Evibs` keyword in the output to see energies of each mode (in eV).
@@ -123,7 +123,7 @@ Finally, there is one more special case for diatomic molecules. Because polyatom
123
123
  Let's do an example for the OH radical with the same software, for the N=2,J=5 rovibrational state:
124
124
 
125
125
  ```
126
- python -u cli.py examples/OH.input.xyz examples/OH.input.xtb . --atomsInFirstGroup "1 2" --production 100 --interval 1 --time_step 0.15 --INITQPa "semiclassical" --NVIBa 2 --NROTa 5 --n_threads 1 > production.log
126
+ venuspy-cli examples/OH.input.xyz examples/OH.input.xtb . --atomsInFirstGroup "1 2" --production 100 --interval 1 --time_step 0.15 --INITQPa "semiclassical" --NVIBa 2 --NROTa 5 --n_threads 1 > production.log
127
127
  ```
128
128
 
129
129
  Note that, with the semiclassical method, the rovibrational states' energies are not known a priori, as they are not approximated from the normal mode frequencies. Thus, only specific rovibrational states (N,J) can be sampled rather than ensembles. However, the ensemble of phases for a state are still sampled.
@@ -177,7 +177,7 @@ H -2.684400 1.453100 0.000000
177
177
  Then, any initial sampling and MD parameters can be given to this so long as the B and C<sub>2</sub>H<sub>2</sub> are kept separate. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold C<sub>2</sub>H<sub>2</sub>, the following command works:
178
178
 
179
179
  ```
180
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.mopac . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
180
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.mopac . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
181
181
  ```
182
182
 
183
183
  Sometimes the SCF calculation in MOPAC does not converge which leads to the error: `ase.calculators.calculator.CalculationFailed: ... failed`. This happens about 1/5 times for this system; restarting it often resolves this.
@@ -230,7 +230,7 @@ referencemethod uhf
230
230
  Similar to the MOPAC implementation, any initial sampling and MD parameters can be given to this so long as the B and C<sub>2</sub>H<sub>2</sub> are kept separate. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold C<sub>2</sub>H<sub>2</sub>, the following command works:
231
231
 
232
232
  ```
233
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.psi4 . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
233
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.psi4 . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
234
234
  ```
235
235
 
236
236
  While PSI4 is parallelized, it is a full electronic structure calculation so it takes more than a minute to do the molecular dynamics, let alone the initial sampling. By default, if there are convergence issues at any step of the initial sampling or dynamics, the ab initio calculation is restarted with slightly different or looser parameters. We suggest skipping a full trajectory simulation if trying this as a test.
@@ -281,7 +281,7 @@ H -2.684400 1.453100 0.000000
281
281
  Similar to the MOPAC implementation, any initial sampling and MD parameters can be given to this so long as the B and C<sub>2</sub>H<sub>2</sub> are kept separate. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold C<sub>2</sub>H<sub>2</sub>, the following command works:
282
282
 
283
283
  ```
284
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
284
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
285
285
  ```
286
286
 
287
287
  Sometimes the xTB calculation does not converge. By default, VENUSpy restarts the calculation a few times with slightly different parameters to try to save the trajectory.
@@ -333,7 +333,7 @@ Q1-Sgm chempotpy O3 O3_6_5Ap_2023 0
333
333
  Then, any initial sampling and MD parameters can be given to this. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold O2, the following command works:
334
334
 
335
335
  ```
336
- python -u cli.py examples/O.O2.input.xyz examples/O.O2.input.chempotpy . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
336
+ venuspy-cli examples/O.O2.input.xyz examples/O.O2.input.chempotpy . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
337
337
  ```
338
338
 
339
339
  </details>
@@ -362,13 +362,13 @@ For Schnet, first install an appropriate version (depending on the version of th
362
362
  python3.11 -m venv .schnetmd
363
363
  source .schnetmd/bin/activate
364
364
  pip install torch==2.3 schnetpack==2.0.4 pytorch-lightning==2.2
365
- pip install ase venuspy
365
+ pip install ase venuspython
366
366
  ```
367
367
 
368
368
  And then do the initial sampling and MD:
369
369
 
370
370
  ```
371
- python -u cli.py examples/CH.C4H6.input.xyz examples/MLmodels/CHC4H6/best_inference_model . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
371
+ venuspy-cli examples/CH.C4H6.input.xyz examples/MLmodels/CHC4H6/best_inference_model . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
372
372
  ```
373
373
 
374
374
 
@@ -378,13 +378,13 @@ For sGDML, first install the latest version with `pip`:
378
378
  python -m venv .sgdmlmd
379
379
  source .sgdmlmd/bin/activate
380
380
  pip install sgdml
381
- pip install ase venuspy
381
+ pip install ase venuspython
382
382
  ```
383
383
 
384
384
  And then do the initial sampling and MD:
385
385
 
386
386
  ```
387
- python -u cli.py examples/HBr.HCl.input.xyz examples/MLmodels/HBrHCl/model-train8000-sym2-sig0050.npz . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
387
+ venuspy-cli examples/HBr.HCl.input.xyz examples/MLmodels/HBrHCl/model-train8000-sym2-sig0050.npz . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
388
388
  ```
389
389
 
390
390
  For Physnet, first download the latest version from github and install tensorflow:
@@ -408,7 +408,7 @@ sed -i 's/from importlib.metadata import entry_points/from importlib_metadata im
408
408
  And then do the initial sampling and MD:
409
409
 
410
410
  ```
411
- python -u cli.py examples/CH.SH2.input.xyz examples/MLmodels/CHSH2/model.physnet.config . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log 2> /dev/null
411
+ venuspy-cli examples/CH.SH2.input.xyz examples/MLmodels/CHSH2/model.physnet.config . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log 2> /dev/null
412
412
  ```
413
413
 
414
414
  </details>
@@ -425,13 +425,13 @@ python -m venv .hybridmd
425
425
  source .hybridmd/bin/activate
426
426
  pip install sgdml
427
427
  pip install tblite
428
- pip install ase venuspy
428
+ pip install ase venuspython
429
429
  ```
430
430
 
431
431
  Add the argument `--MDtype "smoothed"` and you're good to go:
432
432
 
433
433
  ```
434
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --MDtype "smoothed" --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 5000 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
434
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --MDtype "smoothed" --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 5000 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
435
435
  ```
436
436
 
437
437
  The xTB software, although not a completely ab initio theory, uses similar kinds of SCF methods and also runs into convergence problems. Over the course of the 5000 steps simulated, it often will have two or three energy drift/jump issues. When this happens, the sGDML surface quickly trains on the local surface and tries to save the trajectory. After some number of steps, the xTB method takes over again.
@@ -20,11 +20,11 @@ Inside the downloaded folder, you can install VENUSpy with the Atomic Simulation
20
20
 
21
21
  ```
22
22
  cd VENUSpy
23
- pip install venuspy
23
+ pip install venuspython
24
24
  pip install ase
25
25
  ```
26
26
 
27
- The file `cli.py` can be run with your favourite Python environment so long as the appropriate packages can be installed. Then, input files and command line arguments can be supplied to it.
27
+ The file `cli.py` can be run with your favourite Python environment so long as the appropriate packages can be installed; if installed with pip, then it can also be accessed with the alias `venuspy-cli`. Then, input files and command line arguments can be supplied to it.
28
28
 
29
29
  There are three key features in VENUSpy:
30
30
  - [Sampling Methods](#sampling-methods)
@@ -54,7 +54,7 @@ pip install tblite
54
54
  Water is a nonlinear molecule with three atoms, so it has three normal modes. The vibrational quanta of each mode will be sampled from a canonical ensemble with the `--INITQPa "thermal"` argument, which assumes energies in each mode are related by a temperature. The frequency of the modes dictates the distribution of quanta and their energies. With xTB, these frequencies are 3653 cm<sup>-1</sup> > 3645 cm<sup>-1</sup> > 1538 cm<sup>-1</sup> for the symmetric stretch, asymmetric stretch, and bending modes, respectively. VENUSpy can sample these with:
55
55
 
56
56
  ```
57
- python -u cli.py examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --TVIBa 298.0 --TROTa 0.001 --n_threads 1 > production.log
57
+ venuspy-cli examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --TVIBa 298.0 --TROTa 0.001 --n_threads 1 > production.log
58
58
  ```
59
59
 
60
60
  While tracking the normal mode breakdown of energies over the entire trajectory is slow (this requires a Hessian calculation at each step), this can be done for the first frame from the initial sampling. Search for the `Evibs` keyword in the output to see energies of each mode (in eV).
@@ -81,7 +81,7 @@ The resulting distribution of vibrational energies in each mode is shown in the
81
81
  Water is a nonlinear molecule with three atoms, so it has three normal modes. The vibrational energies of each mode will be sampled from a microcanonical ensemble with the `--INITQPa "microcanonical"` argument, which assumes uniform mixing of energies between all modes. The frequency of the modes dictates the absolute amount of energy ultimately given to a mode. With xTB, these frequencies are 3653 cm<sup>-1</sup> > 3645 cm<sup>-1</sup> > 1538 cm<sup>-1</sup> for the symmetric stretch, asymmetric stretch, and bending modes, respectively. VENUSpy can sample these with:
82
82
 
83
83
  ```
84
- python -u cli.py examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "microcanonical" --EVIBa 12.6372 --EROTa 0.00001 --n_threads 1 > production.log
84
+ venuspy-cli examples/H2O.input.xyz examples/H2O.input.xtb . --atomsInFirstGroup "1 2 3" --production 100 --interval 1 --time_step 0.15 --INITQPa "microcanonical" --EVIBa 12.6372 --EROTa 0.00001 --n_threads 1 > production.log
85
85
  ```
86
86
 
87
87
  While tracking the normal mode breakdown of energies over the entire trajectory is slow (this requires a Hessian calculation at each step), this can be done for the first frame from the initial sampling. Search for the `Evibs` keyword in the output to see energies of each mode (in eV).
@@ -110,7 +110,7 @@ Finally, there is one more special case for diatomic molecules. Because polyatom
110
110
  Let's do an example for the OH radical with the same software, for the N=2,J=5 rovibrational state:
111
111
 
112
112
  ```
113
- python -u cli.py examples/OH.input.xyz examples/OH.input.xtb . --atomsInFirstGroup "1 2" --production 100 --interval 1 --time_step 0.15 --INITQPa "semiclassical" --NVIBa 2 --NROTa 5 --n_threads 1 > production.log
113
+ venuspy-cli examples/OH.input.xyz examples/OH.input.xtb . --atomsInFirstGroup "1 2" --production 100 --interval 1 --time_step 0.15 --INITQPa "semiclassical" --NVIBa 2 --NROTa 5 --n_threads 1 > production.log
114
114
  ```
115
115
 
116
116
  Note that, with the semiclassical method, the rovibrational states' energies are not known a priori, as they are not approximated from the normal mode frequencies. Thus, only specific rovibrational states (N,J) can be sampled rather than ensembles. However, the ensemble of phases for a state are still sampled.
@@ -164,7 +164,7 @@ H -2.684400 1.453100 0.000000
164
164
  Then, any initial sampling and MD parameters can be given to this so long as the B and C<sub>2</sub>H<sub>2</sub> are kept separate. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold C<sub>2</sub>H<sub>2</sub>, the following command works:
165
165
 
166
166
  ```
167
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.mopac . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
167
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.mopac . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
168
168
  ```
169
169
 
170
170
  Sometimes the SCF calculation in MOPAC does not converge which leads to the error: `ase.calculators.calculator.CalculationFailed: ... failed`. This happens about 1/5 times for this system; restarting it often resolves this.
@@ -217,7 +217,7 @@ referencemethod uhf
217
217
  Similar to the MOPAC implementation, any initial sampling and MD parameters can be given to this so long as the B and C<sub>2</sub>H<sub>2</sub> are kept separate. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold C<sub>2</sub>H<sub>2</sub>, the following command works:
218
218
 
219
219
  ```
220
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.psi4 . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
220
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.psi4 . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
221
221
  ```
222
222
 
223
223
  While PSI4 is parallelized, it is a full electronic structure calculation so it takes more than a minute to do the molecular dynamics, let alone the initial sampling. By default, if there are convergence issues at any step of the initial sampling or dynamics, the ab initio calculation is restarted with slightly different or looser parameters. We suggest skipping a full trajectory simulation if trying this as a test.
@@ -268,7 +268,7 @@ H -2.684400 1.453100 0.000000
268
268
  Similar to the MOPAC implementation, any initial sampling and MD parameters can be given to this so long as the B and C<sub>2</sub>H<sub>2</sub> are kept separate. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold C<sub>2</sub>H<sub>2</sub>, the following command works:
269
269
 
270
270
  ```
271
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
271
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
272
272
  ```
273
273
 
274
274
  Sometimes the xTB calculation does not converge. By default, VENUSpy restarts the calculation a few times with slightly different parameters to try to save the trajectory.
@@ -320,7 +320,7 @@ Q1-Sgm chempotpy O3 O3_6_5Ap_2023 0
320
320
  Then, any initial sampling and MD parameters can be given to this. For example, for a bimolecular collision initiated with 2.4 kcal/mol of collision energy and cold O2, the following command works:
321
321
 
322
322
  ```
323
- python -u cli.py examples/O.O2.input.xyz examples/O.O2.input.chempotpy . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
323
+ venuspy-cli examples/O.O2.input.xyz examples/O.O2.input.chempotpy . --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
324
324
  ```
325
325
 
326
326
  </details>
@@ -349,13 +349,13 @@ For Schnet, first install an appropriate version (depending on the version of th
349
349
  python3.11 -m venv .schnetmd
350
350
  source .schnetmd/bin/activate
351
351
  pip install torch==2.3 schnetpack==2.0.4 pytorch-lightning==2.2
352
- pip install ase venuspy
352
+ pip install ase venuspython
353
353
  ```
354
354
 
355
355
  And then do the initial sampling and MD:
356
356
 
357
357
  ```
358
- python -u cli.py examples/CH.C4H6.input.xyz examples/MLmodels/CHC4H6/best_inference_model . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
358
+ venuspy-cli examples/CH.C4H6.input.xyz examples/MLmodels/CHC4H6/best_inference_model . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
359
359
  ```
360
360
 
361
361
 
@@ -365,13 +365,13 @@ For sGDML, first install the latest version with `pip`:
365
365
  python -m venv .sgdmlmd
366
366
  source .sgdmlmd/bin/activate
367
367
  pip install sgdml
368
- pip install ase venuspy
368
+ pip install ase venuspython
369
369
  ```
370
370
 
371
371
  And then do the initial sampling and MD:
372
372
 
373
373
  ```
374
- python -u cli.py examples/HBr.HCl.input.xyz examples/MLmodels/HBrHCl/model-train8000-sym2-sig0050.npz . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
374
+ venuspy-cli examples/HBr.HCl.input.xyz examples/MLmodels/HBrHCl/model-train8000-sym2-sig0050.npz . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
375
375
  ```
376
376
 
377
377
  For Physnet, first download the latest version from github and install tensorflow:
@@ -395,7 +395,7 @@ sed -i 's/from importlib.metadata import entry_points/from importlib_metadata im
395
395
  And then do the initial sampling and MD:
396
396
 
397
397
  ```
398
- python -u cli.py examples/CH.SH2.input.xyz examples/MLmodels/CHSH2/model.physnet.config . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log 2> /dev/null
398
+ venuspy-cli examples/CH.SH2.input.xyz examples/MLmodels/CHSH2/model.physnet.config . --atomsInFirstGroup "1 2" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 100 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log 2> /dev/null
399
399
  ```
400
400
 
401
401
  </details>
@@ -412,13 +412,13 @@ python -m venv .hybridmd
412
412
  source .hybridmd/bin/activate
413
413
  pip install sgdml
414
414
  pip install tblite
415
- pip install ase venuspy
415
+ pip install ase venuspython
416
416
  ```
417
417
 
418
418
  Add the argument `--MDtype "smoothed"` and you're good to go:
419
419
 
420
420
  ```
421
- python -u cli.py examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --MDtype "smoothed" --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 5000 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
421
+ venuspy-cli examples/B.C2H2.input.xyz examples/B.C2H2.input.xtb . --MDtype "smoothed" --atomsInFirstGroup "1" --collisionEnergy 2.4 --impactParameter 1.0 --centerOfMassDistance 10.0 --production 5000 --interval 1 --time_step 0.15 --INITQPa "thermal" --INITQPb "thermal" --TVIBa 300.0 --TROTa 300.0 --TVIBb 10.0 --TROTb 10.0 --n_threads 1 > production.log
422
422
  ```
423
423
 
424
424
  The xTB software, although not a completely ab initio theory, uses similar kinds of SCF methods and also runs into convergence problems. Over the course of the 5000 steps simulated, it often will have two or three energy drift/jump issues. When this happens, the sGDML surface quickly trains on the local surface and tries to save the trajectory. After some number of steps, the xTB method takes over again.
@@ -19,15 +19,15 @@ dynamic = ["version", "readme"]
19
19
  readme = {file = ["README.md"], content-type = "text/markdown"}
20
20
  version = {attr = "venuspy.__version__"}
21
21
 
22
- #[tool.setuptools]
23
- #packages = ["venuspy"]
22
+ [tool.setuptools]
23
+ packages = ["venuspy","venuspy.calc"]
24
24
  #py_modules = ["venuspy"]
25
25
 
26
- [tool.setuptools.packages.find]
27
- where = ["."] # list of folders that contain the packages (["."] by default)
28
- include = ["venuspy"] # package names should match these glob patterns (["*"] by default)
29
- exclude = ["*images*", "*examples*"] # exclude packages matching these glob patterns (empty by default)
30
- namespaces = false # to disable scanning PEP 420 namespaces (true by default)
26
+ #[tool.setuptools.packages.find]
27
+ #where = ["."] # list of folders that contain the packages (["."] by default)
28
+ #include = ["venuspy"] # package names should match these glob patterns (["*"] by default)
29
+ #exclude = ["*images*", "*examples*"] # exclude packages matching these glob patterns (empty by default)
30
+ #namespaces = false # to disable scanning PEP 420 namespaces (true by default)
31
31
 
32
32
  [project.scripts]
33
33
  venuspy-cli = "venuspy:cli"
@@ -0,0 +1 @@
1
+ __version__ = "1.0.3"
@@ -0,0 +1,198 @@
1
+ """This module defines an ASE interface to BAGEL.
2
+
3
+ """
4
+ import os
5
+
6
+ import numpy as np
7
+
8
+ from ase import Atoms
9
+ from ase.calculators.calculator import FileIOCalculator, ReadError, Parameters
10
+ from ase.units import kcal, mol, Debye
11
+
12
+ class bagelcalculator(FileIOCalculator):
13
+ # implemented_properties = ['energy', 'forces', 'dipole', 'magmom']
14
+ implemented_properties = ['energy', 'forces', 'dipole']
15
+
16
+ BAGELexe = "/mnt/lustre/koa/koastore/rsun_group/camels/BAGEL_1_AV/BAGEL/bin/BAGEL"
17
+ command = 'mpirun ' + BAGELexe + ' bagel0.json > bagel0.out'
18
+
19
+ discard_results_on_any_change = True
20
+
21
+ def __init__(self, restart=None,
22
+ ignore_bad_restart_file=FileIOCalculator._deprecated,
23
+ label='bagel0', atoms=None, **kwargs):
24
+ """Construct BAGEL-calculator object.
25
+
26
+ Parameters:
27
+
28
+ label: str
29
+ Prefix for filenames (bagel0.json, bagel0.out, ...)
30
+
31
+ Examples:
32
+
33
+ """
34
+ FileIOCalculator.__init__(self, restart, ignore_bad_restart_file,
35
+ label, atoms, **kwargs)
36
+
37
+ # Kazuumi's addition to make a custom input file (must have a 'GEOMETRY HERE' line)
38
+ if ('custominputfile' in kwargs):
39
+ self.custominputfile = kwargs.get('custominputfile',None)
40
+ if not os.path.isfile(self.custominputfile):
41
+ raise ReadError
42
+
43
+ with open(self.custominputfile) as fd:
44
+ lines = fd.readlines()
45
+
46
+ self.pregeometryinput = ''
47
+ self.postgeometryinput = ''
48
+ pregeometry = True
49
+ print("Custom BAGEL input file supplied:")
50
+ for i, line in enumerate(lines):
51
+ print(line,end='')
52
+ if line.find('GEOMETRY HERE') != -1:
53
+ pregeometry = False
54
+ continue
55
+ if (pregeometry):
56
+ self.pregeometryinput += line
57
+ else:
58
+ self.postgeometryinput += line
59
+
60
+ assert pregeometry == False
61
+
62
+ else:
63
+ self.custominputfile = None
64
+
65
+ raise ValueError("This version of VENUSpy/BAGEL requires a custominputfile")
66
+
67
+ def write_input(self, atoms, properties=None, system_changes=None):
68
+ FileIOCalculator.write_input(self, atoms, properties, system_changes)
69
+
70
+ s = self.pregeometryinput
71
+
72
+ # Write coordinates:
73
+ Natoms = len(atoms); i = 1; lineend="},\n"
74
+ for xyz, symbol in zip(atoms.positions, atoms.get_chemical_symbols()):
75
+ if (i == Natoms): lineend="}\n"
76
+ s += ' {0} "atom" : "{1}", "xyz" : [ {2}, {3}, {4} ] {5}'.format("{",symbol, *xyz, lineend)
77
+ i += 1
78
+
79
+ # for v, p in zip(atoms.cell, atoms.pbc):
80
+ # if p:
81
+ # s += 'Tv {0} {1} {2}\n'.format(*v)
82
+
83
+ s += self.postgeometryinput
84
+
85
+ with open('bagel0.json', 'w') as fd:
86
+ fd.write(s)
87
+
88
+ def get_index(self, lines, pattern):
89
+ for i, line in enumerate(lines):
90
+ if line.find(pattern) != -1:
91
+ return i
92
+
93
+ def read(self, label='bagel0'):
94
+ FileIOCalculator.read(self, label)
95
+ if not os.path.isfile(self.label + '.out'):
96
+ raise ReadError
97
+
98
+ with open(self.label + '.out') as fd:
99
+ lines = fd.readlines()
100
+
101
+ self.atoms = self.read_atoms_from_file(lines)
102
+ self.read_results()
103
+
104
+ def read_atoms_from_file(self, lines):
105
+ """Read the Atoms from the output file stored as list of str in lines.
106
+ Parameters:
107
+
108
+ lines: list of str
109
+ """
110
+
111
+ atoms_were_found = False
112
+ for i, line in enumerate(lines):
113
+ if line.find('*** Geometry ***') != -1:
114
+ atoms_were_found = True
115
+ break
116
+
117
+ assert atoms_were_found == True
118
+
119
+ j = 2
120
+ lines1 = lines[i:]
121
+ symbols = []
122
+ positions = []
123
+ while not lines1[j].isspace(): # continue until we hit a blank line
124
+ l = lines1[j].split()
125
+ symbols.append(l[3][1:-2])
126
+ positions.append([float(l[7][:-1]), float(l[8][:-1]), float(l[9])])
127
+ j += 1
128
+
129
+ return Atoms(symbols=symbols, positions=positions)
130
+
131
+ def read_parameters_from_file(self, lines):
132
+ """Find and return the line that defines a Mopac calculation
133
+
134
+ Parameters:
135
+
136
+ lines: list of str
137
+ """
138
+ for i, line in enumerate(lines):
139
+ if line.find('CALCULATION DONE:') != -1:
140
+ break
141
+
142
+ lines1 = lines[i:]
143
+ for i, line in enumerate(lines1):
144
+ if line.find('****') != -1:
145
+ return lines1[i + 1]
146
+
147
+ def read_results(self):
148
+ """Read the results, such as energy, forces, eigenvalues, etc.
149
+ """
150
+ FileIOCalculator.read(self, self.label)
151
+ if not os.path.isfile(self.label + '.out'):
152
+ raise ReadError
153
+
154
+ with open(self.label + '.out') as fd:
155
+ lines = fd.readlines()
156
+
157
+ # To get the final energies (only for MCSCF right now)
158
+ # awk 'BEGIN {Nstate=0} /FCI iteration/ {flag=1;Niter=0} /ci vector/ {if(flag==1){print $0, E};flag=0} {if(flag==1 && $1 == Niter && $2 == Nstate){E=$(NF-2);Niter+=1}}' casscf.log | tail
159
+
160
+ Natoms = len(self.atoms)
161
+
162
+ BAGEL_FCI_iteration_flag = False
163
+ for i, line in enumerate(lines):
164
+
165
+ # Print one copy of the output to the screen
166
+ print(line,end="")
167
+
168
+ if line.find('FCI iteration') != -1:
169
+ BAGEL_FCI_iteration_flag = True
170
+ Niter = "0"
171
+ Nstate = "0" # Assume we are looking for the ground state (state 0)
172
+
173
+ elif line.find('ci vector') != -1:
174
+ BAGEL_FCI_iteration_flag = False
175
+ # print("Energy: " + str(self.results['energy']) + " " + line,end='')
176
+
177
+ elif (BAGEL_FCI_iteration_flag):
178
+ BAGEL_fields = line.split()
179
+
180
+ if (len(BAGEL_fields) >= 5 and BAGEL_fields[0] == Niter and BAGEL_fields[1] == Nstate):
181
+ Niter = str(int(Niter) + 1)
182
+ self.results['energy'] = float(BAGEL_fields[-3]) # * kcal / mol
183
+
184
+ elif line.find('Nuclear energy gradient') != -1:
185
+ forces = [-float(line.split()[1])
186
+ for j, line in enumerate(lines[i+2:i+2 + 4 * Natoms]) if j%4>0 ]
187
+ self.results['forces'] = np.array(
188
+ forces).reshape((-1, 3)) # * kcal / mol
189
+ # print("Forces: ", self.results['forces'])
190
+
191
+ elif line.find('Permanent dipole moment') != -1:
192
+ if line.find('Permanent dipole moment: Unrelaxed') != -1: continue
193
+
194
+ self.results['dipole'] = np.array(
195
+ [float(astring[:-1]) for astring in lines[i+1].split()[1:4]]) * Debye
196
+ # print("Dipole: ", self.results['dipole'])
197
+
198
+
@@ -0,0 +1,108 @@
1
+ import logging
2
+
3
+ import numpy as np
4
+
5
+ import chempotpy
6
+
7
+ from ase.calculators.calculator import Calculator
8
+ from ase.units import eV, kcal, mol
9
+
10
+ class chempotpyCalculator(Calculator):
11
+
12
+ implemented_properties = ['energy', 'forces']
13
+
14
+ def __init__(
15
+ self,
16
+ model,
17
+ E_to_eV=eV, # kcal / mol,
18
+ F_to_eV_Ang=eV, # kcal / mol,
19
+ n_threads=None,
20
+ *args,
21
+ **kwargs
22
+ ):
23
+ """
24
+ ASE calculator for a chempotpy potential.
25
+
26
+ A calculator takes atomic numbers and atomic positions from an Atoms object and calculates the energy and forces.
27
+
28
+ Note
29
+ ----
30
+ ASE uses eV and Angstrom as energy and length unit, respectively. Unless the paramerters `E_to_eV` and `F_to_eV_Ang` are specified, the sGDML model is assumed to use kcal/mol and Angstorm and the appropriate conversion factors are set accordingly.
31
+ Here is how to find them: `ASE units <https://wiki.fysik.dtu.dk/ase/ase/units.html>`_.
32
+
33
+ Parameters
34
+ ----------
35
+ model : :obj:`chempotpy model`
36
+ A chempotpy model file
37
+ E_to_eV : float, optional
38
+ Conversion factor from whatever energy unit is used by the model to eV. By default this parameter is set to convert from kcal/mol.
39
+ F_to_eV_Ang : float, optional
40
+ Conversion factor from whatever length unit is used by the model to Angstrom. By default, the length unit is not converted (assumed to be in Angstrom)
41
+ """
42
+
43
+ super(chempotpyCalculator, self).__init__(*args, **kwargs)
44
+
45
+ self.log = logging.getLogger(__name__)
46
+
47
+ modelargs = model.split()
48
+
49
+ # Figure out whether the "model" input is a file or a one-liner description
50
+ if (len(modelargs) == 1): # This is a file
51
+ with open(modelargs[0]) as f:
52
+ modelargs = f.readlines()[0]
53
+
54
+ self.system = modelargs[2]
55
+ self.modelname = modelargs[3]
56
+
57
+ # Figure out whether this is multistate or not
58
+ if (len(modelargs) > 4):
59
+ self.multistate = True
60
+ self.state = int(modelargs[4])
61
+ else:
62
+ self.multistate = False
63
+
64
+ self.log.warning(
65
+ 'Please remember to specify the proper conversion factors, if your model does not use \'kcal/mol\' and \'Ang\' as units.'
66
+ )
67
+
68
+ # From the chempotpy documentation:
69
+ # The input to ChemPotPy is ALWAYS Cartesian coordinates in angstroms.
70
+ # The output units are ALWAYS potential energies in eV, gradients in
71
+ # eV/angstrom, and nonadiabatic coupling vectors in 1/angstrom.
72
+
73
+ # Converts energy from the unit used by the sGDML model to eV.
74
+ self.E_to_eV = E_to_eV
75
+
76
+ # Converts length from eV to unit used in sGDML model.
77
+ self.Ang_to_R = F_to_eV_Ang / E_to_eV
78
+
79
+ # Converts force from the unit used by the sGDML model to eV/Ang.
80
+ self.F_to_eV_Ang = F_to_eV_Ang
81
+
82
+ def calculate(self, atoms=None, *args, **kwargs):
83
+
84
+ super(chempotpyCalculator, self).calculate(atoms, *args, **kwargs)
85
+
86
+ # convert model units to ASE default units
87
+ r = atoms.get_positions() * self.Ang_to_R
88
+ geom = []; i = 0
89
+ for atom in atoms:
90
+ geom.append([atom.symbol, r[i][0], r[i][1], r[i][2]]); i+=1
91
+
92
+ e, f, nac = chempotpy.pgd(self.system,self.modelname,geom)
93
+
94
+ # convert model units to ASE default units (eV and Ang)
95
+ if (self.multistate):
96
+ e = e[self.state] * self.E_to_eV
97
+ f = -f[self.state] * self.F_to_eV_Ang
98
+ else:
99
+ e = e * self.E_to_eV
100
+ f = -f * self.F_to_eV_Ang
101
+
102
+ self.results = {'energy': e, 'forces': f.reshape(-1, 3)}
103
+
104
+ def get_forces(self, atoms=None, force_consistent=False):
105
+ forces = self.get_property('forces', atoms)
106
+ return forces
107
+
108
+