mlatom 2.3.1__tar.gz → 2.3.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 (112) hide show
  1. {MLatom-2.3.1 → MLatom-2.3.3}/PKG-INFO +6 -5
  2. {MLatom-2.3.1 → MLatom-2.3.3}/README.md +4 -3
  3. {MLatom-2.3.1 → MLatom-2.3.3}/setup.py +4 -3
  4. MLatom-2.3.3/src/MLatom/MLTPA.py +435 -0
  5. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatom.py +28 -15
  6. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLtasks.py +34 -14
  7. MLatom-2.3.3/src/MLatom/__init__.py +9 -0
  8. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/args_class.py +4 -6
  9. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/doc.py +33 -1
  10. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/header.py +4 -1
  11. MLatom-2.3.3/src/MLatom/interface_MLatomF.py +97 -0
  12. MLatom-2.3.3/src/MLatom/mltpa/mff.txt +564 -0
  13. MLatom-2.3.3/src/MLatom/mltpa/mltpa2022_2.pkl +0 -0
  14. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/ref.json +4 -3
  15. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/sliceData.py +7 -3
  16. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom.egg-info/PKG-INFO +6 -5
  17. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom.egg-info/SOURCES.txt +6 -1
  18. MLatom-2.3.1/src/MLatom/interface_MLatomF.py +0 -95
  19. {MLatom-2.3.1 → MLatom-2.3.3}/LICENSE.txt +0 -0
  20. {MLatom-2.3.1 → MLatom-2.3.3}/setup.cfg +0 -0
  21. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/AIQM1.py +0 -0
  22. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/LICENSE.CC-BY-NC-ND-4.0 +0 -0
  23. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/ML_NEA.py +0 -0
  24. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF +0 -0
  25. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/A_KRR.f90 +0 -0
  26. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/A_KRR_kernel.f90 +0 -0
  27. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/D_CoulombMatrix.f90 +0 -0
  28. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/D_ID.f90 +0 -0
  29. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/D_rel2eq.f90 +0 -0
  30. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/MLatomF.f90 +0 -0
  31. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/MLatomFInfo.f90 +0 -0
  32. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/MLmodel.f90 +0 -0
  33. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/Makefile +0 -0
  34. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/Makefile.intel +0 -0
  35. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/__init__.py +0 -0
  36. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/analyze.f90 +0 -0
  37. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/constants.f90 +0 -0
  38. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/cs.cpp +0 -0
  39. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/dataset.f90 +0 -0
  40. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/mathUtils.f90 +0 -0
  41. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/molDescr.f90 +0 -0
  42. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/optionsModule.f90 +0 -0
  43. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/precision.f90 +0 -0
  44. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/recover.sh +0 -0
  45. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/sampling.f90 +0 -0
  46. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/statistics.f90 +0 -0
  47. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/stopper.f90 +0 -0
  48. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/strings.f90 +0 -0
  49. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/timing.f90 +0 -0
  50. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/MLatomF_src/types.f90 +0 -0
  51. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/README +0 -0
  52. {MLatom-2.3.1/src/MLatom → MLatom-2.3.3/src/MLatom/aiqm1_model}/__init__.py +0 -0
  53. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv0.pt +0 -0
  54. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv1.pt +0 -0
  55. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv2.pt +0 -0
  56. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv3.pt +0 -0
  57. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv4.pt +0 -0
  58. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv5.pt +0 -0
  59. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv6.pt +0 -0
  60. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_cc_cv7.pt +0 -0
  61. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv0.pt +0 -0
  62. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv1.pt +0 -0
  63. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv2.pt +0 -0
  64. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv3.pt +0 -0
  65. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv4.pt +0 -0
  66. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv5.pt +0 -0
  67. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv6.pt +0 -0
  68. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/aiqm1_model/aiqm1_dft_cv7.pt +0 -0
  69. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/calculator.py +0 -0
  70. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/cs.so +0 -0
  71. {MLatom-2.3.1/src/MLatom/aiqm1_model → MLatom-2.3.3/src/MLatom/documentation}/__init__.py +0 -0
  72. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/documentation/installation.txt +0 -0
  73. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/E_FCI_451.dat +0 -0
  74. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/E_UHF_451.dat +0 -0
  75. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/R_451.dat +0 -0
  76. {MLatom-2.3.1/src/MLatom/documentation → MLatom-2.3.3/src/MLatom/example}/__init__.py +0 -0
  77. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/isubtrain.dat +0 -0
  78. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/itest.dat +0 -0
  79. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/itrain.dat +0 -0
  80. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/ivalidate.dat +0 -0
  81. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/mlatom.inp +0 -0
  82. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/mlatom.saved +0 -0
  83. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/example/test.sh +0 -0
  84. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/geomopt.py +0 -0
  85. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/DeePMDkit/DP_inference.py +0 -0
  86. {MLatom-2.3.1/src/MLatom/example → MLatom-2.3.3/src/MLatom/interfaces/DeePMDkit}/__init__.py +0 -0
  87. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/DeePMDkit/interface_DeePMDkit.py +0 -0
  88. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/DeePMDkit/template.json +0 -0
  89. {MLatom-2.3.1/src/MLatom/interfaces/DeePMDkit → MLatom-2.3.3/src/MLatom/interfaces/GAP}/__init__.py +0 -0
  90. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/GAP/interface_GAP.py +0 -0
  91. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/PhysNet/PhysNet_predict.py +0 -0
  92. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/PhysNet/PhysNet_train.py +0 -0
  93. {MLatom-2.3.1/src/MLatom/interfaces/GAP → MLatom-2.3.3/src/MLatom/interfaces/PhysNet}/__init__.py +0 -0
  94. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/PhysNet/interface_PhysNet.py +0 -0
  95. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/TorchANI/TorchANI_predict.py +0 -0
  96. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/TorchANI/TorchANI_train.py +0 -0
  97. {MLatom-2.3.1/src/MLatom/interfaces/PhysNet → MLatom-2.3.3/src/MLatom/interfaces/TorchANI}/__init__.py +0 -0
  98. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/TorchANI/interface_TorchANI.py +0 -0
  99. {MLatom-2.3.1/src/MLatom/interfaces/TorchANI → MLatom-2.3.3/src/MLatom/interfaces}/__init__.py +0 -0
  100. {MLatom-2.3.1/src/MLatom/interfaces → MLatom-2.3.3/src/MLatom/interfaces/sGDML}/__init__.py +0 -0
  101. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/sGDML/interface_sGDML.py +0 -0
  102. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/interfaces/sGDML/sgdml_dataset_from_extxyz.py +0 -0
  103. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/mlatom-gui.py +0 -0
  104. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/mlatom_gui.py +0 -0
  105. {MLatom-2.3.1/src/MLatom/interfaces/sGDML → MLatom-2.3.3/src/MLatom/mltpa}/__init__.py +0 -0
  106. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/shell_cmd.py +0 -0
  107. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/stopper.py +0 -0
  108. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom/thermo.py +0 -0
  109. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom.egg-info/dependency_links.txt +0 -0
  110. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom.egg-info/entry_points.txt +0 -0
  111. {MLatom-2.3.1 → MLatom-2.3.3}/src/MLatom.egg-info/requires.txt +0 -0
  112. {MLatom-2.3.1 → MLatom-2.3.3}/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: 2.3.1
