mlatom 3.16.2__tar.gz → 3.17.1__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 (149) hide show
  1. {mlatom-3.16.2/src/mlatom.egg-info → mlatom-3.17.1}/PKG-INFO +3 -12
  2. {mlatom-3.16.2 → mlatom-3.17.1}/README.md +2 -2
  3. {mlatom-3.16.2 → mlatom-3.17.1}/setup.py +1 -1
  4. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatom.py +20 -5
  5. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLtasks.py +62 -2
  6. mlatom-3.17.1/src/mlatom/__init__.py +11 -0
  7. mlatom-3.17.1/src/mlatom/addons/uaiqm/uaiqm.py +71 -0
  8. mlatom-3.17.1/src/mlatom/aimnet2.py +110 -0
  9. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1.py +28 -16
  10. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2.py +36 -22
  11. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/al.py +3 -3
  12. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/args_class.py +14 -8
  13. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/composite_methods.py +3 -2
  14. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/data.py +245 -54
  15. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/dens.py +17 -15
  16. mlatom-3.17.1/src/mlatom/fortran/__init__.py +0 -0
  17. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/header.py +29 -28
  18. mlatom-3.17.1/src/mlatom/interfaces/__init__.py +0 -0
  19. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/ase_interface.py +10 -14
  20. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/columbus_interface.py +9 -8
  21. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/dftbplus_interface.py +115 -21
  22. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/dftd3_interface.py +16 -16
  23. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/dftd4_interface.py +20 -20
  24. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/dpmd_interface.py +26 -28
  25. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/gap_interface.py +25 -27
  26. mlatom-3.17.1/src/mlatom/interfaces/gaussian_external.py +114 -0
  27. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/gaussian_interface.py +201 -211
  28. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/mace_interface.py +77 -77
  29. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/mndo_interface.py +11 -18
  30. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/orca_interface.py +35 -9
  31. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/physnet_interface.py +40 -40
  32. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/pyscf_interface.py +13 -29
  33. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/sgdml_interface.py +17 -17
  34. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/sparrow_interface.py +33 -11
  35. mlatom-3.17.1/src/mlatom/interfaces/torchani_heavy_parts.py +24 -0
  36. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/torchani_interface.py +178 -210
  37. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/turbomole_interface.py +4 -2
  38. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/xtb +0 -0
  39. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interfaces/xtb_interface.py +197 -98
  40. mlatom-3.17.1/src/mlatom/mltpa/__init__.py +0 -0
  41. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/mltpa/mltpa2022_2.pkl +0 -0
  42. mlatom-3.16.2/src/mlatom/models.py → mlatom-3.17.1/src/mlatom/model_cls.py +56 -648
  43. mlatom-3.17.1/src/mlatom/models.py +609 -0
  44. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/shell_cmd.py +1 -1
  45. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/simulations.py +74 -43
  46. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/spectra.py +54 -35
  47. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/xyz.py +64 -20
  48. {mlatom-3.16.2 → mlatom-3.17.1/src/mlatom.egg-info}/PKG-INFO +3 -12
  49. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom.egg-info/SOURCES.txt +7 -0
  50. mlatom-3.16.2/src/mlatom/__init__.py +0 -8
  51. mlatom-3.16.2/src/mlatom/interfaces/__init__.py +0 -71
  52. {mlatom-3.16.2 → mlatom-3.17.1}/LICENSE.txt +0 -0
  53. {mlatom-3.16.2 → mlatom-3.17.1}/setup.cfg +0 -0
  54. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/GICnet.py +0 -0
  55. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLTPA.py +0 -0
  56. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/ML_NEA.py +0 -0
  57. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF +0 -0
  58. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/A_KRR.f90 +0 -0
  59. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/A_KRR_kernel.f90 +0 -0
  60. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/D_CoulombMatrix.f90 +0 -0
  61. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/D_ID.f90 +0 -0
  62. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/D_rel2eq.f90 +0 -0
  63. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/MLatomF.f90 +0 -0
  64. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/MLatomFInfo.f90 +0 -0
  65. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/MLmodel.f90 +0 -0
  66. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/Makefile +0 -0
  67. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/Makefile.intel +0 -0
  68. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/__init__.py +0 -0
  69. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/analyze.f90 +0 -0
  70. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/constants.f90 +0 -0
  71. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/cs.cpp +0 -0
  72. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/dataset.f90 +0 -0
  73. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/mathUtils.f90 +0 -0
  74. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/molDescr.f90 +0 -0
  75. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/optionsModule.f90 +0 -0
  76. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/precision.f90 +0 -0
  77. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/recover.sh +0 -0
  78. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/sampling.f90 +0 -0
  79. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/statistics.f90 +0 -0
  80. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/stopper.f90 +0 -0
  81. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/strings.f90 +0 -0
  82. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/timing.f90 +0 -0
  83. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/MLatomF_src/types.f90 +0 -0
  84. {mlatom-3.16.2/src/mlatom/aiqm1_model → mlatom-3.17.1/src/mlatom/addons}/__init__.py +0 -0
  85. {mlatom-3.16.2/src/mlatom/aiqm2_model → mlatom-3.17.1/src/mlatom/addons/uaiqm}/__init__.py +0 -0
  86. {mlatom-3.16.2/src/mlatom/fortran → mlatom-3.17.1/src/mlatom/aiqm1_model}/__init__.py +0 -0
  87. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv0.pt +0 -0
  88. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv1.pt +0 -0
  89. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv2.pt +0 -0
  90. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv3.pt +0 -0
  91. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv4.pt +0 -0
  92. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv5.pt +0 -0
  93. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv6.pt +0 -0
  94. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_cc_cv7.pt +0 -0
  95. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv0.pt +0 -0
  96. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv1.pt +0 -0
  97. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv2.pt +0 -0
  98. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv3.pt +0 -0
  99. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv4.pt +0 -0
  100. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv5.pt +0 -0
  101. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv6.pt +0 -0
  102. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm1_model/aiqm1_dft_cv7.pt +0 -0
  103. {mlatom-3.16.2/src/mlatom/mltpa → mlatom-3.17.1/src/mlatom/aiqm2_model}/__init__.py +0 -0
  104. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv0.pt +0 -0
  105. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv1.pt +0 -0
  106. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv2.pt +0 -0
  107. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv3.pt +0 -0
  108. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv4.pt +0 -0
  109. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv5.pt +0 -0
  110. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv6.pt +0 -0
  111. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/aiqm2_model/aiqm2_cv7.pt +0 -0
  112. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/al_utils.py +0 -0
  113. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/ccsdtstarcbs.py +0 -0
  114. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/constants.py +0 -0
  115. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/conversions.py +0 -0
  116. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/cs.so +0 -0
  117. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/decorators.py +0 -0
  118. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/doc.py +0 -0
  119. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/fortran/KREG.f90 +0 -0
  120. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/fortran/KREG.so +0 -0
  121. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/fortran/compile.py +0 -0
  122. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/fortran/mathUtils.f90 +0 -0
  123. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/fortran/stopper.f90 +0 -0
  124. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/functionsGICnet.py +0 -0
  125. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/gap_md.py +0 -0
  126. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/initial_conditions.py +0 -0
  127. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/interface_MLatomF.py +0 -0
  128. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/kreg_api.py +0 -0
  129. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/log.py +0 -0
  130. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/md.py +0 -0
  131. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/md2vibr.py +0 -0
  132. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/md2vibr_cmd.py +0 -0
  133. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/md_cmd.py +0 -0
  134. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/md_parallel.py +0 -0
  135. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/mlatom_gui.py +0 -0
  136. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/mltpa/mff.txt +0 -0
  137. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/mltpa/mltpa2022_2_new_.pkl +0 -0
  138. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/namd.py +0 -0
  139. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/plot.py +0 -0
  140. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/ref.json +0 -0
  141. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/sliceData.py +0 -0
  142. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/stats.py +0 -0
  143. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/stopper.py +0 -0
  144. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/thermostat.py +0 -0
  145. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom/utils.py +0 -0
  146. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom.egg-info/dependency_links.txt +0 -0
  147. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom.egg-info/entry_points.txt +0 -0
  148. {mlatom-3.16.2 → mlatom-3.17.1}/src/mlatom.egg-info/requires.txt +0 -0
  149. {mlatom-3.16.2 → mlatom-3.17.1}/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.16.2
