mlatom 3.4.0b0__tar.gz → 3.6.0__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.
- {mlatom-3.4.0b0/src/mlatom.egg-info → mlatom-3.6.0}/PKG-INFO +3 -3
- {mlatom-3.4.0b0 → mlatom-3.6.0}/README.md +2 -2
- {mlatom-3.4.0b0 → mlatom-3.6.0}/setup.py +1 -1
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatom.py +2 -2
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLtasks.py +1 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/args_class.py +3 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/data.py +1 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/doc.py +3 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/header.py +12 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/initial_conditions.py +170 -2
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/__init__.py +4 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/gaussian_interface.py +6 -6
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/pyscf_interface.py +48 -2
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/torchani_interface.py +132 -1
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/md.py +7 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/md_cmd.py +77 -20
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/models.py +3 -2
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/ref.json +5 -1
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/simulations.py +1 -1
- {mlatom-3.4.0b0 → mlatom-3.6.0/src/mlatom.egg-info}/PKG-INFO +3 -3
- {mlatom-3.4.0b0 → mlatom-3.6.0}/LICENSE.txt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/setup.cfg +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLTPA.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/ML_NEA.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/A_KRR.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/A_KRR_kernel.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/D_CoulombMatrix.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/D_ID.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/D_rel2eq.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/MLatomF.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/MLatomFInfo.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/MLmodel.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/Makefile +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/Makefile.intel +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/__init__.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/analyze.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/constants.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/cs.cpp +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/dataset.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/mathUtils.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/molDescr.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/optionsModule.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/precision.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/recover.sh +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/sampling.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/statistics.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/stopper.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/strings.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/timing.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/MLatomF_src/types.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/__init__.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/__init__.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv0.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv1.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv2.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv3.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv4.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv5.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv6.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_cc_cv7.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv0.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv1.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv2.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv3.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv4.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv5.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv6.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/aiqm1_model/aiqm1_dft_cv7.pt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/ccsdtstarcbs.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/composite_methods.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/constants.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/conversions.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/cs.so +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/decorators.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/fortran/KREG.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/fortran/__init__.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/fortran/compile.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/fortran/mathUtils.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/fortran/stopper.f90 +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interface_MLatomF.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/ase_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/columbus_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/dftd4_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/dpmd_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/gap_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/mace_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/mndo_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/orca_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/physnet_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/sgdml_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/sparrow_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/turbomole_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/interfaces/xtb_interface.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/kreg_api.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/log.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/md2vibr.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/md2vibr_cmd.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/mlatom_gui.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/mltpa/__init__.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/mltpa/mff.txt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/mltpa/mltpa2022_2.pkl +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/mltpa/mltpa2022_2_new_.pkl +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/namd.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/plot.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/shell_cmd.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/sliceData.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/stats.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/stopper.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/thermostat.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/utils.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom/xyz.py +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom.egg-info/SOURCES.txt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom.egg-info/dependency_links.txt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom.egg-info/entry_points.txt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom.egg-info/requires.txt +0 -0
- {mlatom-3.4.0b0 → mlatom-3.6.0}/src/mlatom.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mlatom
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.6.0
|
|
4
4
|
Summary: A Package for Atomistic Simulations with Machine Learning
|
|
5
5
|
Home-page: http://mlatom.com
|
|
6
6
|
Author: Pavlo O. Dral
|
|
@@ -27,7 +27,7 @@ Requires-Dist: tqdm
|
|
|
27
27
|
# About Program
|
|
28
28
|
MLatom: a Package for Atomistic Simulations with Machine Learning
|
|
29
29
|
|
|
30
|
-
Version 3.
|
|
30
|
+
Version 3.6.0
|
|
31
31
|
|
|
32
32
|
**Official website**: http://mlatom.com/
|
|
33
33
|
**Manual**: http://mlatom.com/manual/
|
|
@@ -60,7 +60,7 @@ When this Software or its derivatives are used in scientific publications, it sh
|
|
|
60
60
|
* Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Mario Barbatti, Olexandr Isayev, Cheng Wang, Bao-Xin Xue, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Lina Zhang, Shuang Zhang, Arif Ullah, Quanhao Zhang, Yanchi Ou. [MLatom 3: A Platform for Machine Learning-enhanced Computational Chemistry Simulations and Workflows](https://doi.org/10.1021/acs.jctc.3c01203). *J. Chem. Theory Comput.* **2024**, *20*, 1193--1213.
|
|
61
61
|
* Pavlo O. Dral, Fuchun Ge, Bao-Xin Xue, Yi-Fan Hou, Max Pinheiro Jr, Jianxing Huang, Mario Barbatti. [MLatom 2: An Integrative Platform for Atomistic Machine Learning](http://doi.org/10.1007/s41061-021-00339-5). *Top. Curr. Chem.* **2021**, *379*, 27.
|
|
62
62
|
* Pavlo O. Dral. [MLatom: A Program Package for Quantum Chemical Research Assisted by Machine Learning](http://dx.doi.org/10.1002/jcc.26004). *J. Comput. Chem.* **2019**, *40*, 2339--2347.
|
|
63
|
-
* Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.
|
|
63
|
+
* Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.6.0, Xiamen University, Xiamen, China, 2013-2024.
|
|
64
64
|
[MLatom.com](http://mlatom.com).
|
|
65
65
|
|
|
66
66
|
The citations for MLatom's interfaces and features shall be eventually
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# About Program
|
|
2
2
|
MLatom: a Package for Atomistic Simulations with Machine Learning
|
|
3
3
|
|
|
4
|
-
Version 3.
|
|
4
|
+
Version 3.6.0
|
|
5
5
|
|
|
6
6
|
**Official website**: http://mlatom.com/
|
|
7
7
|
**Manual**: http://mlatom.com/manual/
|
|
@@ -34,7 +34,7 @@ When this Software or its derivatives are used in scientific publications, it sh
|
|
|
34
34
|
* Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Mario Barbatti, Olexandr Isayev, Cheng Wang, Bao-Xin Xue, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Lina Zhang, Shuang Zhang, Arif Ullah, Quanhao Zhang, Yanchi Ou. [MLatom 3: A Platform for Machine Learning-enhanced Computational Chemistry Simulations and Workflows](https://doi.org/10.1021/acs.jctc.3c01203). *J. Chem. Theory Comput.* **2024**, *20*, 1193--1213.
|
|
35
35
|
* Pavlo O. Dral, Fuchun Ge, Bao-Xin Xue, Yi-Fan Hou, Max Pinheiro Jr, Jianxing Huang, Mario Barbatti. [MLatom 2: An Integrative Platform for Atomistic Machine Learning](http://doi.org/10.1007/s41061-021-00339-5). *Top. Curr. Chem.* **2021**, *379*, 27.
|
|
36
36
|
* Pavlo O. Dral. [MLatom: A Program Package for Quantum Chemical Research Assisted by Machine Learning](http://dx.doi.org/10.1002/jcc.26004). *J. Comput. Chem.* **2019**, *40*, 2339--2347.
|
|
37
|
-
* Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.
|
|
37
|
+
* Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.6.0, Xiamen University, Xiamen, China, 2013-2024.
|
|
38
38
|
[MLatom.com](http://mlatom.com).
|
|
39
39
|
|
|
40
40
|
The citations for MLatom's interfaces and features shall be eventually
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
!---------------------------------------------------------------------------!
|
|
5
5
|
! !
|
|
6
6
|
! MLatom: a Package for Atomistic Simulations with Machine Learning !
|
|
7
|
-
! MLatom 3.
|
|
7
|
+
! MLatom 3.6.0 !
|
|
8
8
|
! @ !
|
|
9
9
|
! Xiamen Atomistic Computing Suite (XACS) !
|
|
10
10
|
! !
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
! Xue, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, !
|
|
37
37
|
! Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, !
|
|
38
38
|
! MLatom: A Package for Atomistic Simulations with Machine Learning, !
|
|
39
|
-
! version 3.
|
|
39
|
+
! version 3.6.0, Xiamen University, Xiamen, China, 2013-2024. !
|
|
40
40
|
! !
|
|
41
41
|
! The citations for MLatom's interfaces and features shall be eventually !
|
|
42
42
|
! included too. See header.py, ref.json and http://mlatom.com. !
|
|
@@ -447,6 +447,7 @@ def freq(args):
|
|
|
447
447
|
geomopt = simulations.thermochemistry(model=model,
|
|
448
448
|
molecule=mol,
|
|
449
449
|
**kwargs)
|
|
450
|
+
mol.dump(f'freq{mol.number}.json',format='json')
|
|
450
451
|
print(' %s ' % ('='*78))
|
|
451
452
|
print(' %s Vibration analysis for molecule %6d' % (' '*20, imol+1))
|
|
452
453
|
print(' %s ' % ('='*78))
|
|
@@ -462,6 +462,9 @@ class mlatom_args(ArgsBase):
|
|
|
462
462
|
self.set_keyword_alias('ANI-2x', ['ani2x'])
|
|
463
463
|
self.set_keyword_alias('ANI-1x-D4', ['ani1xd4'])
|
|
464
464
|
self.set_keyword_alias('ANI-2x-D4', ['ani2xd4'])
|
|
465
|
+
self.set_keyword_alias('ANI-1xnr', ['ani1xnr'])
|
|
466
|
+
self.set_keyword_alias('AIMNet2@B973c', ['aimnet2atb973c'])
|
|
467
|
+
self.set_keyword_alias('AIMNet2@wb97M-D3', ['aimnet2atwb97md3'])
|
|
465
468
|
self.set_keyword_alias('GFN2-xTB', ['gfn2xtb'])
|
|
466
469
|
self.set_keyword_alias('MNDO/dH', ['mndodh'])
|
|
467
470
|
self.set_keyword_alias('MNDO/H', ['mndoh'])
|
|
@@ -1486,6 +1486,7 @@ class molecular_trajectory():
|
|
|
1486
1486
|
moldb.write_file_with_properties(filename+'.ekin',property_to_write='kinetic_energy')
|
|
1487
1487
|
moldb.write_file_with_properties(filename+'.epot',property_to_write='energy')
|
|
1488
1488
|
moldb.write_file_with_properties(filename+'.etot',property_to_write='total_energy')
|
|
1489
|
+
moldb.write_file_with_properties(filename+'.temp',property_to_write='temperature')
|
|
1489
1490
|
if 'dipole_moment' in moldb.molecules[0].__dict__.keys():
|
|
1490
1491
|
with open(filename+'.dp','w') as dpf:
|
|
1491
1492
|
for imolecule in moldb.molecules:
|
|
@@ -179,6 +179,9 @@ class Doc():
|
|
|
179
179
|
ANI-2x perform ANI-2x calculations
|
|
180
180
|
ANI-1x-D4 perform ANI-1x-D4 calculations
|
|
181
181
|
ANI-2x-D4 perform ANI-2x-D4 calculations
|
|
182
|
+
ANI-1xnr perform ANI-1xnr calculations
|
|
183
|
+
AIMNet2@B973c perform AIMNet2@B97-3c calculations
|
|
184
|
+
AIMNet2@wB97M-D3 perform AIMNet2@wB97M-D3 calculations
|
|
182
185
|
ODM2
|
|
183
186
|
ODM2*
|
|
184
187
|
GFN2-xTB
|
|
@@ -128,6 +128,18 @@ def printHeader(args):
|
|
|
128
128
|
if args.ani2xd4:
|
|
129
129
|
refItems['D4'] = refs['D4']
|
|
130
130
|
refItems['D4 program'] = refs['D4prog']
|
|
131
|
+
|
|
132
|
+
if args.method:
|
|
133
|
+
if 'DM21' in args.method.upper():
|
|
134
|
+
refItems['DM21'] = refs['DM21']
|
|
135
|
+
|
|
136
|
+
if args.ani1xnr:
|
|
137
|
+
refItems['ANI-1xnr'] = refs['ANI-1xnr']
|
|
138
|
+
if args.aimnet2atb973c:
|
|
139
|
+
refItems['AIMNet2@B973c'] = refs['AIMNet2']
|
|
140
|
+
if args.aimnet2atwb97md3:
|
|
141
|
+
refItems['AIMNet2@wb97M-D3'] = refs['AIMNet2']
|
|
142
|
+
|
|
131
143
|
|
|
132
144
|
if args.geomopt:
|
|
133
145
|
if 'optprog=ase' in ' '.join(args.args2pass).lower():
|
|
@@ -202,7 +202,7 @@ def generate_initial_conditions(molecule=None, generation_method=None, number_of
|
|
|
202
202
|
mass = mass_.reshape(Natoms,1)
|
|
203
203
|
total_mass = np.sum(mass_)
|
|
204
204
|
for irepeat in range(number_of_initial_conditions):
|
|
205
|
-
if eliminate_angular_momentum:
|
|
205
|
+
if eliminate_angular_momentum and not molecule.is_it_linear():
|
|
206
206
|
velocities_all[irepeat] = getridofang(coordinates_all[irepeat],velocities_all[irepeat],mass_)
|
|
207
207
|
v_cm = sum(velocities_all[irepeat]*mass)/total_mass
|
|
208
208
|
velocities_all[irepeat] -= v_cm
|
|
@@ -212,7 +212,9 @@ def generate_initial_conditions(molecule=None, generation_method=None, number_of
|
|
|
212
212
|
new_molecule.atoms[iatom].xyz_coordinates = coordinates_all[irepeat][iatom]
|
|
213
213
|
new_molecule.atoms[iatom].xyz_velocities = velocities_all[irepeat][iatom]
|
|
214
214
|
init_cond_db.molecules.append(new_molecule)
|
|
215
|
-
|
|
215
|
+
elif generation_method.casefold() == 'harmonic-quantum-boltzmann'.casefold():
|
|
216
|
+
init_cond_db = harmonic_quantum_Boltzmann_sampling.sample(npoints=number_of_initial_conditions,molecule=molecule,temperature=initial_temperature,use_hessian=use_hessian)
|
|
217
|
+
|
|
216
218
|
if filter_by_energy_window:
|
|
217
219
|
if iteration == 1:
|
|
218
220
|
result = excitation_energy_window_filter(init_cond_db,**window_filter_kwargs)
|
|
@@ -247,6 +249,10 @@ def generate_initial_conditions(molecule=None, generation_method=None, number_of
|
|
|
247
249
|
if len(init_cond_db) > target_number_of_initial_conditions:
|
|
248
250
|
init_cond_db = init_cond_db[:target_number_of_initial_conditions]
|
|
249
251
|
|
|
252
|
+
# Change the random seed so that the user-defined one only affects initial conditions sampling
|
|
253
|
+
if not random_seed is None:
|
|
254
|
+
np.random.seed()
|
|
255
|
+
|
|
250
256
|
return init_cond_db
|
|
251
257
|
|
|
252
258
|
def read_velocities_from_file(filename):
|
|
@@ -573,6 +579,168 @@ class wigner_sampling():
|
|
|
573
579
|
q[iatom][icoord] += cn[i][iatom][icoord]*cint[i]*fac
|
|
574
580
|
v[iatom][icoord] += cn[i][iatom][icoord]*dcint[i]*fac
|
|
575
581
|
return q,v # Unit: a.u.
|
|
582
|
+
|
|
583
|
+
class harmonic_quantum_Boltzmann_sampling():
|
|
584
|
+
#
|
|
585
|
+
# The harmonic quantum Boltzmann sampling in this class follows what is shown in the following paper (it is called thermal sampling in VENUS manual):
|
|
586
|
+
# J. Phys. Chem. A 1998, 102, 3648-3658
|
|
587
|
+
#
|
|
588
|
+
# The quanta ni of each normal mode is first sampled from the harmonic quantum Boltzman distribution function:
|
|
589
|
+
#
|
|
590
|
+
# p(ni) = exp(-ni * h * vi / kB / T) * (1 - (exp(-h * vi / kB / T)))
|
|
591
|
+
#
|
|
592
|
+
# where vi is the frequency of normal mode i, h is the Planck constant, kB is the Boltzmann constant and T is the temperature
|
|
593
|
+
#
|
|
594
|
+
# The energy of normal mode i is calculated as Ei = (ni + 0.5) * h * vi
|
|
595
|
+
#
|
|
596
|
+
# The mass weighted normal mode coordinates Qi and momenta Pi are
|
|
597
|
+
#
|
|
598
|
+
# Qi = Ai * cos(2 * pi * Ri)
|
|
599
|
+
# Pi = -Ai * wi * sin(2 * pi * Ri)
|
|
600
|
+
#
|
|
601
|
+
# where wi = 2 * pi * vi, Ai = sqrt(2 * Ei) / wi and Ri is a uniform random number on [0,1]
|
|
602
|
+
#
|
|
603
|
+
# The mass weighted momentum Prc of reaction coordinate is chosed from a thermal distribution
|
|
604
|
+
#
|
|
605
|
+
# Prc = ± sqrt(-2 * kB * T * ln(1 - R))
|
|
606
|
+
#
|
|
607
|
+
# where R is a uniform random number on [0,1]
|
|
608
|
+
#
|
|
609
|
+
|
|
610
|
+
def __init__(self):
|
|
611
|
+
pass
|
|
612
|
+
|
|
613
|
+
@classmethod
|
|
614
|
+
def sample(cls,npoints,molecule,temperature,use_hessian):
|
|
615
|
+
if not use_hessian:
|
|
616
|
+
if not ('frequencies' in molecule.__dict__ and 'normal_modes' in molecule[0].__dict__):
|
|
617
|
+
print('Frequencies and normal modes not found, try to calculate them from Hessian matrix')
|
|
618
|
+
if not 'hessian' in molecule.__dict__.keys():
|
|
619
|
+
stopper.stopMLatom('Hessian matrix not found -- cannot do wigner sampling')
|
|
620
|
+
simulations.freq.freq_modified_from_TorchANI(molecule=molecule,normal_mode_normalization='mass deweighted normalized')
|
|
621
|
+
else:
|
|
622
|
+
if not 'hessian' in molecule.__dict__.keys():
|
|
623
|
+
stopper.stopMLatom('Hessian matrix not found -- cannot do wigner sampling')
|
|
624
|
+
simulations.freq.freq_modified_from_TorchANI(molecule=molecule,normal_mode_normalization='mass deweighted normalized')
|
|
625
|
+
freq = molecule.frequencies
|
|
626
|
+
nm_masses = molecule.reduced_masses
|
|
627
|
+
Natoms = len(molecule)
|
|
628
|
+
|
|
629
|
+
nnegative = 0
|
|
630
|
+
while freq[nnegative] < 0:
|
|
631
|
+
nnegative += 1
|
|
632
|
+
# freq = freq[nnegative:]
|
|
633
|
+
nm = np.zeros((len(freq),Natoms,3))
|
|
634
|
+
|
|
635
|
+
for imode in range(len(freq)):
|
|
636
|
+
for iatom in range(Natoms):
|
|
637
|
+
nm[imode][iatom] = molecule[iatom].normal_modes[imode]
|
|
638
|
+
nm[imode] /= np.sqrt(np.sum(nm[imode]**2))
|
|
639
|
+
|
|
640
|
+
q_list = np.array([molecule.xyz_coordinates]*npoints)
|
|
641
|
+
v_list = np.zeros((npoints,Natoms,3))
|
|
642
|
+
|
|
643
|
+
for imode in range(nnegative,len(freq)):
|
|
644
|
+
qq,vv = cls.get_vq(temperature,freq[imode],nm_masses[imode],npoints)
|
|
645
|
+
for isample in range(npoints):
|
|
646
|
+
# print(isample)
|
|
647
|
+
q_list[isample] += nm[imode]*qq[isample]
|
|
648
|
+
# print(nm[imode]*vv[isample])
|
|
649
|
+
v_list[isample] += nm[imode]*vv[isample]
|
|
650
|
+
|
|
651
|
+
# Deal with reaction coordinate
|
|
652
|
+
for ii in range(nnegative):
|
|
653
|
+
for isample in range(npoints):
|
|
654
|
+
scale = np.random.choice([-1,1])*np.sqrt(-2*constants.kB_in_Hartree*temperature*np.log(1-np.random.random())) / np.sqrt(nm_masses[ii] * constants.ram2au)/ constants.au2fs * constants.Bohr2Angstrom
|
|
655
|
+
v_list[isample] += scale * nm[ii]
|
|
656
|
+
|
|
657
|
+
init_cond_db = data.molecular_database()
|
|
658
|
+
for isample in range(npoints):
|
|
659
|
+
new_molecule = molecule.copy(atomic_labels=[],molecular_labels=[])
|
|
660
|
+
for iatom in range(Natoms):
|
|
661
|
+
new_molecule.atoms[iatom].xyz_coordinates = q_list[isample][iatom]
|
|
662
|
+
new_molecule.atoms[iatom].xyz_velocities = v_list[isample][iatom]
|
|
663
|
+
init_cond_db.molecules.append(new_molecule)
|
|
664
|
+
|
|
665
|
+
return init_cond_db
|
|
666
|
+
|
|
667
|
+
@classmethod
|
|
668
|
+
def sample_quanta(cls,temperature,freq,nsample):
|
|
669
|
+
hvkT = constants.planck_constant*freq*constants.speed_of_light*100/constants.kB/temperature
|
|
670
|
+
|
|
671
|
+
nn_len = 100
|
|
672
|
+
nn = np.array([ii for ii in range(nn_len)])
|
|
673
|
+
pp = np.array([np.exp(-ii*hvkT)*(1-np.exp(-hvkT)) for ii in nn])
|
|
674
|
+
while 1.0-np.sum(pp) > 1e-10:
|
|
675
|
+
nn_len += 50
|
|
676
|
+
nn = np.array([ii for ii in range(nn_len)])
|
|
677
|
+
pp = np.array([np.exp(-ii*hvkT)*(1-np.exp(-hvkT)) for ii in nn])
|
|
678
|
+
rand = np.random.choice(nn,size=nsample,p=pp)
|
|
679
|
+
return rand
|
|
680
|
+
|
|
681
|
+
@classmethod
|
|
682
|
+
def get_energy(cls,rand,freq):
|
|
683
|
+
return (rand+0.5)*constants.planck_constant*freq*constants.speed_of_light*100/1000*constants.Avogadro_constant*constants.kJpermol2Hartree # Hartree
|
|
684
|
+
|
|
685
|
+
@classmethod
|
|
686
|
+
def get_vq(cls,temperature,freq,mass,nsample):
|
|
687
|
+
energy = cls.get_energy(cls.sample_quanta(temperature,freq,nsample),freq)
|
|
688
|
+
rand = np.random.random(len(energy))
|
|
689
|
+
omega = freq * constants.speed_of_light*100*2*np.pi / 1.0E15 / constants.fs2au # au
|
|
690
|
+
AA = np.sqrt(2*energy)/omega # au
|
|
691
|
+
qq = AA * np.cos(2*np.pi*rand) / np.sqrt(mass*constants.ram2au) * constants.Bohr2Angstrom # Angstrom
|
|
692
|
+
vv = -omega * AA * np.sin(2*np.pi*rand) / np.sqrt(mass*constants.ram2au) * constants.Bohr2Angstrom / constants.au2fs # Angstrom/fs
|
|
693
|
+
return qq,vv
|
|
694
|
+
|
|
695
|
+
# def wignersample(npoints,molecule):
|
|
696
|
+
# qlist = []
|
|
697
|
+
# vlist = []
|
|
698
|
+
# geomEq = np.array([each.xyz_coordinates for each in molecule.atoms])
|
|
699
|
+
# mass = molecule.get_nuclear_masses()
|
|
700
|
+
# mass = mass.reshape(1,len(mass))
|
|
701
|
+
# # Calculate normal modes from Hessian matrix
|
|
702
|
+
# #nm,freq,ele,linear_int = readGaussianNM(nmfile)
|
|
703
|
+
# if not 'hessian' in molecule.__dict__.keys():
|
|
704
|
+
# stopper.stopMLatom('Hessian matrix not found -- cannot do wigner sampling')
|
|
705
|
+
|
|
706
|
+
# linear = molecule.is_it_linear()
|
|
707
|
+
# Natoms = len(molecule.atoms)
|
|
708
|
+
# if linear:
|
|
709
|
+
# ntriv = 5
|
|
710
|
+
# linear_int = 1
|
|
711
|
+
# else:
|
|
712
|
+
# ntriv = 6
|
|
713
|
+
# linear_int = 0
|
|
714
|
+
|
|
715
|
+
# # freq,nm,_,_ = vibrational_analysis(mass,molecule.hessian,mode_type='MDU')
|
|
716
|
+
# simulations.freq.freq_modified_from_TorchANI(molecule=molecule,normal_mode_normalization='mass deweighted unnormalized')
|
|
717
|
+
# freq = molecule.frequencies
|
|
718
|
+
# nm = np.zeros(3*Natoms,Natoms,3)
|
|
719
|
+
# for itriv in range(ntriv):
|
|
720
|
+
# nm[itriv] = 1.0 / np.sqrt(3*Natoms)
|
|
721
|
+
# for imode in range(ntriv,3*Natoms):
|
|
722
|
+
# for iatom in range(Natoms):
|
|
723
|
+
# nm[ntriv+imode][iatom] = molecule[iatom].normal_modes[imode]
|
|
724
|
+
|
|
725
|
+
# numcoo = len(freq)
|
|
726
|
+
# #print(len(nm),len(freq),len(ele),linear)
|
|
727
|
+
# atom_mass = [each.nuclear_mass for each in molecule.atoms]
|
|
728
|
+
# cart_nms, w_nmode = nm2cart(nm,atom_mass)
|
|
729
|
+
|
|
730
|
+
# geomEq_au = np.array(geomEq) / constants.Bohr2Angstrom
|
|
731
|
+
|
|
732
|
+
# anq, amp, freq_au, atmau = rdmol(atom_mass,linear_int,freq)
|
|
733
|
+
|
|
734
|
+
# for ipoint in range(npoints):
|
|
735
|
+
# q,v = inqp(geomEq_au,w_nmode[ntriv:],freq_au,anq,amp,numcoo,atmau)
|
|
736
|
+
# qlist.append(q)
|
|
737
|
+
# vlist.append(v)
|
|
738
|
+
|
|
739
|
+
# # Transform from a.u. to Angstrom & fs
|
|
740
|
+
# qlist = np.array(qlist) * constants.Bohr2Angstrom
|
|
741
|
+
# vlist = np.array(vlist) * constants.Bohr2Angstrom / constants.au2fs
|
|
742
|
+
|
|
743
|
+
# return qlist, vlist, linear_int
|
|
576
744
|
|
|
577
745
|
# generate random velocities without angular momentum for linear molecule
|
|
578
746
|
def generate_random_velocities_for_linear_molecule(molecule):
|
|
@@ -10,6 +10,10 @@ def ani(**kwargs):
|
|
|
10
10
|
from .torchani_interface import ani_methods as interface
|
|
11
11
|
return interface(**kwargs)
|
|
12
12
|
|
|
13
|
+
def aimnet2(**kwargs):
|
|
14
|
+
from .torchani_interface import aimnet2_methods as interface
|
|
15
|
+
return interface(**kwargs)
|
|
16
|
+
|
|
13
17
|
def mndo(**kwargs):
|
|
14
18
|
from .mndo_interface import mndo_methods as interface
|
|
15
19
|
return interface(**kwargs)
|
|
@@ -186,13 +186,18 @@ def run_gaussian_job(**kwargs):
|
|
|
186
186
|
memory = f"%mem={kwargs['memory']}\n"
|
|
187
187
|
gaussian_keywords = f'{memory}%nproc={nthreads}\n' + gaussian_keywords
|
|
188
188
|
|
|
189
|
+
if 'cwd' in kwargs:
|
|
190
|
+
cwd = kwargs['cwd']
|
|
191
|
+
else:
|
|
192
|
+
cwd='.'
|
|
193
|
+
|
|
189
194
|
if 'model_predict_kwargs' in kwargs:
|
|
190
195
|
model_predict_kwargs_str = str(kwargs['model_predict_kwargs'])
|
|
191
196
|
else:
|
|
192
197
|
model_predict_kwargs_str = "{}"
|
|
193
198
|
|
|
194
199
|
model_predict_kwargs_str_file = 'model_predict_kwargs'
|
|
195
|
-
with open(model_predict_kwargs_str_file, 'w') as f:
|
|
200
|
+
with open(os.path.join(cwd, model_predict_kwargs_str_file), 'w') as f:
|
|
196
201
|
f.write(model_predict_kwargs_str)
|
|
197
202
|
|
|
198
203
|
if 'external_task' in kwargs:
|
|
@@ -227,11 +232,6 @@ def run_gaussian_job(**kwargs):
|
|
|
227
232
|
kwargs['method'] = 'p ' + kwargs['method']
|
|
228
233
|
gaussian_keywords += '# '+kwargs['method']+'\n'
|
|
229
234
|
|
|
230
|
-
if 'cwd' in kwargs:
|
|
231
|
-
cwd = kwargs['cwd']
|
|
232
|
-
else:
|
|
233
|
-
cwd='.'
|
|
234
|
-
|
|
235
235
|
if 'writechk' in kwargs:
|
|
236
236
|
writechk = kwargs['writechk']
|
|
237
237
|
else:
|
|
@@ -72,6 +72,10 @@ class pyscf_methods(OMP_pyscf):
|
|
|
72
72
|
pyscf_mol.unit = 'Ang'
|
|
73
73
|
pyscf_mol.build()
|
|
74
74
|
|
|
75
|
+
# DM21
|
|
76
|
+
if 'DM21' in self.method.upper():
|
|
77
|
+
self.predict_for_molecule_DM21(molecule=molecule, pyscf_mol=pyscf_mol, calculate_energy=calculate_energy, calculate_energy_gradients=calculate_energy_gradients, calculate_hessian=calculate_hessian, **kwargs)
|
|
78
|
+
return
|
|
75
79
|
|
|
76
80
|
# HF
|
|
77
81
|
if 'HF' == self.method.upper():
|
|
@@ -193,8 +197,50 @@ class pyscf_methods(OMP_pyscf):
|
|
|
193
197
|
h[ii*3:(ii+1)*3, jj*3:(jj+1)*3] = hess[ii][jj]
|
|
194
198
|
molecule.hessian = h / constants.Bohr2Angstrom**2
|
|
195
199
|
|
|
196
|
-
|
|
197
|
-
|
|
200
|
+
def predict_for_molecule_DM21(self, molecule=None, pyscf_mol=None, calculate_energy=True, calculate_energy_gradients=False, calculate_hessian=False, **kwargs):
|
|
201
|
+
# reference: https://github.com/google-deepmind/deepmind-research/tree/f5de0ede8430809180254ee957abf36ed62579ef/density_functional_approximation_dm21
|
|
202
|
+
# METHODS AVAILABE:
|
|
203
|
+
# DM21 - trained on molecules dataset, and fractional charge, and fractional spin constraints.
|
|
204
|
+
# DM21m - trained on molecules dataset.
|
|
205
|
+
# DM21mc - trained on molecules dataset, and fractional charge constraints.
|
|
206
|
+
# DM21mu - trained on molecules dataset, and electron gas constraints.
|
|
207
|
+
|
|
208
|
+
from pyscf import dft
|
|
209
|
+
try:
|
|
210
|
+
import density_functional_approximation_dm21 as dm21
|
|
211
|
+
except:
|
|
212
|
+
errmsg = 'Please install required packages for DM21. For more details, please refer to https://github.com/google-deepmind/deepmind-research/tree/master/density_functional_approximation_dm21.'
|
|
213
|
+
raise ModuleNotFoundError(errmsg)
|
|
214
|
+
|
|
215
|
+
if pyscf_mol.spin == 0:
|
|
216
|
+
pyscf_method = dft.RKS(pyscf_mol)
|
|
217
|
+
else:
|
|
218
|
+
pyscf_method = dft.UKS(pyscf_mol)
|
|
219
|
+
|
|
220
|
+
pyscf_method.xc = 'B3LYP'
|
|
221
|
+
pyscf_method.run()
|
|
222
|
+
dm0 = pyscf_method.make_rdm1()
|
|
223
|
+
pyscf_method._numint = dm21.NeuralNumInt(dm21.Functional.__dict__[self.method])
|
|
224
|
+
# relax convergence tolerances to increase success to convergence
|
|
225
|
+
pyscf_method.conv_tol = 1E-6
|
|
226
|
+
pyscf_method.conv_tol_grad = 1E-3
|
|
227
|
+
try:
|
|
228
|
+
pyscf_method.kernel(dm0=dm0)
|
|
229
|
+
except:
|
|
230
|
+
errmsg = 'DM21 cannot converge properly'
|
|
231
|
+
stopper.stopMLatom(errmsg)
|
|
232
|
+
|
|
233
|
+
if calculate_energy:
|
|
234
|
+
molecule.energy = pyscf_method.e_tot
|
|
235
|
+
|
|
236
|
+
if calculate_energy_gradients:
|
|
237
|
+
errmsg = 'DM21 by pyscf does not support gradients calculation'
|
|
238
|
+
raise ValueError(errmsg)
|
|
239
|
+
|
|
240
|
+
if calculate_hessian:
|
|
241
|
+
errmsg = 'DM21 by pyscf does not support hessian calculation'
|
|
242
|
+
raise ValueError(errmsg)
|
|
243
|
+
|
|
198
244
|
@doc_inherit
|
|
199
245
|
def predict(self, molecule=None, molecular_database=None, calculate_energy=True, calculate_energy_gradients=False, calculate_hessian=False, **kwargs):
|
|
200
246
|
'''
|
|
@@ -15,8 +15,11 @@ import numpy as np
|
|
|
15
15
|
import tqdm
|
|
16
16
|
from collections import OrderedDict
|
|
17
17
|
import torch
|
|
18
|
+
from torch import nn, Tensor
|
|
18
19
|
import torchani
|
|
19
20
|
from torchani.data import TransformableIterable, IterableAdapter
|
|
21
|
+
from typing import Dict, List
|
|
22
|
+
|
|
20
23
|
|
|
21
24
|
from .. import data
|
|
22
25
|
from .. import models
|
|
@@ -649,7 +652,9 @@ class ani_methods(models.torchani_model):
|
|
|
649
652
|
|
|
650
653
|
def model_setup(self, method):
|
|
651
654
|
self.method = method
|
|
652
|
-
if 'ANI-
|
|
655
|
+
if 'ANI-1xnr'.casefold() in method.casefold():
|
|
656
|
+
self.model = load_ani1xnr_model()
|
|
657
|
+
elif 'ANI-1x'.casefold() in method.casefold():
|
|
653
658
|
self.model = torchani.models.ANI1x(periodic_table_index=True).to(self.device).double()
|
|
654
659
|
elif 'ANI-1ccx'.casefold() in method.casefold():
|
|
655
660
|
self.model = torchani.models.ANI1ccx(periodic_table_index=True).to(self.device).double()
|
|
@@ -726,6 +731,132 @@ class ani_methods(models.torchani_model):
|
|
|
726
731
|
modelname = self.method.lower().replace('-','')
|
|
727
732
|
molecule.__dict__[f'{modelname}'].standard_deviation(properties=properties+atomic_properties)
|
|
728
733
|
|
|
734
|
+
def load_ani1xnr_model():
|
|
735
|
+
# ANI-1xnr https://github.com/atomistic-ml/ani-1xnr/
|
|
736
|
+
# Universal reactive ML potential ANI-1xnr: https://doi.org/10.1038/s41557-023-01427-3
|
|
737
|
+
species = ['H', 'C', 'N', 'O']
|
|
738
|
+
def parse_ani1xnr_resources():
|
|
739
|
+
import requests
|
|
740
|
+
import zipfile
|
|
741
|
+
import io
|
|
742
|
+
local_dir = os.path.expanduser('~/.local/ANI1xnr/')
|
|
743
|
+
url = "https://github.com/atomistic-ml/ani-1xnr/archive/refs/heads/main.zip"
|
|
744
|
+
if not os.path.exists(local_dir+'ani-1xnr-main'):
|
|
745
|
+
os.makedirs(local_dir, exist_ok=True)
|
|
746
|
+
print(f'Downloading ANI-1xnr model parameters ...')
|
|
747
|
+
resource_res = requests.get(url)
|
|
748
|
+
resource_zip = zipfile.ZipFile(io.BytesIO(resource_res.content))
|
|
749
|
+
resource_zip.extractall(local_dir)
|
|
750
|
+
return local_dir
|
|
751
|
+
model_prefix = parse_ani1xnr_resources() + 'ani-1xnr-main/model/ani-1xnr/'
|
|
752
|
+
# const_file, sae_file, ensemble_prefix, ensemble_size = parse_ani1xnr_resources()
|
|
753
|
+
const_file = model_prefix + 'rHCNO-5.2R_32-3.5A_a8-4.params'
|
|
754
|
+
sae_file = model_prefix + 'sae_linfit.dat'
|
|
755
|
+
consts = torchani.neurochem.Constants(const_file)
|
|
756
|
+
aev_computer = torchani.AEVComputer(**consts)
|
|
757
|
+
energy_shifter = torchani.neurochem.load_sae(sae_file)
|
|
758
|
+
species_converter = torchani.nn.SpeciesConverter(species)
|
|
759
|
+
|
|
760
|
+
neural_networks = []
|
|
761
|
+
for ii in range(8):
|
|
762
|
+
neural_network = torchani.neurochem.load_model(consts.species, model_prefix + f'train{ii}/networks')
|
|
763
|
+
neural_networks.append(torchani.nn.Sequential(species_converter, aev_computer, neural_network, energy_shifter))
|
|
764
|
+
|
|
765
|
+
model_ensemble = torchani.nn.Ensemble(modules=neural_networks)
|
|
766
|
+
model_ensemble.species = species
|
|
767
|
+
|
|
768
|
+
return model_ensemble
|
|
769
|
+
|
|
770
|
+
class aimnet2_methods(models.torchani_model):
|
|
771
|
+
'''
|
|
772
|
+
Universal ML methods with AIMNet2: https://doi.org/10.26434/chemrxiv-2023-296ch
|
|
773
|
+
|
|
774
|
+
Arguments:
|
|
775
|
+
method (str): A string that specifies the method. Available choices: ``'AIMNet2@b973c'`` and ``'AIMNet2@wb97m-d3'``.
|
|
776
|
+
device (str, optional): Indicate which device the calculation will be run on, i.e. 'cpu' for CPU, 'cuda' for Nvidia GPUs. When not speficied, it will try to use CUDA if there exists valid ``CUDA_VISIBLE_DEVICES`` in the environ of system.
|
|
777
|
+
|
|
778
|
+
'''
|
|
779
|
+
|
|
780
|
+
available_methods = models.methods.methods_map['aimnet2']
|
|
781
|
+
element_symbols_available = ['H', 'B', 'C', 'N', 'O', 'F', 'Si', 'P', 'S', 'Cl', 'As', 'Se', 'Br', 'I']
|
|
782
|
+
|
|
783
|
+
def __init__(self, method: str = 'AIMNet2@b973c', device: str = 'cuda' if torch.cuda.is_available() else 'cpu', **kwargs):
|
|
784
|
+
self.device = torch.device(device)
|
|
785
|
+
self.model_path = self.parse_aimnet2_resources(method)
|
|
786
|
+
self.model = torch.jit.load(self.model_path)
|
|
787
|
+
|
|
788
|
+
@doc_inherit
|
|
789
|
+
def predict(
|
|
790
|
+
self,
|
|
791
|
+
molecular_database: data.molecular_database = None,
|
|
792
|
+
molecule: data.molecule = None,
|
|
793
|
+
calculate_energy: bool = False,
|
|
794
|
+
calculate_energy_gradients: bool = False,
|
|
795
|
+
calculate_hessian: bool = False,
|
|
796
|
+
batch_size: int = 2**16,
|
|
797
|
+
) -> None:
|
|
798
|
+
|
|
799
|
+
molDB = super().predict(molecular_database=molecular_database, molecule=molecule)
|
|
800
|
+
|
|
801
|
+
for element_symbol in np.unique(np.concatenate(molDB.element_symbols)):
|
|
802
|
+
if element_symbol not in self.element_symbols_available:
|
|
803
|
+
print(f' * Warning * Molecule contains elements \'{element_symbol}\', which is not supported by method \'{self.method}\' that only supports {self.element_symbols_available}, no calculations performed')
|
|
804
|
+
return
|
|
805
|
+
|
|
806
|
+
for mol in molDB:
|
|
807
|
+
self.predict_for_molecule(
|
|
808
|
+
molecule=mol,
|
|
809
|
+
calculate_energy=calculate_energy,
|
|
810
|
+
calculate_energy_gradients=calculate_energy_gradients,
|
|
811
|
+
calculate_hessian=calculate_hessian)
|
|
812
|
+
|
|
813
|
+
def predict_for_molecule(
|
|
814
|
+
self,
|
|
815
|
+
molecule,
|
|
816
|
+
calculate_energy: bool = False,
|
|
817
|
+
calculate_energy_gradients: bool = False,
|
|
818
|
+
calculate_hessian: bool = False):
|
|
819
|
+
|
|
820
|
+
coord = torch.as_tensor(molecule.xyz_coordinates).to(torch.float).to(self.device).unsqueeze(0)
|
|
821
|
+
numbers = torch.as_tensor(molecule.atomic_numbers).to(torch.long).to(self.device).unsqueeze(0)
|
|
822
|
+
charge = torch.tensor([molecule.charge], dtype=torch.float, device=self.device)
|
|
823
|
+
nninput = dict(coord=coord, numbers=numbers, charge=charge)
|
|
824
|
+
prev = torch.is_grad_enabled()
|
|
825
|
+
torch._C._set_grad_enabled(calculate_energy_gradients)
|
|
826
|
+
if calculate_energy_gradients:
|
|
827
|
+
nninput['coord'].requires_grad_(True)
|
|
828
|
+
nnoutput = self.model(nninput)
|
|
829
|
+
if calculate_energy:
|
|
830
|
+
molecule.energy = nnoutput['energy'].item()
|
|
831
|
+
if calculate_energy_gradients:
|
|
832
|
+
if 'forces' in nnoutput:
|
|
833
|
+
f = nnoutput['forces'][0]
|
|
834
|
+
else:
|
|
835
|
+
f = - torch.autograd.grad(nnoutput['energy'], nninput['coord'])[0][0]
|
|
836
|
+
forces = f.detach().cpu().numpy()
|
|
837
|
+
molecule.add_xyz_vectorial_property(forces, 'energy_gradients')
|
|
838
|
+
|
|
839
|
+
if calculate_hessian:
|
|
840
|
+
print('Hessian not available yet')
|
|
841
|
+
molecule.hessian = np.zeros((len(molecule),)*2)
|
|
842
|
+
|
|
843
|
+
torch._C._set_grad_enabled(prev)
|
|
844
|
+
|
|
845
|
+
@staticmethod
|
|
846
|
+
def parse_aimnet2_resources(method):
|
|
847
|
+
import requests
|
|
848
|
+
local_dir = os.path.expanduser('~/.local/AIMNet2/')
|
|
849
|
+
repo_name = "AIMNet2"
|
|
850
|
+
tag_name = method.lower().replace('@', '_')
|
|
851
|
+
url = "https://github.com/isayevlab/{}/raw/main/models/{}_ens.jpt".format(repo_name, tag_name)
|
|
852
|
+
if not os.path.exists(local_dir+f'{tag_name}_ens.jpt'):
|
|
853
|
+
os.makedirs(local_dir, exist_ok=True)
|
|
854
|
+
print(f'Downloading {method} model parameters ...')
|
|
855
|
+
resource_res = requests.get(url)
|
|
856
|
+
with open(local_dir+f'{tag_name}_ens.jpt', 'wb') as f:
|
|
857
|
+
f.write(resource_res.content)
|
|
858
|
+
return local_dir + f'{tag_name}_ens.jpt'
|
|
859
|
+
|
|
729
860
|
def printHelp():
|
|
730
861
|
helpText = __doc__.replace('.. code-block::\n\n', '') + '''
|
|
731
862
|
To use Interface_ANI, please install TorchANI and its dependencies
|
|
@@ -141,6 +141,12 @@ class md():
|
|
|
141
141
|
|
|
142
142
|
self.stop_function = stop_function
|
|
143
143
|
self.stop_function_kwargs = stop_function_kwargs
|
|
144
|
+
|
|
145
|
+
self.linearity = self.molecule_with_initial_conditions.is_it_linear()
|
|
146
|
+
if self.linearity:
|
|
147
|
+
self.degrees_of_freedom = 3 * self.Natoms - 5
|
|
148
|
+
else:
|
|
149
|
+
self.degrees_of_freedom = 3 * self.Natoms - 6
|
|
144
150
|
self.propagate()
|
|
145
151
|
|
|
146
152
|
def propagate(self):
|
|
@@ -200,6 +206,7 @@ class md():
|
|
|
200
206
|
velocity = np.copy(molecule.get_xyz_vectorial_properties('xyz_velocities'))
|
|
201
207
|
|
|
202
208
|
molecule.total_energy = molecule.energy + molecule.kinetic_energy
|
|
209
|
+
molecule.temperature = molecule.kinetic_energy / (constants.kB_in_Hartree*self.degrees_of_freedom/2)
|
|
203
210
|
trajectory_step.step = istep
|
|
204
211
|
trajectory_step.time = istep * self.time_step
|
|
205
212
|
trajectory_step.molecule = molecule
|