3
+ Version: 2.3.3
4
4
  Summary: A Package for Atomistic Simulations with Machine Learning
5
5
  Home-page: http://mlatom.com
6
6
  Author: Pavlo O. Dral
@@ -11,7 +11,7 @@ Classifier: Operating System :: POSIX :: Linux
11
11
  Classifier: Programming Language :: Fortran
12
12
  Classifier: Topic :: Scientific/Engineering :: Chemistry
13
13
  Classifier: Environment :: Console
14
- Requires-Python: >=3.7
14
+ Requires-Python: >=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE.txt
17
17
 
@@ -23,7 +23,7 @@ A Package for Atomistic Simulations with Machine Learning
23
23
 
24
24
 
25
25
  # Tasks Performed by MLatom
26
- A brief overview of MLatom capabilities. See sections below for more details.
26
+ A brief overview of MLatom capabilities (see above links for more up-to-date version). See sections below for more details.
27
27
 
28
28
  ## Tasks
29
29
  - Estimating accuracy of ML models.
@@ -31,6 +31,7 @@ A brief overview of MLatom capabilities. See sections below for more details.
31
31
  - Loading existing ML model from a file and performing ML calculations with this model.
32
32
  - ML-accelerated calculation of absorption spectra within nuclear ensemble approach
33
33
  - Learning curves
34
+ - ML-two photon absorption
34
35
 
35
36
  ## Data Set Operations
36
37
  - Converting XYZ coordinates into an input vector (molecular descriptor) for ML.
@@ -126,7 +127,7 @@ MLatom also provides interfaces to some third-party software where extra ML mode
126
127
 
127
128
  # About Program
128
129
  MLatom: a Package for Atomistic Simulations with Machine Learning
129
- Version 2.3.1
130
+ Version 2.3.3
130
131
  http://mlatom.com/
131
132
 
132
133
  Copyright (c) 2013-2022 Pavlo O. Dral