3
+ Version: 3.17.1
4
4
  Summary: A Package for AI-enhanced computational chemistry
5
5
  Home-page: http://mlatom.com
6
6
  Author: Pavlo O. Dral
@@ -14,20 +14,11 @@ Classifier: Environment :: Console
14
14
  Requires-Python: >=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE.txt
17
- Requires-Dist: numpy
18
- Requires-Dist: scipy
19
- Requires-Dist: h5py
20
- Requires-Dist: pyh5md
21
- Requires-Dist: torch
22
- Requires-Dist: torchani
23
- Requires-Dist: matplotlib
24
- Requires-Dist: statsmodels
25
- Requires-Dist: tqdm
26
17
 
27
18
  # About Program
28
19
  MLatom: a Package for Atomistic Simulations with Machine Learning
29
20
 
30
- Version 3.16.2
21
+ Version 3.17.1
31
22
 
32
23
  **Official website**: http://mlatom.com/
33
24
  **Documentation**: http://mlatom.com/docs/
@@ -56,7 +47,7 @@ When this Software or its derivatives are used in scientific publications, it sh
56
47
  * 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.
57
48
  * 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.
58
49
  * 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.
59
- * Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Mikolaj Martyka, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, Matheus O. Bispo, Vignesh B. Kumar, Xin-Yu Tong, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.16.2, Xiamen University, Xiamen, China, 2013-2024.
50
+ * Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Mikolaj Martyka, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, Matheus O. Bispo, Vignesh B. Kumar, Xin-Yu Tong, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.17.1, Xiamen University, Xiamen, China, 2013-2024.
60
51
  [MLatom.com](http://mlatom.com).
61
52
 
62
53
  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.16.2
4
+ Version 3.17.1
5
5
 
6
6
  **Official website**: http://mlatom.com/
7
7
  **Documentation**: http://mlatom.com/docs/
@@ -30,7 +30,7 @@ When this Software or its derivatives are used in scientific publications, it sh
30
30
  * 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.
31
31
  * 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.
32
32
  * 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.
33
- * Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Mikolaj Martyka, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, Matheus O. Bispo, Vignesh B. Kumar, Xin-Yu Tong, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.16.2, Xiamen University, Xiamen, China, 2013-2024.
33
+ * Pavlo O. Dral, Fuchun Ge, Yi-Fan Hou, Peikun Zheng, Yuxinxin Chen, Bao-Xin Xue, Mikolaj Martyka, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, Shuang Zhang, Lina Zhang, Arif Ullah, Quanhao Zhang, Sebastian V. Pios, Yanchi Ou, Matheus O. Bispo, Vignesh B. Kumar, Xin-Yu Tong, MLatom: A Package for Atomistic Simulations with Machine Learning, version 3.17.1, Xiamen University, Xiamen, China, 2013-2024.
34
34
  [MLatom.com](http://mlatom.com).
35
35
 
36
36
  The citations for MLatom's interfaces and features shall be eventually
@@ -43,7 +43,7 @@ with open(os.path.join(here, 'README.md')) as f:
43
43
 
44
44
  setup(
45
45
  name = pkg_name,
46
- version = "3.16.2",
46
+ version = "3.17.1",
47
47
  author = "Pavlo O. Dral",
48
48
  author_email = "admin@mlatom.com",
49
49
  license = 'MIT (modified)',
@@ -4,7 +4,7 @@
4
4
  !---------------------------------------------------------------------------!
5
5
  ! !
6
6
  ! MLatom: a Package for Atomistic Simulations with Machine Learning !
7
- ! MLatom 3.16.2 !
7
+ ! MLatom 3.17.1 !
8
8
  ! @ !
9
9
  ! Xiamen Atomistic Computing Suite (XACS) !
10
10
  ! !
@@ -38,7 +38,7 @@
38
38
  ! Sebastian V. Pios, Yanchi Ou, Matheus O. Bispo, Vignesh B. Kumar, !
39
39
  ! Xin-Yu Tong, !
40
40
  ! MLatom: A Package for Atomistic Simulations with Machine Learning, !
41
- ! version 3.16.2, Xiamen University, Xiamen, China, 2013-2024. !
41
+ ! version 3.17.1, Xiamen University, Xiamen, China, 2013-2024. !
42
42
  ! !
43
43
  ! The citations for MLatom's interfaces and features shall be eventually !
44
44
  ! included too. See header.py, ref.json and http://mlatom.com. !
@@ -56,9 +56,24 @@
56
56
  '''
57
57
 
58
58
  import os, sys, time
59
- from mlatom import header
60
- from mlatom.MLtasks import CLItasks
61
- from mlatom.args_class import mlatom_args
59
+ # import header
60
+ # from mlatom.MLtasks import CLItasks
61
+ # from mlatom.args_class import mlatom_args
62
+ import importlib.util
63
+ # ~POD, 2025.03.23
64
+ # the complicated import below is required to load the same instance of mlatom,
65
+ # where this script is located.
66
+
67
+ dir_path = os.path.dirname(os.path.abspath(__file__))
68
+ path2init = os.path.join(dir_path, '__init__.py')
69
+ dirname = os.path.basename(dir_path)
70
+ spec = importlib.util.spec_from_file_location(dirname, path2init)
71
+ mlatom_with_this_file = importlib.util.module_from_spec(spec)
72
+ sys.modules[dirname] = mlatom_with_this_file
73
+ spec.loader.exec_module(mlatom_with_this_file)
74
+ header = mlatom_with_this_file.header
75
+ CLItasks = mlatom_with_this_file.MLtasks.CLItasks
76
+ mlatom_args = mlatom_with_this_file.args_class.mlatom_args
62
77
 
63
78
  def run(argv = []):
64
79
  starttime = time.time()
@@ -23,7 +23,7 @@ class CLItasks(object):
23
23
  def __init__(self, args):
24
24
  self.args = args
25
25
  def run(self):
26
- if self.args.MLprog.lower() == 'mlatomf' and self.args.task in self.MLatomF_tasks and not self.args.method and not self.args.hyperparameter_optimization['hyperparameters']:
26
+ if self.args.MLprog.lower() == 'mlatomf' and self.args.task in self.MLatomF_tasks and not self.args.method and not self.args.hyperparameter_optimization['hyperparameters'] and not self.args.uaiqm:
27
27
  return run_with_mlatomF(self.args)
28
28
  else:
29
29
  return globals()[self.args.task](self.args)
@@ -39,10 +39,12 @@ def run_with_mlatomF(args):
39
39
  post_delta_learning(args)
40
40
  return results
41
41
 
42
- # Functions for tasks bleow. Name with corresponding task name in args_class.mLatom_args._task_list
42
+ # Functions for tasks below. Name with corresponding task name in args_class.mLatom_args._task_list
43
43
  def useMLmodel(args):
44
44
  if args.deltaLearn:
45
45
  pre_delta_learning(args)
46
+ if args.uaiqm:
47
+ get_uaiqm_args(args)
46
48
  model = loading_model(args)
47
49
  molecular_database = loading_data(args.XYZfile, args.Yfile, args.YgradXYZfile, charges=args.charges, multiplicities=args.multiplicities)
48
50
  t_predict = predicting(model=model, molecular_database=molecular_database, value=bool(args.YestFile), gradient=bool(args.YgradXYZestFile), hessian=bool(args.hessianEstFile), ismethod=args.method)
@@ -60,6 +62,13 @@ def useMLmodel(args):
60
62
  printing_aiqm2_results(molecule=mol)
61
63
  elif args.ani1ccx or args.ani1x or args.ani2x or args.ani1xd4 or args.ani2xd4 or args.ani1ccxgelu or args.ani1xgelu or args.ani1ccxgelud4 or args.ani1xgelud4:
62
64
  printing_animethod_results(methodname=model.method, molecule=mol)
65
+ elif 'uaiqm' in args.method:
66
+ nmol = 0
67
+ for mol in molecular_database:
68
+ nmol += 1
69
+ print('\n\n Properties of molecule %d\n' % nmol)
70
+ uversion = None if not args.uversion else args.uversion
71
+ printing_uaiqm_results(molecule=mol, method=args.method, uversion=args.uversion)
63
72
  else:
64
73
  for imol in range(len(molecular_database.molecules)): print(' Energy of molecule %6d: %25.13f Hartree' % (imol+1, molecular_database.molecules[imol].energy))
65
74
  print('')
@@ -374,6 +383,8 @@ def tsfreq(args):
374
383
 
375
384
  def geomopt(args, return_moldb=False):
376
385
  from . import simulations
386
+ if args.uaiqm:
387
+ get_uaiqm_args(args)
377
388
  molDB = loading_data(XYZfile=args.XYZfile, charges=args.charges, multiplicities=args.multiplicities)
378
389
  model = loading_model(args)
379
390
  fname = args.optXYZ
@@ -420,6 +431,11 @@ def geomopt(args, return_moldb=False):
420
431
  print('\n\n Final properties of molecule %d\n' % (imol+1))
421
432
  printing_aiqm2_results(molecule=geomopt.optimized_molecule)
422
433
  print('\n')
434
+ elif args.method and 'uaiqm' in args.method:
435
+ print('\n\n Final properties of molecule %d\n' % (imol+1))
436
+ uversion = None if not args.uversion else args.uversion
437
+ printing_uaiqm_results(molecule=geomopt.optimized_molecule, method=args.method, uversion=uversion)
438
+ print('\n')
423
439
  elif args.ani1ccx or args.ani1x or args.ani2x or args.ani1xd4 or args.ani2xd4 or args.ani1ccxgelu or args.ani1xgelu or args.ani1ccxgelud4 or args.ani1xgelud4:
424
440
  print('\n\n Final properties of molecule %d\n' % (imol+1))
425
441
  printing_animethod_results(methodname=model.method, molecule=geomopt.optimized_molecule)
@@ -441,6 +457,8 @@ def freq(args, molDB=None):
441
457
  from . import simulations
442
458
  if molDB is None:
443
459
  molDB = loading_data(args.XYZfile, charges=args.charges, multiplicities=args.multiplicities)
460
+ if args.uaiqm:
461
+ get_uaiqm_args(args)
444
462
  model = loading_model(args)
445
463
  kwargs = {}
446
464
  if args.freqProg: kwargs['program'] = args.freqProg
@@ -518,6 +536,9 @@ def freq(args, molDB=None):
518
536
  # scaling_factor = 0.962
519
537
 
520
538
  if scaling:
539
+ mol_copy = mol.copy()
540
+ mol_copy.frequencies = np.array(mol_copy.frequencies) * scaling_factor
541
+ mol_copy.dump(f'scaled_freq_gaussian{mol.number}.log',format='gaussian')
521
542
  print(' Scale frequencies linearly')
522
543
  print(f' Scaling factor: {scaling_factor}')
523
544
  print(' Mode Frequencies Reduced masses Force Constants IR intensities')
@@ -536,6 +557,10 @@ def freq(args, molDB=None):
536
557
  if args.AIQM2 or args.AIQM2DFT:
537
558
  printing_aiqm2_results(molecule=mol)
538
559
  print('')
560
+ elif args.method and 'uaiqm' in args.method:
561
+ uversion = None if not args.uversion else args.uversion
562
+ printing_uaiqm_results(molecule=mol, method=args.method, uversion=args.uversion)
563
+ print('')
539
564
  elif args.ani1ccx or args.ani1x or args.ani2x or args.ani1xd4 or args.ani2xd4 or args.ani1ccxgelu or args.ani1xgelu or args.ani1ccxgelud4 or args.ani1xgelud4:
540
565
  printing_animethod_results(methodname=model.method, molecule=mol)
541
566
  print('')
@@ -657,6 +682,10 @@ def loading_method(args):
657
682
  kwargs['qm_program'] = args.qmprog
658
683
  else:
659
684
  kwargs['program'] = args.qmprog
685
+ if args.uversion:
686
+ kwargs['version'] = args.uversion
687
+ if 'uwarning' in args.args_dict:
688
+ kwargs['warning'] = args.uwarning
660
689
  method = models.methods(**kwargs)
661
690
  method.set_num_threads(args.nthreads)
662
691
  return method
@@ -1050,6 +1079,21 @@ def post_delta_learning(args):
1050
1079
  strtmp += '%25.13f ' % (ygradxyzb[imol][iatom][idim] + corr[imol][iatom][idim])
1051
1080
  fyestt.writelines('%s\n' % strtmp)
1052
1081
 
1082
+ def get_uaiqm_args(args):
1083
+ molecular_database = loading_data(args.XYZfile, args.Yfile, args.YgradXYZfile, charges=args.charges, multiplicities=args.multiplicities)
1084
+ model = models.uaiqm(method='uaiqm_optimal')
1085
+ if not args.ncpus:
1086
+ args.ncpus = 8
1087
+ if not args.time_budget:
1088
+ args.time_budget = None
1089
+ model.select_optimal(
1090
+ molecule=molecular_database[0],
1091
+ nCPUs=args.ncpus,
1092
+ time_budget=args.time_budget
1093
+ )
1094
+ args.method = model.method
1095
+ args.uversion = model.version
1096
+
1053
1097
  def printing_aiqm1_results(aiqm1=True, molecule=None):
1054
1098
  fmt = ' %-41s: %15.8f Hartree'
1055
1099
  # find aiqm1 keyword
@@ -1078,6 +1122,22 @@ def printing_aiqm2_results(molecule=None):
1078
1122
  print(fmt % ('GFN2-xTB* contribution', molecule.gfn2xtbstar.energy), file=sys.stdout)
1079
1123
  print(fmt % ('D4 contribution', molecule.d4wb97x.energy))
1080
1124
  print(fmt % ('Total energy', molecule.energy))
1125
+
1126
+ def printing_uaiqm_results(molecule=None, method=None, uversion=None):
1127
+ print(f' Selected UAIQM method: {method}')
1128
+ if uversion:
1129
+ print(f' Selected version: {uversion}\n')
1130
+ else:
1131
+ print(f' Selected version: latest\n')
1132
+ fmt = ' %-41s: %15.8f Hartree'
1133
+ print(fmt % ('Standard deviation of ML contribution', molecule.energy_standard_deviation), end='')
1134
+ print(' %15.5f kcal/mol' % (molecule.energy_standard_deviation * constants.Hartree2kcalpermol))
1135
+ if molecule.baseline_energy:
1136
+ print(fmt % ('Baseline contribution', molecule.baseline_energy))
1137
+ print(fmt % ('NN contribution', molecule.MLs_energy))
1138
+ if molecule.dispersion_energy:
1139
+ print(fmt % ('D4 contribution', molecule.dispersion_energy), file=sys.stdout)
1140
+ print(fmt % ('Total energy', molecule.energy))
1081
1141
 
1082
1142
  def printing_animethod_results(methodname=None, molecule=None):
1083
1143
  if 'D4'.casefold() in methodname.casefold():
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python3
2
+ from . import args_class, MLtasks, header, data, models, plot, simulations, stats, xyz, namd, constants, spectra
3
+ from .simulations import optimize_geometry, irc, freq, thermochemistry, md, generate_initial_conditions, vibrational_spectrum, md_parallel
4
+ from .data import atom, molecule, molecular_database
5
+ from .models import kreg, ani, msani
6
+ from .models import methods, aiqm1, aiqm2, dens, ani_methods, aimnet2_methods, gaussian_methods, pyscf_methods, orca_methods, turbomole_methods, mndo_methods, sparrow_methods, xtb_methods, dftbplus_methods, columbus_methods, dftd3_methods, dftd4_methods
7
+ from . import al_utils
8
+ from .al import al
9
+ from .gap_md import gap_md, gap_model
10
+ # add-ons
11
+ from .models import uaiqm
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env python3
2
+ '''
3
+ .. code-block::
4
+
5
+ !---------------------------------------------------------------------------!
6
+ ! Add-on mock implementation for: !
7
+ ! !
8
+ ! uaiqm: Universal and Updatable Artificial Intelligence-Enhanced !
9
+ ! Quantum Mechanical Methods !
10
+ ! Implementations by: Yuxinxin Chen and Pavlo O. Dral !
11
+ !---------------------------------------------------------------------------!
12
+ '''
13
+
14
+ from ...model_cls import method_model
15
+
16
+ class uaiqm(method_model):
17
+ """
18
+ The Universal and Updatable Artificial Intelligence-Quantum Mechanical methods.
19
+
20
+ Arguments:
21
+ method (str, optional): UAIQM method used.
22
+ version (str, optional): The version of each UAIQM method. Default is the the newest.
23
+ uaiqm_kwargs (dictionary, optional): Keywords passed to calculation for each part in uaiqm.
24
+ selector (uaiqm selector, optional): If no customized selector is provided, default selection scheme will be used.
25
+ verbose (bool, optional): Whether to print information during automatic selection
26
+
27
+ .. code-block:: python
28
+
29
+ # Initialize molecule
30
+ mol = ml.data.molecule()
31
+ mol.read_from_xyz_file(filename='ethanol.xyz')
32
+ # Run UAIQM calculation
33
+ uaiqm = ml.models.methods(method='uaiqm_odm2star@cc', version='newest')
34
+ uaiqm.predict(molecule=mol, calculate_energy=True, calculate_energy_gradients=True, calculate_hessian=True)
35
+ # Get energy, gradient, and prediction uncertainty of UAIQM method
36
+ energy = mol.energy
37
+ gradient = mol.gradient
38
+
39
+ """
40
+
41
+ supported_methods = ['uaiqm_optimal', 'uaiqm_nobaseline@dft', 'uaiqm_nobaseline@cc', 'uaiqm_odm2star@dft', 'uaiqm_odm2star@cc', 'uaiqm_gfn2xtbstar@dft', 'uaiqm_gfn2xtbstar@cc', 'uaiqm_wb97x631gp@cc', 'uaiqm_wb97xdef2tzvpp@cc']
42
+
43
+ def __init__(
44
+ self,
45
+ # <<< define methods <<<
46
+ method: str = 'uaiqm_gfn2xtbstar@cc',
47
+ version: str = 'newest',
48
+ # <<< solvent - only support xtb based method now <<<
49
+ solvent: str = None,
50
+ # <<< keywords for each componnet <<<
51
+ baseline_kwargs: dict = {},
52
+ dispersion_kwargs: dict = {},
53
+ # <<< set number of threads (default 1)<<<
54
+ nthreads: int = 1,
55
+ # <<< unused keyword <<<
56
+ selector = None,
57
+ # <<< verbose setting <<<
58
+ verbose: bool = False,
59
+ warning: bool = True,
60
+ # <<< file saving <<<
61
+ working_directory: str = None,
62
+ save_files_in_current_directory: bool = True
63
+ ):
64
+
65
+ if self.is_method_supported(method=method):
66
+ raise ValueError(f'The requested method "{method}" is supported as an add-on in Aitomic, please refer to http://MLatom.com/aitomic for the instructions on how to obtain it.')
67
+ else:
68
+ self.raise_unsupported_method_error(method)
69
+
70
+ if __name__ == '__main__':
71
+ pass
@@ -0,0 +1,110 @@
1
+ '''
2
+ .. code-block::
3
+
4
+ !---------------------------------------------------------------------------!
5
+ ! aimnet2: Universal AIMnet2 models !
6
+ ! Implementations by: Yuxinxin Chen !
7
+ !---------------------------------------------------------------------------!
8
+ '''
9
+ from .model_cls import torchani_model, method_model
10
+ from .decorators import doc_inherit
11
+
12
+ class aimnet2_methods(torchani_model, method_model):
13
+ '''
14
+ Universal ML methods with AIMNet2: https://doi.org/10.26434/chemrxiv-2023-296ch
15
+
16
+ Arguments:
17
+ method (str): A string that specifies the method. Available choices: ``'AIMNet2@b973c'`` and ``'AIMNet2@wb97m-d3'``.
18
+ 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.
19
+
20
+ '''
21
+
22
+ supported_methods = ['AIMNet2@b973c', 'AIMNet2@wb97m-d3']
23
+ element_symbols_available = ['H', 'B', 'C', 'N', 'O', 'F', 'Si', 'P', 'S', 'Cl', 'As', 'Se', 'Br', 'I']
24
+
25
+ def __init__(self, method: str = 'AIMNet2@b973c', device = None):
26
+ import torch
27
+ if device is None:
28
+ if torch.cuda.is_available():
29
+ self.device = torch.device('cuda')
30
+ else:
31
+ self.device = torch.device('cpu')
32
+ else:
33
+ self.device = torch.device(device)
34
+ self.model_path = self.parse_aimnet2_resources(method)
35
+ self.model = torch.jit.load(self.model_path)
36
+
37
+ @doc_inherit
38
+ def predict(
39
+ self,
40
+ molecular_database = None,
41
+ molecule = None,
42
+ calculate_energy: bool = False,
43
+ calculate_energy_gradients: bool = False,
44
+ calculate_hessian: bool = False,
45
+ batch_size: int = 2**16,
46
+ ) -> None:
47
+ import numpy as np
48
+
49
+ molDB = super().predict(molecular_database=molecular_database, molecule=molecule)
50
+
51
+ for element_symbol in np.unique(np.concatenate(molDB.element_symbols)):
52
+ if element_symbol not in self.element_symbols_available:
53
+ 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')
54
+ return
55
+
56
+ for mol in molDB:
57
+ self.predict_for_molecule(
58
+ molecule=mol,
59
+ calculate_energy=calculate_energy,
60
+ calculate_energy_gradients=calculate_energy_gradients,
61
+ calculate_hessian=calculate_hessian)
62
+
63
+ def predict_for_molecule(
64
+ self,
65
+ molecule,
66
+ calculate_energy: bool = False,
67
+ calculate_energy_gradients: bool = False,
68
+ calculate_hessian: bool = False):
69
+
70
+ import torch
71
+
72
+ coord = torch.as_tensor(molecule.xyz_coordinates).to(torch.float).to(self.device).unsqueeze(0)
73
+ numbers = torch.as_tensor(molecule.atomic_numbers).to(torch.long).to(self.device).unsqueeze(0)
74
+ charge = torch.tensor([molecule.charge], dtype=torch.float, device=self.device)
75
+ nninput = dict(coord=coord, numbers=numbers, charge=charge)
76
+ prev = torch.is_grad_enabled()
77
+ torch._C._set_grad_enabled(calculate_energy_gradients)
78
+ if calculate_energy_gradients:
79
+ nninput['coord'].requires_grad_(True)
80
+ nnoutput = self.model(nninput)
81
+ if calculate_energy:
82
+ molecule.energy = nnoutput['energy'].item()
83
+ if calculate_energy_gradients:
84
+ if 'forces' in nnoutput:
85
+ f = nnoutput['forces'][0]
86
+ else:
87
+ f = - torch.autograd.grad(nnoutput['energy'], nninput['coord'])[0][0]
88
+ forces = f.detach().cpu().numpy()
89
+ molecule.add_xyz_vectorial_property(forces, 'energy_gradients')
90
+
91
+ if calculate_hessian:
92
+ print('Hessian not available yet')
93
+ molecule.hessian = np.zeros((len(molecule),)*2)
94
+
95
+ torch._C._set_grad_enabled(prev)
96
+
97
+ @staticmethod
98
+ def parse_aimnet2_resources(method):
99
+ import requests, os
100
+ local_dir = os.path.expanduser('~/.local/AIMNet2/')
101
+ repo_name = "AIMNet2"
102
+ tag_name = method.lower().replace('@', '_')
103
+ url = "https://github.com/isayevlab/{}/raw/old/models/{}_ens.jpt".format(repo_name, tag_name)
104
+ if not os.path.exists(local_dir+f'{tag_name}_ens.jpt'):
105
+ os.makedirs(local_dir, exist_ok=True)
106
+ print(f'Downloading {method} model parameters ...')
107
+ resource_res = requests.get(url)
108
+ with open(local_dir+f'{tag_name}_ens.jpt', 'wb') as f:
109
+ f.write(resource_res.content)
110
+ return local_dir + f'{tag_name}_ens.jpt'
@@ -9,13 +9,10 @@
9
9
  '''
10
10
  import numpy as np
11
11
  import os
12
- from . import data, models, stopper
12
+ from . import data
13
+ from .model_cls import model, torchani_model, method_model, model_tree_node
13
14
 
14
- import torch
15
- import torchani
16
- from torchani.utils import ChemicalSymbolsToInts
17
-
18
- class aiqm1(models.torchani_model, metaclass=models.meta_method):
15
+ class aiqm1(torchani_model, method_model):
19
16
  """
20
17
  The Artificial intelligence-quantum mechanical method as in the `AIQM1 paper`_.
21
18
 
@@ -33,7 +30,7 @@ class aiqm1(models.torchani_model, metaclass=models.meta_method):
33
30
  mol = ml.data.molecule()
34
31
  mol.read_from_xyz_file(filename='ethanol.xyz')
35
32
  # Run AIQM1 calculation
36
- aiqm1 = ml.models.methods(method='AIQM1', qm_program='MNDO')
33
+ aiqm1 = ml.methods(method='AIQM1', qm_program='MNDO')
37
34
  aiqm1.predict(molecule=mol, calculate_energy=True, calculate_energy_gradients=True)
38
35
  # Get energy, gradient, and prediction uncertainty of AIQM1
39
36
  energy = mol.energy
@@ -42,27 +39,30 @@ class aiqm1(models.torchani_model, metaclass=models.meta_method):
42
39
 
43
40
 
44
41
  """
42
+
43
+ supported_methods = ['AIQM1', 'AIQM1@DFT', 'AIQM1@DFT*']
45
44
  atomic_energies = {'AIQM1': {1:-0.50088038, 6:-37.79221710, 7:-54.53360298, 8:-75.00986203},
46
45
  'AIQM1@DFT': {1:-0.50139362, 6:-37.84623117, 7:-54.59175573, 8:-75.07674376}}
47
46
  atomic_energies['AIQM1@DFT*'] = atomic_energies['AIQM1@DFT']
48
47
 
49
48
  def __init__(self, method='AIQM1', qm_program=None, qm_program_kwargs={}, dftd4_kwargs={}, **kwargs):
49
+ from .models import methods
50
50
  self.method = method.upper()
51
51
  self.qm_program = qm_program
52
52
  self.qm_program_kwargs = qm_program_kwargs
53
53
  modelname = self.method.lower().replace('*','star').replace('@','at')
54
54
  ani_nn_children = []
55
55
  for ii in range(8):
56
- nn_i = models.model_tree_node(name=f'{modelname}_nn{ii}', operator='predict', model=ani_nns_in_aiqm1(method=self.method, model_index=ii))
56
+ nn_i = model_tree_node(name=f'{modelname}_nn{ii}', operator='predict', model=ani_nns_in_aiqm1(method=self.method, model_index=ii))
57
57
  ani_nn_children.append(nn_i)
58
- ani_nns = models.model_tree_node(name=f'{modelname}_nn', children=ani_nn_children, operator='average')
59
- shift = models.model_tree_node(name=f'{modelname}_atomic_energy_shift', operator='predict', model=atomic_energy_shift(method=self.method))
60
- odm2star = models.model_tree_node(name='odm2star', operator='predict', model=models.methods(method='ODM2*', program=qm_program, **qm_program_kwargs))
58
+ ani_nns = model_tree_node(name=f'{modelname}_nn', children=ani_nn_children, operator='average')
59
+ shift = model_tree_node(name=f'{modelname}_atomic_energy_shift', operator='predict', model=atomic_energy_shift(method=self.method))
60
+ odm2star = model_tree_node(name='odm2star', operator='predict', model=methods(method='ODM2*', program=qm_program, **qm_program_kwargs))
61
61
  aiqm1_children = [ani_nns, shift, odm2star]
62
62
  if self.method != 'AIQM1@DFT*':
63
- d4 = models.model_tree_node(name='d4_wb97x', operator='predict', model=models.methods(method='D4', functional='wb97x', **dftd4_kwargs))
63
+ d4 = model_tree_node(name='d4_wb97x', operator='predict', model=methods(method='D4', functional='wb97x', **dftd4_kwargs))
64
64
  aiqm1_children.append(d4)
65
- self.aiqm1_model = models.model_tree_node(name=modelname, children=aiqm1_children, operator='sum')
65
+ self.aiqm1_model = model_tree_node(name=modelname, children=aiqm1_children, operator='sum')
66
66
 
67
67
  def predict(self, molecular_database=None, molecule=None,
68
68
  calculate_energy=True, calculate_energy_gradients=False, calculate_hessian=False, calculate_dipole_derivatives=False, nstates=1, current_state=0, **kwargs):
@@ -96,7 +96,8 @@ class aiqm1(models.torchani_model, metaclass=models.meta_method):
96
96
  molecule.energy = self.atomic_energies[self.method][molecule.atoms[0].atomic_number]
97
97
  standard_atom = data.atom(atomic_number=molecule.atoms[0].atomic_number)
98
98
  if molecule.charge != 0 or molecule.multiplicity != standard_atom.multiplicity:
99
- odm2model = models.methods(method='ODM2*', program=self.qm_program)
99
+ from .models import methods
100
+ odm2model = methods(method='ODM2*', program=self.qm_program)
100
101
  mol_odm2 = molecule.copy()
101
102
  odm2model.predict(molecule=mol_odm2, nstates=nstates, **kwargs)
102
103
  mol_standard_odm2 = molecule.copy() ; mol_standard_odm2.charge = 0; mol_standard_odm2.multiplicity=standard_atom.multiplicity
@@ -129,7 +130,7 @@ class aiqm1(models.torchani_model, metaclass=models.meta_method):
129
130
  molecule.__dict__[f'{modelname}_nn'].standard_deviation(properties=properties+atomic_properties)
130
131
 
131
132
 
132
- class atomic_energy_shift(models.model):
133
+ class atomic_energy_shift(model):
133
134
  atomic_energy_shifts = {'AIQM1': {1: -4.29365862e-02, 6: -3.34329586e+01, 7: -4.69301173e+01, 8: -6.29634763e+01},
134
135
  'AIQM1@DFT': {1: -4.27888067e-02, 6: -3.34869833e+01, 7: -4.69896148e+01, 8: -6.30294433e+01}}
135
136
  atomic_energy_shifts['AIQM1@DFT*'] = atomic_energy_shifts['AIQM1@DFT']
@@ -166,10 +167,11 @@ class atomic_energy_shift(models.model):
166
167
  ndim = len(mol.atoms) * 3
167
168
  mol.hessian = np.zeros(ndim*ndim).reshape(ndim,ndim)
168
169
 
169
- class ani_nns_in_aiqm1(models.torchani_model):
170
+ class ani_nns_in_aiqm1(torchani_model):
170
171
  species_order = [1, 6, 7, 8]
171
172
 
172
173
  def __init__(self, method='AIQM1', model_index = 0):
174
+ import torch
173
175
  if method == 'AIQM1':
174
176
  self.level = 'cc'
175
177
  elif method in ['AIQM1@DFT', 'AIQM1@DFT*']:
@@ -180,6 +182,7 @@ class ani_nns_in_aiqm1(models.torchani_model):
180
182
  self.load_model()
181
183
 
182
184
  def define_aev(self):
185
+ import torch
183
186
  Rcr = 5.2000e+00
184
187
  Rca = 4.0000e+00
185
188
  EtaR = torch.tensor([1.6000000e+01], device=self.device)
@@ -189,19 +192,23 @@ class ani_nns_in_aiqm1(models.torchani_model):
189
192
  EtaA = torch.tensor([8.0000000e+00], device=self.device)
190
193
  ShfA = torch.tensor([9.0000000e-01, 1.6750000e+00, 2.4499998e+00, 3.2250000e+00], device=self.device)
191
194
  num_species = len(self.species_order)
195
+ import torchani
192
196
  aev_computer = torchani.AEVComputer(Rcr, Rca, EtaR, ShfR, EtaA, Zeta, ShfA, ShfZ, num_species)
193
197
  self.aev_computer = aev_computer
194
198
 
195
199
  def load_model(self):
200
+ import torch
196
201
  mlatomdir=os.path.dirname(__file__)
197
202
  dirname = os.path.join(mlatomdir, 'aiqm1_model')
198
203
  method = 'aiqm1_' + self.level
199
204
  self.define_nn()
200
205
  checkpoint = torch.load(os.path.join(dirname, f'{method}_cv{self.model_index}.pt'), map_location=self.device)
201
206
  self.nn.load_state_dict(checkpoint['nn'])
207
+ import torchani
202
208
  self.model = torchani.nn.Sequential(self.aev_computer, self.nn).to(self.device).double()
203
209
 
204
210
  def define_nn(self):
211
+ import torch
205
212
  aev_dim = self.aev_computer.aev_length
206
213
  H_network = torch.nn.Sequential(
207
214
  torch.nn.Linear(aev_dim, 160),
@@ -243,6 +250,7 @@ class ani_nns_in_aiqm1(models.torchani_model):
243
250
  torch.nn.Linear(96, 1)
244
251
  )
245
252
 
253
+ import torchani
246
254
  nn = torchani.ANIModel([H_network, C_network, N_network, O_network])
247
255
  self.nn = nn
248
256
 
@@ -250,6 +258,8 @@ class ani_nns_in_aiqm1(models.torchani_model):
250
258
  calculate_energy=True, calculate_energy_gradients=False, calculate_hessian=False, nstates=1, **kwargs):
251
259
  molDB = super().predict(molecular_database=molecular_database, molecule=molecule)
252
260
 
261
+ from torchani.utils import ChemicalSymbolsToInts
262
+
253
263
  calculate_energy_gradients = bool(np.array(calculate_energy_gradients).any())
254
264
  calculate_hessian = bool(np.array(calculate_hessian).any())
255
265
  species_to_tensor = ChemicalSymbolsToInts(self.species_order)
@@ -264,6 +274,7 @@ class ani_nns_in_aiqm1(models.torchani_model):
264
274
  mol.electronic_states.append(mol_copy.copy())
265
275
  molecules = mol.electronic_states
266
276
 
277
+ import torch
267
278
  for mol in molecules:
268
279
  atomic_numbers = np.array([atom.atomic_number for atom in mol.atoms])
269
280
  xyz_coordinates = torch.tensor(np.array(mol.xyz_coordinates).astype('float')).to(self.device).requires_grad_(calculate_energy_gradients or calculate_hessian)
@@ -278,6 +289,7 @@ class ani_nns_in_aiqm1(models.torchani_model):
278
289
  for iatom in range(len(mol.atoms)):
279
290
  mol.atoms[iatom].energy_gradients = grads[iatom]
280
291
  if calculate_hessian:
292
+ import torchani
281
293
  ANI_NN_hessian = torchani.utils.hessian(xyz_coordinates, energies=ANI_NN_energy)
282
294
  mol.hessian = ANI_NN_hessian[0].detach().cpu().numpy()
283
295