mlatom 2.0.0__py3-none-any.whl
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/ML_NEA.py +2697 -0
- MLatom/MLatom.py +151 -0
- MLatom/MLatomF +0 -0
- MLatom/MLtasks.py +767 -0
- MLatom/__init__.py +0 -0
- MLatom/args_class.py +396 -0
- MLatom/cs.so +0 -0
- MLatom/doc.py +620 -0
- MLatom/header.py +64 -0
- MLatom/interface_MLatomF.py +87 -0
- MLatom/interfaces/DeePMDkit/DP_inference.py +20 -0
- MLatom/interfaces/DeePMDkit/__init__.py +0 -0
- MLatom/interfaces/DeePMDkit/interface_DeePMDkit.py +327 -0
- MLatom/interfaces/DeePMDkit/template.json +70 -0
- MLatom/interfaces/GAP/__init__.py +0 -0
- MLatom/interfaces/GAP/interface_GAP.py +415 -0
- MLatom/interfaces/PhysNet/PhysNet_predict.py +180 -0
- MLatom/interfaces/PhysNet/PhysNet_train.py +425 -0
- MLatom/interfaces/PhysNet/__init__.py +0 -0
- MLatom/interfaces/PhysNet/interface_PhysNet.py +270 -0
- MLatom/interfaces/TorchANI/TorchANI_predict.py +82 -0
- MLatom/interfaces/TorchANI/TorchANI_train.py +217 -0
- MLatom/interfaces/TorchANI/__init__.py +0 -0
- MLatom/interfaces/TorchANI/interface_TorchANI.py +323 -0
- MLatom/interfaces/__init__.py +0 -0
- MLatom/interfaces/sGDML/__init__.py +0 -0
- MLatom/interfaces/sGDML/interface_sGDML.py +276 -0
- MLatom/interfaces/sGDML/sgdml_dataset_from_extxyz.py +199 -0
- MLatom/ref.json +23 -0
- MLatom/sliceData.py +334 -0
- MLatom/stopper.py +17 -0
- MLatom-2.0.0.data/scripts/MLatomF +12 -0
- MLatom-2.0.0.data/scripts/mlatom +12 -0
- MLatom-2.0.0.dist-info/LICENSE.txt +251 -0
- MLatom-2.0.0.dist-info/METADATA +149 -0
- MLatom-2.0.0.dist-info/RECORD +38 -0
- MLatom-2.0.0.dist-info/WHEEL +5 -0
- MLatom-2.0.0.dist-info/top_level.txt +1 -0
MLatom/MLatom.py
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
'''
|
|
3
|
+
|
|
4
|
+
!---------------------------------------------------------------------------!
|
|
5
|
+
! !
|
|
6
|
+
! MLatom: a Package for Atomistic Simulations with Machine Learning !
|
|
7
|
+
! Version 2.0 !
|
|
8
|
+
! http://mlatom.com/ !
|
|
9
|
+
! !
|
|
10
|
+
! Copyright (c) 2013-2021 Pavlo O. Dral !
|
|
11
|
+
! http://dr-dral.com/ !
|
|
12
|
+
! !
|
|
13
|
+
! All rights reserved. No part of MLatom may be used, published or !
|
|
14
|
+
! redistributed without written permission by Pavlo Dral. !
|
|
15
|
+
! !
|
|
16
|
+
! The above copyright notice and this permission notice shall be included !
|
|
17
|
+
! in all copies or substantial portions of the Software. !
|
|
18
|
+
! !
|
|
19
|
+
! The software is provided "as is", without warranty of any kind, express !
|
|
20
|
+
! or implied, including but not limited to the warranties of !
|
|
21
|
+
! merchantability, fitness for a particular purpose and noninfringement. In !
|
|
22
|
+
! no event shall the authors or copyright holders be liable for any claim, !
|
|
23
|
+
! damages or other liability, whether in an action of contract, tort or !
|
|
24
|
+
! otherwise, arising from, out of or in connection with the software or the !
|
|
25
|
+
! use or other dealings in the software. !
|
|
26
|
+
! !
|
|
27
|
+
! Cite as: !
|
|
28
|
+
! Pavlo O. Dral, J. Comput. Chem. 2019, 40, 2339-2347 !
|
|
29
|
+
! Pavlo O. Dral, Fuchun Ge, Bao-Xin Xue, Yi-Fan Hou, Max Pinheiro Jr, !
|
|
30
|
+
! Jianxing Huang, Mario Barbatti, submitted (check mlatom.com for updates) !
|
|
31
|
+
! !
|
|
32
|
+
! Pavlo O. Dral, Bao-Xin Xue, Fuchun Ge, Yi-Fan Hou, Max Pinheiro Jr, !
|
|
33
|
+
! MLatom: A Package for Atomistic Simulations with Machine Learning !
|
|
34
|
+
! version 2.0, Xiamen University, Xiamen, China, 2013-2021 !
|
|
35
|
+
! !
|
|
36
|
+
!---------------------------------------------------------------------------!
|
|
37
|
+
|
|
38
|
+
'''
|
|
39
|
+
|
|
40
|
+
import os, sys, subprocess, time, shutil, re, copy
|
|
41
|
+
import sliceData, stopper
|
|
42
|
+
import MLtasks, sliceData, stopper
|
|
43
|
+
import interface_MLatomF
|
|
44
|
+
import header
|
|
45
|
+
from args_class import ArgsBase
|
|
46
|
+
from doc import Doc
|
|
47
|
+
|
|
48
|
+
class MLatomMainCls(object):
|
|
49
|
+
def __init__(self):
|
|
50
|
+
starttime = time.time()
|
|
51
|
+
|
|
52
|
+
print(__doc__)
|
|
53
|
+
|
|
54
|
+
print(' %s ' % ('='*78))
|
|
55
|
+
print(time.strftime(" MLatom started on %d.%m.%Y at %H:%M:%S", time.localtime()))
|
|
56
|
+
print(' with the following options:')
|
|
57
|
+
argsstr = ' '
|
|
58
|
+
for arg in sys.argv:
|
|
59
|
+
argsstr += arg + ' '
|
|
60
|
+
print(argsstr.rstrip())
|
|
61
|
+
if len(sys.argv[1:]) == 1:
|
|
62
|
+
if os.path.exists(sys.argv[1]):
|
|
63
|
+
print('\n Input file content:')
|
|
64
|
+
print(' %s ' % ('_'*78))
|
|
65
|
+
with open(sys.argv[1], 'r') as finp:
|
|
66
|
+
for line in finp:
|
|
67
|
+
print(line.rstrip())
|
|
68
|
+
print(' %s ' % ('_'*78))
|
|
69
|
+
args = Args()
|
|
70
|
+
args.parse(sys.argv[1:])
|
|
71
|
+
print(' %s ' % ('='*78))
|
|
72
|
+
header.printHeader(args)
|
|
73
|
+
sys.stdout.flush()
|
|
74
|
+
|
|
75
|
+
# Set the number of threads
|
|
76
|
+
if args.nthreads:
|
|
77
|
+
os.environ["OMP_NUM_THREADS"] = str(args.nthreads)
|
|
78
|
+
os.environ["MKL_NUM_THREADS"] = str(args.nthreads)
|
|
79
|
+
os.environ["OMP_PROC_BIND"] = 'true'
|
|
80
|
+
|
|
81
|
+
# Perform requested task
|
|
82
|
+
if args.XYZ2X or args.sample or args.analyze:
|
|
83
|
+
interface_MLatomF.ifMLatomCls.run(args.args2pass)
|
|
84
|
+
pass
|
|
85
|
+
elif args.slice or args.sampleFromSlices or args.mergeSlices:
|
|
86
|
+
sliceData.sliceDataCls(argsSD = args.args2pass)
|
|
87
|
+
elif (args.useMLmodel or args.createMLmodel or
|
|
88
|
+
args.estAccMLmodel or args.learningCurve or
|
|
89
|
+
args.MLNEA):
|
|
90
|
+
MLtasks.MLtasksCls(argsMLtasks = args.args2pass)
|
|
91
|
+
|
|
92
|
+
endtime = time.time()
|
|
93
|
+
wallclock = endtime - starttime
|
|
94
|
+
print(' %s ' % ('='*78))
|
|
95
|
+
print(' Wall-clock time: %.2f s (%.2f min, %.2f hours)\n' % (wallclock, wallclock / 60.0, wallclock / 3600.0))
|
|
96
|
+
print(time.strftime(" MLatom terminated on %d.%m.%Y at %H:%M:%S", time.localtime()))
|
|
97
|
+
print(' %s ' % ('='*78))
|
|
98
|
+
sys.stdout.flush()
|
|
99
|
+
|
|
100
|
+
class Args(ArgsBase):
|
|
101
|
+
def __init__(self):
|
|
102
|
+
super().__init__()
|
|
103
|
+
self.task_list = [
|
|
104
|
+
'XYZ2X', 'analyze', 'sample', 'sampleFromSlices', 'mergeSlices','slice',
|
|
105
|
+
'useMLmodel', 'createMLmodel', 'estAccMLmodel', 'learningCurve',
|
|
106
|
+
'crossSection'
|
|
107
|
+
]
|
|
108
|
+
self.add_default_dict_args(self.task_list, bool)
|
|
109
|
+
self.add_default_dict_args([
|
|
110
|
+
'useMLmodel', 'createMLmodel', 'estAccMLmodel', 'learningCurve','deltaLearn','selfCorrect','MLmodelType'
|
|
111
|
+
],
|
|
112
|
+
bool
|
|
113
|
+
)
|
|
114
|
+
self.add_default_dict_args([
|
|
115
|
+
'MLprog'
|
|
116
|
+
],
|
|
117
|
+
''
|
|
118
|
+
)
|
|
119
|
+
self.add_default_dict_args([
|
|
120
|
+
'Yb', 'Yt', 'YestT', 'YestFile','XYZfile', 'XfileIn', 'Yfile', 'YgradXYZfile', 'absXfileIn', 'absXYZfile', 'absYfile', 'absYgradXYZfile', 'YgradXYZestFile', 'Ntrain', 'Nsubtrain', 'Nvalidate', 'Ntest', 'iTrainIn', 'iTestIn', 'iSubtrainIn', 'iValidateIn', 'sampling', 'MLmodelIn', 'MLmodelOut',
|
|
121
|
+
'molDescriptor', 'kernel'
|
|
122
|
+
],
|
|
123
|
+
''
|
|
124
|
+
)
|
|
125
|
+
self.add_dict_args({'MLmodelType': '', 'nthreads': None})
|
|
126
|
+
self.set_keyword_alias('crossSection', ['ML-NEA', 'ML_NEA', 'crossSection', 'cross-section', 'cross_section','MLNEA'])
|
|
127
|
+
self.args2pass = []
|
|
128
|
+
|
|
129
|
+
def parse(self, argsraw):
|
|
130
|
+
if len(argsraw) == 0:
|
|
131
|
+
Doc.printDoc({})
|
|
132
|
+
stopper.stopMLatom('At least one option should be provided')
|
|
133
|
+
elif len(argsraw) == 1:
|
|
134
|
+
if os.path.exists(argsraw[0]):
|
|
135
|
+
self.parse_input_file(argsraw[0])
|
|
136
|
+
else:
|
|
137
|
+
self.parse_input_content(argsraw[0])
|
|
138
|
+
self.args2pass = self.args_string_list(['', None])
|
|
139
|
+
elif len(argsraw) >= 2:
|
|
140
|
+
self.parse_input_content(argsraw)
|
|
141
|
+
self.args2pass = self.args_string_list(['', None])
|
|
142
|
+
self.checkArgs()
|
|
143
|
+
|
|
144
|
+
def checkArgs(self):
|
|
145
|
+
Ntasks = eval(' + '.join(map(lambda s: 'self.' + s, self.task_list)))
|
|
146
|
+
if Ntasks == 0:
|
|
147
|
+
Doc.printDoc({})
|
|
148
|
+
stopper.stopMLatom('At least one task should be requested')
|
|
149
|
+
|
|
150
|
+
if __name__ == '__main__':
|
|
151
|
+
MLatomMainCls()
|
MLatom/MLatomF
ADDED
|
Binary file
|