@@ -140,7 +141,7 @@ Cite as:
140
141
 
141
142
  1. Pavlo O. Dral, J. Comput. Chem. 2019, 40, 2339-2347
142
143
  2. Pavlo O. Dral, Fuchun Ge, Bao-Xin Xue, Yi-Fan Hou, Max Pinheiro Jr, Jianxing Huang, Mario Barbatti, Top. Curr. Chem. 2021, 379, 27
143
- 3. Pavlo O. Dral, Peikun Zheng, Bao-Xin Xue, Fuchun Ge, Yi-Fan Hou, Max Pinheiro Jr, MLatom: A Package for Atomistic Simulations with Machine Learning, version 2.3.1, Xiamen University, Xiamen, China, 2013-2022.
144
+ 3. Pavlo O. Dral, Peikun Zheng, Bao-Xin Xue, Fuchun Ge, Yi-Fan Hou, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, MLatom: A Package for Atomistic Simulations with Machine Learning, version 2.3.3, Xiamen University, Xiamen, China, 2013-2022.
144
145
 
145
146
 
146
147
  # License
@@ -6,7 +6,7 @@ A Package for Atomistic Simulations with Machine Learning
6
6
 
7
7
 
8
8
  # Tasks Performed by MLatom
9
- A brief overview of MLatom capabilities. See sections below for more details.
9
+ A brief overview of MLatom capabilities (see above links for more up-to-date version). See sections below for more details.
10
10
 
11
11
  ## Tasks
12
12
  - Estimating accuracy of ML models.
@@ -14,6 +14,7 @@ A brief overview of MLatom capabilities. See sections below for more details.
14
14
  - Loading existing ML model from a file and performing ML calculations with this model.
15
15
  - ML-accelerated calculation of absorption spectra within nuclear ensemble approach
16
16
  - Learning curves
17
+ - ML-two photon absorption
17
18
 
18
19
  ## Data Set Operations
19
20
  - Converting XYZ coordinates into an input vector (molecular descriptor) for ML.
@@ -109,7 +110,7 @@ MLatom also provides interfaces to some third-party software where extra ML mode
109
110
 
110
111
  # About Program
111
112
  MLatom: a Package for Atomistic Simulations with Machine Learning
112
- Version 2.3.1
113
+ Version 2.3.3
113
114
  http://mlatom.com/
114
115
 
115
116
  Copyright (c) 2013-2022 Pavlo O. Dral
@@ -123,7 +124,7 @@ Cite as:
123
124
 
124
125
  1. Pavlo O. Dral, J. Comput. Chem. 2019, 40, 2339-2347
125
126
  2. Pavlo O. Dral, Fuchun Ge, Bao-Xin Xue, Yi-Fan Hou, Max Pinheiro Jr, Jianxing Huang, Mario Barbatti, Top. Curr. Chem. 2021, 379, 27
126
- 3. Pavlo O. Dral, Peikun Zheng, Bao-Xin Xue, Fuchun Ge, Yi-Fan Hou, Max Pinheiro Jr, MLatom: A Package for Atomistic Simulations with Machine Learning, version 2.3.1, Xiamen University, Xiamen, China, 2013-2022.
127
+ 3. Pavlo O. Dral, Peikun Zheng, Bao-Xin Xue, Fuchun Ge, Yi-Fan Hou, Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, MLatom: A Package for Atomistic Simulations with Machine Learning, version 2.3.3, Xiamen University, Xiamen, China, 2013-2022.
127
128
 
128
129
 
129
130
  # License
@@ -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 = "2.3.1",
46
+ version = "2.3.3",
47
47
  author = "Pavlo O. Dral",
48
48
  author_email = "admin@mlatom.com",
49
49
  license = 'CC BY-NC-ND 4.0', # https://creativecommons.org/licenses/by-nc-nd/4.0/
@@ -51,11 +51,11 @@ setup(
51
51
  long_description = README,
52
52
  long_description_content_type = 'text/markdown',
53
53
  url = "http://mlatom.com",
54
- python_requires='>=3.7',
54
+ python_requires='>=3.8',
55
55
  packages = find_packages('src'),
56
56
  package_dir = {'' : 'src'},
57
57
  # scripts = ['mlatom', 'MLatomF'],
58
- package_data = {"": ['MLatomF', 'README', '*.json', 'cs.so', '*.cpp', '*.pt', '*.dat', '*.txt', '*.inp', '*.f90', 'Makefile', 'Makefile.intel', '*.saved', '*.sh']},
58
+ package_data = {"": ['MLatomF', 'README', '*.json', 'cs.so', '*.cpp', '*.pt', '*.dat', '*.txt', '*.pkl', '*.inp', '*.f90', 'Makefile', 'Makefile.intel', '*.saved', '*.sh']},
59
59
  classifiers = [
60
60
  "Programming Language :: Python :: 3",
61
61
  "Operating System :: POSIX :: Linux",
@@ -64,6 +64,7 @@ setup(
64
64
  "Environment :: Console",
65
65
  ],
66
66
  install_requires = ['numpy', 'matplotlib'],
67
+ # , 'pandas', '<scikit-learn> < <1.0.0>', 'xgboost', 'rdkit'
67
68
  entry_points = {
68
69
  'console_scripts' : ['mlatom-gui = MLatom.mlatom_gui:main',
69
70
  'mlatom_gui = MLatom.mlatom_gui:main',
@@ -0,0 +1,435 @@
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+
5
+ '''
6
+ !---------------------------------------------------------------------------!
7
+ ! mltpa: Machine learning prediction of the Two-photon absorption !
8
+ ! Implementations by: Yuming Su, Yiheng Dai, Yangtao Chen, Fuchun Ge !
9
+ !---------------------------------------------------------------------------!
10
+ '''
11
+
12
+ import numpy as np
13
+ from rdkit import Chem
14
+ from rdkit.Chem import AllChem
15
+ from rdkit.Chem import rdMolDescriptors
16
+ from typing import *
17
+ import joblib
18
+ import time
19
+ import os
20
+ import pandas as pd
21
+
22
+ from args_class import ArgsBase
23
+ mlatomdir=os.path.dirname(__file__)
24
+
25
+ class Args(ArgsBase):
26
+ def __init__(self):
27
+ super().__init__()
28
+ self.args2pass = []
29
+ self.add_default_dict_args([
30
+
31
+ ],
32
+ ""
33
+ )
34
+
35
+ self.add_dict_args({
36
+ 'mlmodelin':mlatomdir+'/mltpa/mltpa2022_2.pkl',
37
+ 'SMILESfile':'',
38
+ 'auxfile':'',
39
+ })
40
+
41
+ def parse(self,argsraw):
42
+ self.parse_input_content(argsraw)
43
+ self.args2pass = self.args_string_list(['',None])
44
+
45
+
46
+
47
+ class MLTPA(object):
48
+ def __init__(self,
49
+ argsMLTPA
50
+ ) -> None:
51
+
52
+ args=Args()
53
+ args.parse(argsMLTPA)
54
+ smiles_list=args.SMILESfile
55
+ model=args.mlmodelin
56
+ auxfile=args.auxfile
57
+ """
58
+ Two Photon Absorption Cross-Section Predictor Class
59
+
60
+ Parameters
61
+ ----------
62
+ smiles_list
63
+ A file contains list with SMILES of one or many molecules
64
+ model
65
+ Model used to predict TPA cross-section. Default: '/home/mlatom/models/MLTPA/mltpa2022.pkl'
66
+ auxfile
67
+ An auxiliary file including the infomation of wavelength and solvent(Et30). The format should be
68
+ 'wavelength_lowbound,wavelength_upbound,Et30'. If the auxiliary file does not exist, then the default value
69
+ of Et30 will be 33.9(toluene) and the whole spectra between 600-1100nm will be output.The length should be
70
+ corresponding to the smiles_list.
71
+ """
72
+ self.smiles_list = []
73
+ self.YestFolder = 'mltpa'+ time.strftime("%Y%m%d_%H%M%S", time.localtime())
74
+ with open(smiles_list, 'r') as f:
75
+ for line in f.readlines():
76
+ self.smiles_list.append(line.strip('\n'))
77
+ if auxfile:
78
+ self.wavelength = []
79
+ self.Et30 = []
80
+ with open(auxfile, 'r') as f:
81
+ for line in f.readlines():
82
+ info = list(map(float, line.strip('\n').split(',')))
83
+ self.wavelength.append(info[:2])
84
+ self.Et30.append(info[2])
85
+ if len(self.wavelength)!=len(self.smiles_list):
86
+ raise ValueError("The length of smiles_list and the length of auxfile are not exactly the same.")
87
+ else:
88
+ self.wavelength = None
89
+ self.Et30 = 33.9
90
+ with open(model, 'rb') as m:
91
+ self.model = joblib.load(m)
92
+ self.length = len(self.smiles_list)
93
+
94
+ @staticmethod
95
+ def find_conj(smiles: str):
96
+ """
97
+ Find the conjugate part of the given molecule
98
+
99
+ Parameters
100
+ ----------
101
+ smiles
102
+ The SMILES of the molecule
103
+ Returns
104
+ -------
105
+ ring_list:
106
+ A list containing all ring
107
+ f_a
108
+ A list containing atom index of the conjugate part
109
+ """
110
+ mol = Chem.MolFromSmiles(smiles)
111
+ a_m = Chem.rdmolops.GetAdjacencyMatrix(mol)
112
+ patt_list_d = ['C=C', 'C#C', 'C#N', 'C=O', 'C=S', 'C=N', 'N=N', '[N+]([O-])=O']
113
+ patt_list_m = ['N', 'O', 'S', 'F', 'Cl', 'Br', 'I', 'P']
114
+ ring_list = []
115
+ f_a = []
116
+ patt = Chem.MolFromSmarts('c') # Define the aromatic carbon atom
117
+ atomids = mol.GetSubstructMatches(patt) # Find all the aromatic carbon atoms in the molecule
118
+ atoms = mol.GetAtoms() # get all the atoms in the molecule
119
+ temp_list = []
120
+
121
+ def find_ring(atom_id, found_atoms):
122
+ nonlocal a_m, ring_list, f_a, atoms, temp_list
123
+ flag = False
124
+ c_list = np.argwhere(
125
+ a_m[atom_id] == 1).flatten().tolist() # Find the atom next to the atom with atom_id number
126
+ for atom in c_list:
127
+ if atom not in f_a:
128
+ a = atoms[atom]
129
+ if a.IsInRing() and str(a.GetHybridization()) != 'SP3':
130
+ found_atoms.append(atom)
131
+ f_a.append(atom)
132
+ find_ring(atom, found_atoms)
133
+ flag = True
134
+ if not flag:
135
+ temp_list.append(found_atoms)
136
+
137
+ for atom in atomids:
138
+ a = atom[0]
139
+ if a not in f_a:
140
+ find_ring(a, [])
141
+ if len(temp_list) > 0:
142
+ max_ring = temp_list[0]
143
+ for l in temp_list:
144
+ if len(l) > len(max_ring):
145
+ max_ring = l
146
+ ring_list.append(max_ring)
147
+ temp_list = []
148
+ for patt in patt_list_d:
149
+ f = Chem.MolFromSmarts(patt)
150
+ atomids = mol.GetSubstructMatches(f)
151
+ if len(atomids) > 0:
152
+ for pair in atomids:
153
+ n_l = []
154
+ flag_f = False
155
+ for a in pair:
156
+ if a in f_a:
157
+ flag_f = True
158
+ break
159
+ neighbors = atoms[a].GetNeighbors()
160
+ for na in neighbors:
161
+ n_l.append(na.GetIdx())
162
+ if flag_f:
163
+ continue
164
+ temp = []
165
+ temp_r_id = []
166
+ # So here we have the adjacent atoms of the double and triple bonds
167
+ for n in n_l:
168
+ if atoms[n].GetAtomicNum() in [6, 7, 8]:
169
+ for i in range(len(ring_list)):
170
+ ring = ring_list[i]
171
+ if n in ring:
172
+ temp.append(ring)
173
+ temp_r_id.append(i)
174
+ if len(temp) == 1:
175
+ ring_list[temp_r_id[0]].append(pair[0])
176
+ ring_list[temp_r_id[0]].append(pair[1])
177
+ f_a.append(pair[0])
178
+ f_a.append(pair[1])
179
+ else:
180
+ # Merging multiple lists
181
+ t_r = []
182
+ for r in temp:
183
+ t_r += r
184
+ # Plus double and triple bonds
185
+ t_r.append(pair[0])
186
+ t_r.append(pair[1])
187
+ # Get rid of the old ring
188
+ temp_r_id.sort()
189
+ temp_r_id = np.unique(temp_r_id)
190
+ for i in reversed(temp_r_id):
191
+ del ring_list[i]
192
+ # Plus a new ring
193
+ ring_list.append(t_r)
194
+ f_a.append(pair[0])
195
+ f_a.append(pair[1])
196
+ for patt in patt_list_m:
197
+ f = Chem.MolFromSmarts(patt)
198
+ atomids = mol.GetSubstructMatches(f)
199
+ if len(atomids) > 0:
200
+ for atom in atomids:
201
+ a = atom[0]
202
+ if a not in f_a:
203
+ neighbors = atoms[a].GetNeighbors()
204
+ n_l = []
205
+ for na in neighbors:
206
+ n_l.append(na.GetIdx())
207
+ temp = []
208
+ temp_r_id = []
209
+ # So over here, we find the heteroatom's neighbor
210
+ for n in n_l:
211
+ for i in range(len(ring_list)):
212
+ ring = ring_list[i]
213
+ if (n in ring) and (i not in temp_r_id):
214
+ temp.append(ring)
215
+ temp_r_id.append(i)
216
+ if len(temp) == 1:
217
+ ring_list[temp_r_id[0]].append(a)
218
+ f_a.append(a)
219
+ else:
220
+ # Merging multiple lists
221
+ t_r = []
222
+ for r in temp:
223
+ t_r += r
224
+ # Plus heteroatoms
225
+ t_r.append(a)
226
+ # Get rid of the old ring
227
+ temp_r_id.sort()
228
+ for i in reversed(temp_r_id):
229
+ del ring_list[i]
230
+ # Plus a new ring
231
+ if len(t_r) > 1:
232
+ ring_list.append(t_r)
233
+ f_a.append(a)
234
+ for i in range(len(atoms)):
235
+ if i not in f_a:
236
+ aa = atoms[i]
237
+ if aa.GetSymbol() != 'C' or str(aa.GetHybridization()) != 'SP2':
238
+ continue
239
+ aa_n = aa.GetNeighbors()
240
+ flag = False
241
+ for aaa in aa_n:
242
+ if aaa.GetIdx() in f_a:
243
+ flag = True
244
+ break
245
+ if flag:
246
+ a = i
247
+ neighbors = atoms[a].GetNeighbors()
248
+ n_l = []
249
+ for na in neighbors:
250
+ n_l.append(na.GetIdx())
251
+ temp = []
252
+ temp_r_id = []
253
+ # So over here, we find the heteroatom's neighbor
254
+ for n in n_l:
255
+ for i in range(len(ring_list)):
256
+ ring = ring_list[i]
257
+ if (n in ring) and (i not in temp_r_id):
258
+ temp.append(ring)
259
+ temp_r_id.append(i)
260
+ if len(temp) == 1:
261
+ ring_list[temp_r_id[0]].append(a)
262
+ f_a.append(a)
263
+ else:
264
+ # Merging multiple lists
265
+ t_r = []
266
+ for r in temp:
267
+ t_r += r
268
+ # Plus heteroatoms
269
+ t_r.append(a)
270
+ # Get rid of the old ring
271
+ temp_r_id.sort()
272
+ for i in reversed(temp_r_id):
273
+ del ring_list[i]
274
+ # Plus a new ring
275
+ if len(t_r) > 1:
276
+ ring_list.append(t_r)
277
+ f_a.append(a)
278
+ # Finally check whether the conjugate structure is connected
279
+ if len(ring_list) > 1:
280
+ temp_count = 0
281
+ flag = True
282
+ while flag:
283
+ t_temp = int(len(ring_list) * (len(ring_list) - 1) / 2)
284
+ temp = 0
285
+ break_flag = False
286
+ for i in range(len(ring_list) - 1):
287
+ for j in range(len(ring_list) - i - 1):
288
+ r_1 = ring_list[i]
289
+ r_2 = ring_list[i + j + 1]
290
+ if np.sum(a_m[r_1, :][:, r_2]) == 0:
291
+ temp += 1
292
+ else:
293
+ # need to merge
294
+ for k in r_2:
295
+ ring_list[i].append(k)
296
+ ring_list[i] = np.unique(ring_list[i])
297
+ del ring_list[i + j + 1]
298
+ break_flag = True
299
+ break
300
+ if break_flag:
301
+ break
302
+ if temp == t_temp:
303
+ flag = False
304
+ for i in range(len(ring_list)):
305
+ ring_list[i] = np.unique(ring_list[i]).flatten().tolist()
306
+ return ring_list, f_a
307
+
308
+ def feature_generation(self, smiles, et30, wavelength) -> np.ndarray:
309
+ """
310
+ feature vector generation
311
+ Parameters
312
+ ----------
313
+ smiles
314
+ SMILES of the given molecule
315
+ et30
316
+ A descriptor to measure solvent polarity
317
+ wavelength
318
+ Wavelength in nanometer
319
+ Returns
320
+ -------
321
+ feature_vector
322
+ features of the molecule in the order of
323
+ [Max Conju-Distance (MFF-Conju),
324
+ Conju-PEOE-Charge-Maximum (MFF-Conju),
325
+ Conju-Atomic-LogP-Minimum (MFF-Conju),
326
+ Conju-Atomic-MR-Maximum (MFF-Conju),
327
+ ET(30) (Solvent),
328
+ Wavelength (Exp nm)
329
+ ]
330
+ """
331
+ mff_title = []
332
+ with open(mlatomdir+'/mltpa/mff.txt', 'r') as f:
333
+ for line in f.readlines():
334
+ mff_title.append(line.strip('\n'))
335
+ feature_vector = np.zeros(6)
336
+ mol = Chem.MolFromSmiles(smiles)
337
+ d_m = Chem.rdmolops.GetDistanceMatrix(mol)
338
+ ring_list, f_a = self.find_conj(smiles)
339
+ lstmax = sorted(ring_list, key=len)[-1]
340
+
341
+ # calculate max conju-distance
342
+ conju_max_dis = []
343
+ for r in ring_list:
344
+ conju_max_dis.append(np.max(d_m[r, :][:, r]))
345
+ feature_vector[0] = max(conju_max_dis)
346
+
347
+ # calculate PEOE-charge
348
+ AllChem.ComputeGasteigerCharges(mol, nIter=25)
349
+ peoe_charge = [mol.GetAtomWithIdx(i).GetDoubleProp('_GasteigerCharge') for i in range(mol.GetNumAtoms())]
350
+
351
+ # calculate logp and mr
352
+ contribs = rdMolDescriptors._CalcCrippenContribs(mol)
353
+ logp = [contribs[i][0] for i in range(len(contribs))]
354
+ mr = [contribs[i][1] for i in range(len(contribs))]
355
+ atom_props = [peoe_charge, logp, mr]
356
+
357
+ for _ in range(len(atom_props)):
358
+ for r in [lstmax]:
359
+ atom_props_list = atom_props[_]
360
+ frag_x = []
361
+ frag_atom_id = []
362
+ for i in range(len(mff_title)):
363
+ patt = mff_title[i]
364
+ f = Chem.MolFromSmarts(patt)
365
+ atomids = mol.GetSubstructMatches(f)
366
+ if len(atomids) > 0:
367
+ for j in range(len(atomids)):
368
+ peoe_flag = True
369
+ for k in atomids[j]:
370
+ if k not in r:
371
+ peoe_flag = False
372
+ break
373
+ if peoe_flag:
374
+ frag_atom_id.append(atomids[j])
375
+ x_temp = 0
376
+ for k in atomids[j]:
377
+ x_temp += atom_props_list[k]
378
+ frag_x.append(x_temp)
379
+ if len(frag_x) == 0:
380
+ frag_x = [0]
381
+ frag_atom_id = [()]
382
+ if _ == 0 or _ == 2:
383
+ feature_vector[_ + 1] = (max(frag_x))
384
+ else:
385
+ feature_vector[_ + 1] = (min(frag_x))
386
+
387
+ feature_vector[4] = et30
388
+ feature_vector[5] = wavelength
389
+ return feature_vector
390
+
391
+ def predict(self):
392
+ c_time = time.strftime("%Y%m%d_%H%M%S", time.localtime())
393
+ out_path = '{}'.format(self.YestFolder)
394
+ if not os.path.exists(out_path):
395
+ os.mkdir(out_path)
396
+ for i in range(self.length):
397
+ feature_mat = []
398
+ if self.wavelength is None:
399
+ wavelength = np.array(np.arange(600, 1100, 10))
400
+ feature_mat.append(self.feature_generation(self.smiles_list[i], self.Et30, wavelength[0]))
401
+ feature_mat = np.array(feature_mat * len(wavelength))
402
+
403
+ feature_mat[:, -1] = wavelength
404
+ y_hat = self.model.predict(feature_mat)
405
+ y_hat= np.exp(y_hat)
406
+ dataframe = pd.DataFrame({'wavelength':wavelength,'predicted_sigma (GM)':y_hat})
407
+ else:
408
+ wavelength = np.array(np.arange(self.wavelength[i][0],self.wavelength[i][1],10))
409
+ if len(wavelength)>1:
410
+ feature_mat.append(self.feature_generation(self.smiles_list[i], self.Et30[i], wavelength[0]))
411
+ feature_mat = np.array(feature_mat * len(wavelength))
412
+ feature_mat[:, -1] = wavelength
413
+ y_hat = self.model.predict(feature_mat)
414
+ y_hat= np.exp(y_hat)
415
+ dataframe = pd.DataFrame({'wavelength':wavelength,'predicted_sigma (GM)':y_hat})
416
+ else:
417
+ wavelength=self.wavelength[i][0]
418
+ feature_mat.append(self.feature_generation(self.smiles_list[i], self.Et30[i], wavelength))
419
+ feature_mat = np.array(feature_mat)
420
+ feature_mat[:, -1] = wavelength
421
+ y_hat = self.model.predict(feature_mat)
422
+ y_hat= np.exp(y_hat)
423
+ dataframe = pd.DataFrame({'wavelength':[wavelength],'predicted_sigma (GM)':y_hat})
424
+ dataframe.to_csv(os.path.join(out_path, 'tpa{}.txt'.format(i+1)),sep=',',index=0)
425
+
426
+ if __name__=='__main__':
427
+ aaa = MLTPA('./Smiles_856-Copy1.csv', './mltpa2022_2.pkl', auxfile='aux.txt')
428
+ aaa.predict()
429
+ ccc = MLTPA('./Smiles_856-Copy1.csv', './mltpa2022.pkl')
430
+ ccc.predict()
431
+
432
+
433
+
434
+
435
+
@@ -4,7 +4,7 @@
4
4
  !---------------------------------------------------------------------------!
5
5
  ! !
6
6
  ! MLatom: a Package for Atomistic Simulations with Machine Learning !
7
- ! Version 2.3 !
7
+ ! Version 2.3.3 !
8
8
  ! http://mlatom.com/ !
9
9
  ! !
10
10
  ! Copyright (c) 2013-2022 Pavlo O. Dral !
@@ -32,24 +32,34 @@
32
32
  ! Jianxing Huang, Mario Barbatti, Top. Curr. Chem. 2021, 379, 27 !
33
33
  ! !
34
34
  ! Pavlo O. Dral, Peikun Zheng, Bao-Xin Xue, Fuchun Ge, Yi-Fan Hou, !
35
- ! Max Pinheiro Jr, !
35
+ ! Max Pinheiro Jr, Yuming Su, Yiheng Dai, Yangtao Chen, !
36
36
  ! MLatom: A Package for Atomistic Simulations with Machine Learning !
37
- ! version 2.2.1, Xiamen University, Xiamen, China, 2013-2022 !
37
+ ! version 2.3.3, Xiamen University, Xiamen, China, 2013-2022 !
38
38
  ! !
39
39
  !---------------------------------------------------------------------------!
40
40
 
41
41
  '''
42
42
 
43
- import os, sys, subprocess, time, shutil, re, copy
44
- import sliceData, stopper
45
- import MLtasks
46
- import interface_MLatomF
47
- import header
48
- from args_class import ArgsBase
49
- from doc import Doc
43
+ import os, sys, time
44
+ try:
45
+ from . import header
46
+ from . import MLtasks
47
+ from . import sliceData
48
+ from . import stopper
49
+ from . import interface_MLatomF
50
+ from .args_class import ArgsBase
51
+ from .doc import Doc
52
+ except:
53
+ import header
54
+ import MLtasks
55
+ import sliceData
56
+ import stopper
57
+ import interface_MLatomF
58
+ from args_class import ArgsBase
59
+ from doc import Doc
50
60
 
51
61
  class MLatomMainCls(object):
52
- def __init__(self):
62
+ def __init__(self, argv = []):
53
63
  starttime = time.time()
54
64
 
55
65
  print(__doc__)
@@ -70,7 +80,10 @@ class MLatomMainCls(object):
70
80
  print(line.rstrip())
71
81
  print(' %s ' % ('_'*78))
72
82
  args = Args()
73
- args.parse(sys.argv[1:])
83
+ if argv == []:
84
+ args.parse(sys.argv[1:])
85
+ else:
86
+ args.parse(argv)
74
87
  print(' %s ' % ('='*78))
75
88
  header.printHeader(args)
76
89
  sys.stdout.flush()
@@ -99,7 +112,7 @@ class MLatomMainCls(object):
99
112
  args.estAccMLmodel or args.learningCurve or
100
113
  args.AIQM1DFTstar or args.AIQM1DFT or args.AIQM1 or
101
114
  args.geomopt or args.freq or args.ts or args.irc or
102
- args.MLNEA):
115
+ args.MLTPA or args.MLNEA):
103
116
  MLtasks.MLtasksCls(argsMLtasks = args.args2pass)
104
117
 
105
118
  endtime = time.time()
@@ -117,8 +130,8 @@ class Args(ArgsBase):
117
130
  'XYZ2X', 'analyze', 'sample', 'sampleFromSlices', 'mergeSlices','slice',
118
131
  'useMLmodel', 'createMLmodel', 'estAccMLmodel', 'learningCurve',
119
132
  'crossSection', # Interfaces
120
- 'AIQM1DFTstar', 'AIQM1DFT', 'AIQM1', # DEVELOPMENT VERSION
121
- 'geomopt', 'freq', 'ts', 'irc'
133
+ 'AIQM1DFTstar', 'AIQM1DFT', 'AIQM1',
134
+ 'geomopt', 'freq', 'ts', 'irc', 'MLTPA'
122
135
  ]
123
136
  self.add_default_dict_args(self.task_list, bool)
124
137
  self.add_default_dict_args([