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/doc.py
ADDED
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
'''
|
|
3
|
+
!---------------------------------------------------------------------------!
|
|
4
|
+
! doc: handling help of MLatom !
|
|
5
|
+
! Implementations and documentation by: !
|
|
6
|
+
! Fuchun Ge, Pavlo O. Dral, Bao-Xin Xue !
|
|
7
|
+
!---------------------------------------------------------------------------!
|
|
8
|
+
'''
|
|
9
|
+
import time, sys
|
|
10
|
+
|
|
11
|
+
class Doc():
|
|
12
|
+
@classmethod
|
|
13
|
+
def printDoc(cls,argdict):
|
|
14
|
+
mlatom_alias=['mlatomf','mlatom','kreg']
|
|
15
|
+
gap_alias=[ 'gap', 'gap_fit', 'gapfit']
|
|
16
|
+
sgdml_alias=['sgdml']
|
|
17
|
+
deepmd_alias=['dp','deepmd','deepmd-kit']
|
|
18
|
+
physnet_alias=['physnet']
|
|
19
|
+
ani_alias=['torchani','ani']
|
|
20
|
+
overview=True
|
|
21
|
+
for key, value in argdict.items():
|
|
22
|
+
for k, v in cls.help_text.items():
|
|
23
|
+
if key.lower()==k.lower() and value:
|
|
24
|
+
print(v)
|
|
25
|
+
overview=False
|
|
26
|
+
if key.lower() in ['mlmodeltype','mlprog'] and value:
|
|
27
|
+
if value == True: value='S'
|
|
28
|
+
if value.lower() in mlatom_alias:
|
|
29
|
+
from interface_MLatomF import printHelp
|
|
30
|
+
printHelp()
|
|
31
|
+
overview=False
|
|
32
|
+
elif value.lower() in ani_alias:
|
|
33
|
+
from interfaces.TorchANI.interface_TorchANI import printHelp
|
|
34
|
+
printHelp()
|
|
35
|
+
overview=False
|
|
36
|
+
elif value.lower() in gap_alias:
|
|
37
|
+
from interfaces.GAP.interface_GAP import printHelp
|
|
38
|
+
printHelp()
|
|
39
|
+
overview=False
|
|
40
|
+
elif value.lower() in sgdml_alias:
|
|
41
|
+
from interfaces.sGDML.interface_sGDML import printHelp
|
|
42
|
+
printHelp()
|
|
43
|
+
overview=False
|
|
44
|
+
elif value.lower() in deepmd_alias:
|
|
45
|
+
from interfaces.DeePMDkit.interface_DeePMDkit import printHelp
|
|
46
|
+
printHelp()
|
|
47
|
+
overview=False
|
|
48
|
+
elif value.lower() in physnet_alias:
|
|
49
|
+
from interfaces.PhysNet.interface_PhysNet import printHelp
|
|
50
|
+
printHelp()
|
|
51
|
+
overview=False
|
|
52
|
+
else:
|
|
53
|
+
print(cls.Default_MLprog_type)
|
|
54
|
+
overview=False
|
|
55
|
+
if overview:
|
|
56
|
+
print(cls.help_text['overview'])
|
|
57
|
+
|
|
58
|
+
print(' %s ' % ('='*78))
|
|
59
|
+
print(time.strftime(" MLatom terminated on %d.%m.%Y at %H:%M:%S", time.localtime()))
|
|
60
|
+
print(' %s ' % ('='*78))
|
|
61
|
+
sys.stdout.flush()
|
|
62
|
+
|
|
63
|
+
molDescriptorDoc = '''
|
|
64
|
+
Optional arguments specifying descriptor:
|
|
65
|
+
molDescriptor=S molecular descriptor S
|
|
66
|
+
RE [default] vector {Req/R}, where R is internuclear distance
|
|
67
|
+
CM Coulomb matrix
|
|
68
|
+
molDescrType=S type S of molecular descriptor
|
|
69
|
+
sorted default for molDescrType=CM
|
|
70
|
+
sort by:
|
|
71
|
+
norms of CM matrix (for molDescrType=CM)
|
|
72
|
+
nuclear repulsions (for molDescrType=RE)
|
|
73
|
+
unsorted default for molDescrType=RE
|
|
74
|
+
permuted molecular descriptor with all atom permutations
|
|
75
|
+
|
|
76
|
+
If molDescrType=sorted requested, additional output can be requested:
|
|
77
|
+
XYZsortedFileOut=S file S with sorted XYZ coordinates, only works
|
|
78
|
+
for molDescrType=RE molDescrType=sorted
|
|
79
|
+
|
|
80
|
+
If molDescrType=permuted requested, at least one of the arguments needed:
|
|
81
|
+
permInvGroups=S permutationally invariant groups S
|
|
82
|
+
e.g. for water dimer permInvGroups=1,2,3-4,5,6
|
|
83
|
+
permute water molecules (atoms 1,2,3 and 5,6,7)
|
|
84
|
+
permInvNuclei=S permutationally invariant nuclei S
|
|
85
|
+
e.g.permInvNuclei=2-3.5-6
|
|
86
|
+
will permute atoms 2,3 and 6,7
|
|
87
|
+
'''
|
|
88
|
+
|
|
89
|
+
Default_MLprog_type='''
|
|
90
|
+
Use of interfaces to ML programs
|
|
91
|
+
|
|
92
|
+
Arguments:
|
|
93
|
+
MLprog=S ML program S
|
|
94
|
+
or
|
|
95
|
+
MLmodelType=S ML model type S
|
|
96
|
+
|
|
97
|
+
Supported ML model types and default programs:
|
|
98
|
+
|
|
99
|
+
+-------------+----------------+
|
|
100
|
+
| MLmodelType | default MLprog |
|
|
101
|
+
+-------------+----------------+
|
|
102
|
+
| KREG | MLatomF |
|
|
103
|
+
+-------------+----------------+
|
|
104
|
+
| sGDML | sGDML |
|
|
105
|
+
+-------------+----------- ----+
|
|
106
|
+
| GAP-SOAP | GAP |
|
|
107
|
+
+-------------+----------------+
|
|
108
|
+
| PhysNet | PhysNet |
|
|
109
|
+
+-------------+----------------+
|
|
110
|
+
| DeepPot-SE | DeePMD-kit |
|
|
111
|
+
+-------------+----------------+
|
|
112
|
+
| ANI | TorchANI |
|
|
113
|
+
+-------------+----------------+
|
|
114
|
+
|
|
115
|
+
Supported interfaces with default and tested ML model types:
|
|
116
|
+
|
|
117
|
+
+------------+----------------------+
|
|
118
|
+
| MLprog | MLmodelType |
|
|
119
|
+
+------------+----------------------+
|
|
120
|
+
| MLatomF | KREG [default] |
|
|
121
|
+
| | see |
|
|
122
|
+
| | MLatom.py KRR help |
|
|
123
|
+
+------------+----------------------+
|
|
124
|
+
| sGDML | sGDML [default] |
|
|
125
|
+
| | GDML |
|
|
126
|
+
+------------+----------------------+
|
|
127
|
+
| GAP | GAP-SOAP |
|
|
128
|
+
+------------+----------------------+
|
|
129
|
+
| PhysNet | PhysNet |
|
|
130
|
+
+------------+----------------------+
|
|
131
|
+
| DeePMD-kit | DeepPot-SE [default] |
|
|
132
|
+
| | DPMD |
|
|
133
|
+
+------------+----------------------+
|
|
134
|
+
| TorchANI | ANI [default] |
|
|
135
|
+
+------------+----------------------+
|
|
136
|
+
|
|
137
|
+
See interface's help for more details, e.g.
|
|
138
|
+
MLatom.py MLprog=TorchANI help
|
|
139
|
+
'''
|
|
140
|
+
|
|
141
|
+
help_text={
|
|
142
|
+
'overview':'''
|
|
143
|
+
Usage:
|
|
144
|
+
MLatom.py [options]
|
|
145
|
+
|
|
146
|
+
Getting help:
|
|
147
|
+
MLatom.py help print this help and exit
|
|
148
|
+
MLatom.py [option] help print help for [option] and exit
|
|
149
|
+
e.g. MLatom.py useMLmodel help
|
|
150
|
+
|
|
151
|
+
Options:
|
|
152
|
+
ML tasks:
|
|
153
|
+
useMLmodel use existing ML model
|
|
154
|
+
createMLmodel create and save ML model
|
|
155
|
+
estAccMLmodel estimate accuracy of ML model
|
|
156
|
+
deltaLearn use delta-learning
|
|
157
|
+
selfCorrect use self-correcting ML
|
|
158
|
+
learningCurve generate learning curve
|
|
159
|
+
crossSection simulate absorption spectrum
|
|
160
|
+
|
|
161
|
+
Data set tasks:
|
|
162
|
+
XYZ2X convert XYZ coordinates into descriptor X
|
|
163
|
+
analyze analyze data sets
|
|
164
|
+
sample sample data points from a data set
|
|
165
|
+
slice slice data set
|
|
166
|
+
sampleFromSlices sample from each slice
|
|
167
|
+
mergeSlices merge indices from slices
|
|
168
|
+
|
|
169
|
+
Multithreading:
|
|
170
|
+
nthreads=N set number of threads (N)
|
|
171
|
+
|
|
172
|
+
Example:
|
|
173
|
+
MLatom.py createMLmodel XYZfile=CH3Cl.xyz Yfile=en.dat MLmodelOut=CH3Cl.unf
|
|
174
|
+
''',
|
|
175
|
+
'useMLmodel':'''
|
|
176
|
+
Use existing ML model
|
|
177
|
+
|
|
178
|
+
Usage: MLatom.py useMLmodel [arguments]
|
|
179
|
+
|
|
180
|
+
Arguments:
|
|
181
|
+
Input file options:
|
|
182
|
+
MLmodelIn=S file S with ML model
|
|
183
|
+
MLprog=S only required for third-party programs. See
|
|
184
|
+
MLatom.py MLprog help
|
|
185
|
+
|
|
186
|
+
XYZfile=S file S with XYZ coordinates
|
|
187
|
+
or
|
|
188
|
+
XfileIn=S file S with input vectors X
|
|
189
|
+
|
|
190
|
+
Output file options (at least one of these arguments is required):
|
|
191
|
+
YestFile=S file S with estimated Y values
|
|
192
|
+
YgradEstFile=S file S with estimated gradients
|
|
193
|
+
YgradXYZestFile=S file S with estimated XYZ gradients
|
|
194
|
+
|
|
195
|
+
Example:
|
|
196
|
+
MLatom.py useMLmodel MLmodelIn=CH3Cl.unf XYZfile=CH3Cl.xyz YestFile=MLen.dat
|
|
197
|
+
''',
|
|
198
|
+
'createMLmodel':'''
|
|
199
|
+
Create and save ML model
|
|
200
|
+
|
|
201
|
+
Usage: MLatom.py createMLmodel [arguments]
|
|
202
|
+
|
|
203
|
+
Required arguments:
|
|
204
|
+
Input files:
|
|
205
|
+
XYZfile=S file S with XYZ coordinates
|
|
206
|
+
or
|
|
207
|
+
XfileIn=S file S with input vectors X
|
|
208
|
+
|
|
209
|
+
Yfile=S file S with reference values
|
|
210
|
+
and/or
|
|
211
|
+
YgradXYZfile=S file S with reference XYZ gradients
|
|
212
|
+
|
|
213
|
+
Output files:
|
|
214
|
+
MLmodelOut=S file S with ML model
|
|
215
|
+
|
|
216
|
+
Optional output files:
|
|
217
|
+
XfileOut=S file S with X values
|
|
218
|
+
XYZsortedFileOut=S file S with sorted XYZ coordinates
|
|
219
|
+
only works for
|
|
220
|
+
molDescrType=RE molDescrType=sorted
|
|
221
|
+
YestFile=S file S with estimated Y values
|
|
222
|
+
YgradEstFile=S file S with estimated gradients
|
|
223
|
+
YgradXYZestFile=S file S with estimated XYZ gradients
|
|
224
|
+
|
|
225
|
+
KREG model with unsorted RE descriptor is trained by default
|
|
226
|
+
Default hyperparameters sigma=100.0 and lambda=0.0 are used
|
|
227
|
+
|
|
228
|
+
To train ML model with third-party program, see:
|
|
229
|
+
MLatom.py MLprog help to list available interfaces and
|
|
230
|
+
default ML models
|
|
231
|
+
and
|
|
232
|
+
MLatom.py MLprog=S help for specific help of interface S
|
|
233
|
+
|
|
234
|
+
To train another KRR model with MLatomF, see:
|
|
235
|
+
MLatom.py KRR help
|
|
236
|
+
|
|
237
|
+
Any hyperparameters can be optimized with the hyperopt package, see:
|
|
238
|
+
MLatom.py hyperopt help
|
|
239
|
+
|
|
240
|
+
To optimize hyperparameters, the training set should be split into the
|
|
241
|
+
sub-training and validation sets, see:
|
|
242
|
+
MLatom.py sample help
|
|
243
|
+
Additional optional arguments:
|
|
244
|
+
sampling=user-defined reads in indices for the sub-training and
|
|
245
|
+
validation sets from files defined by arguments
|
|
246
|
+
iSubtrainIn=S file S with indices of sub-training points
|
|
247
|
+
iValidateIn=S file S with indices of validation points
|
|
248
|
+
iCVoptPrefIn=S prefix S of files with indices for CVopt
|
|
249
|
+
|
|
250
|
+
Example:
|
|
251
|
+
MLatom.py createMLmodel XYZfile=CH3Cl.xyz Yfile=en.dat MLmodelOut=CH3Cl.unf
|
|
252
|
+
''',
|
|
253
|
+
"estAccMLmodel":'''
|
|
254
|
+
Estimate accuracy of ML model
|
|
255
|
+
|
|
256
|
+
Usage: MLatom.py estAccMLmodel [arguments]
|
|
257
|
+
|
|
258
|
+
estAccMLmodel task estimates accuracy of created ML models, thus it can
|
|
259
|
+
take the same arguments as createMLmodel task, see:
|
|
260
|
+
MLatom.py createMLmodel help
|
|
261
|
+
with exception that MLmodelOut=S argument is optional
|
|
262
|
+
|
|
263
|
+
To estimate accuracy, the data set should be split into the
|
|
264
|
+
training and validation sets, see:
|
|
265
|
+
MLatom.py sample help
|
|
266
|
+
Additional optional arguments:
|
|
267
|
+
sampling=user-defined reads in indices for the training and test sets
|
|
268
|
+
from files defined by arguments
|
|
269
|
+
iTrainIn=S file S with indices of training points
|
|
270
|
+
iTestIn=S file S with indices of test points
|
|
271
|
+
iCVtestPrefIn=S prefix S of files with indices for CVtest
|
|
272
|
+
MLmodelIn=S file S with ML model
|
|
273
|
+
|
|
274
|
+
Example:
|
|
275
|
+
MLatom.py estAccMLmodel XYZfile=CH3Cl.xyz Yfile=en.dat
|
|
276
|
+
''',
|
|
277
|
+
'deltaLearn':'''
|
|
278
|
+
Use delta-learning
|
|
279
|
+
|
|
280
|
+
Usage: MLatom.py deltaLearn [arguments]
|
|
281
|
+
|
|
282
|
+
Arguments:
|
|
283
|
+
Yb=S file with data obtained with baseline method
|
|
284
|
+
Yt=S file with data obtained with target method
|
|
285
|
+
YestT=S file with ML estimations of target method
|
|
286
|
+
YestFile=S file with ML corrections to baseline method
|
|
287
|
+
|
|
288
|
+
delta-learning should be used with one of the following tasks, see:
|
|
289
|
+
MLatom.py useMLmodel help
|
|
290
|
+
MLatom.py createMLmodel help
|
|
291
|
+
MLatom.py estAccMLmodel help
|
|
292
|
+
|
|
293
|
+
Example:
|
|
294
|
+
MLatom.py estAccMLmodel deltaLearn XfileIn=x.dat Yb=UHF.dat \\
|
|
295
|
+
Yt=FCI.dat YestT=D-ML.dat YestFile=corr_ML.dat
|
|
296
|
+
''',
|
|
297
|
+
'selfCorrect':'''
|
|
298
|
+
Use self-correcting ML
|
|
299
|
+
|
|
300
|
+
Usage: MLatom.py selfCorrect [arguments]
|
|
301
|
+
|
|
302
|
+
Currently works only with four layers and MLatomF
|
|
303
|
+
Self-correction should be used with one of the following tasks, see:
|
|
304
|
+
MLatom.py useMLmodel help
|
|
305
|
+
MLatom.py createMLmodel help
|
|
306
|
+
MLatom.py estAccMLmodel help
|
|
307
|
+
|
|
308
|
+
Example:
|
|
309
|
+
MLatom.py estAccMLmodel selfcorrect XYZfile=xyz.dat Yfile=y.dat
|
|
310
|
+
''',
|
|
311
|
+
"learningCurve":'''
|
|
312
|
+
Generate learning curve
|
|
313
|
+
|
|
314
|
+
Usage: MLatom.py learningCurve [arguments]
|
|
315
|
+
|
|
316
|
+
Required arguments:
|
|
317
|
+
lcNtrains=N,N,N,...,N training set sizes
|
|
318
|
+
Optional arguments:
|
|
319
|
+
lcNrepeats=N,N,N,...,N numbers of repeats for each Ntrain
|
|
320
|
+
or
|
|
321
|
+
=N number of repeats for all Ntrains
|
|
322
|
+
[3 repeats default]
|
|
323
|
+
|
|
324
|
+
Output files in directory learningCurve:
|
|
325
|
+
results.json JSON database file with all results
|
|
326
|
+
lcy.csv CSV database file with results for values
|
|
327
|
+
lcygradxyz.csv CSV database file with results for XYZ gradients
|
|
328
|
+
lctimetrain.csv CSV database file with training timings
|
|
329
|
+
lctimepredict.csv CSV database file with prediction timings
|
|
330
|
+
|
|
331
|
+
learningCurve task also requires arguments used in estAccMLmodel task, see:
|
|
332
|
+
MLatom.py estAccMLmodel help
|
|
333
|
+
|
|
334
|
+
Example:
|
|
335
|
+
MLatom.py learningCurve XYZfile=xyz.dat Yfile=en.dat \\
|
|
336
|
+
lcNtrains=100,1000,10000 lcNrepeats=32
|
|
337
|
+
''',
|
|
338
|
+
'crossSection':'''
|
|
339
|
+
Simulate absorption cross-section using ML-NEA (nuclear ensemble approach)
|
|
340
|
+
|
|
341
|
+
Usage:
|
|
342
|
+
MLatom.py crossSection [arguments]
|
|
343
|
+
|
|
344
|
+
Optional arguments:
|
|
345
|
+
nExcitations=N number of excited states [3 by default]
|
|
346
|
+
nQMpoints=N number of QM calculations
|
|
347
|
+
[determined iteratively by default]
|
|
348
|
+
plotQCNEA plot QC-NEA cross section
|
|
349
|
+
deltaQCNEA=float set broadening parameter of QC-NEA cross section
|
|
350
|
+
plotQCSPC plot single point convolution cross section
|
|
351
|
+
|
|
352
|
+
Advanced arguments:
|
|
353
|
+
nMaxPoints=N maximum number of QC calculations
|
|
354
|
+
in the iterative procedure [10000 by default]
|
|
355
|
+
nNEpoints=N number of nuclear ensemble points
|
|
356
|
+
[50000 by default]
|
|
357
|
+
|
|
358
|
+
Environment settings:
|
|
359
|
+
$NX Newton-X environment
|
|
360
|
+
In addition, Gaussian program environment should be setup
|
|
361
|
+
|
|
362
|
+
Required input and data set files
|
|
363
|
+
gaussian_optfreq.com input file for optimization and frequency
|
|
364
|
+
calculations with Gaussian program
|
|
365
|
+
gaussian_ef.com template input file for excited-state QC
|
|
366
|
+
calculations with Gaussian program
|
|
367
|
+
or
|
|
368
|
+
eq.xyz file with optimized geometry
|
|
369
|
+
nea_geoms.xyz file with all geometries in nuclear ensemble
|
|
370
|
+
|
|
371
|
+
Optional input data files:
|
|
372
|
+
E[i].dat files with excitation energies for excitation i
|
|
373
|
+
f[i].dat files with oscillator strengths for excitation i
|
|
374
|
+
cross-section_ref.dat reference cross section spectrum
|
|
375
|
+
|
|
376
|
+
Output files in directory cross-section:
|
|
377
|
+
cross-section_ml-nea.dat ML-NEA cross section
|
|
378
|
+
cross-section_qc-nea.dat QC-NEA cross section
|
|
379
|
+
cross-section_spc.dat single point convolution cross section
|
|
380
|
+
plot.png cross section plots
|
|
381
|
+
|
|
382
|
+
Cite ML-NEA:
|
|
383
|
+
B.-X. Xue, M. Barbatti, P. O. Dral, J. Phys. Chem. A 2020, 124, 7199.
|
|
384
|
+
DOI: 10.1021/acs.jpca.0c05310
|
|
385
|
+
|
|
386
|
+
Please also cite Newton-X (and Gaussian)
|
|
387
|
+
''',
|
|
388
|
+
'XYZ2X':('''
|
|
389
|
+
Convert XYZ coordinates into descriptor X
|
|
390
|
+
|
|
391
|
+
Usage:
|
|
392
|
+
MLatom.py XYZ2X [arguments]
|
|
393
|
+
|
|
394
|
+
Required arguments:
|
|
395
|
+
MLmodelIn=S file S with ML model
|
|
396
|
+
XYZfile=S file S with XYZ coordinates
|
|
397
|
+
XfileOut=S file S with X values
|
|
398
|
+
''' +
|
|
399
|
+
molDescriptorDoc
|
|
400
|
+
+
|
|
401
|
+
'''
|
|
402
|
+
Example:
|
|
403
|
+
MLatom.py XYZ2X XYZfile=CH3Cl.xyz XfileOut=CH3Cl.x
|
|
404
|
+
'''),
|
|
405
|
+
'analyze':'''
|
|
406
|
+
Analyze data sets
|
|
407
|
+
|
|
408
|
+
Usage: MLatom.py analyze [arguments]
|
|
409
|
+
|
|
410
|
+
Arguments:
|
|
411
|
+
For reference data (at least one of these arguments is required):
|
|
412
|
+
Yfile=S file S with values
|
|
413
|
+
Ygrad=S file S with gradients
|
|
414
|
+
YgradXYZfile=S file S with gradients in XYZ coordinates
|
|
415
|
+
|
|
416
|
+
For estimated data:
|
|
417
|
+
YestFile=S file S with estimated Y values
|
|
418
|
+
YgradEstFile=S file S with estimated gradients
|
|
419
|
+
YgradXYZestFile=S file S with estimated XYZ gradients
|
|
420
|
+
|
|
421
|
+
Example:
|
|
422
|
+
MLatom.py analyze Yfile=en.dat YestFile=enest.dat
|
|
423
|
+
''',
|
|
424
|
+
'sample':'''
|
|
425
|
+
Sample data points from a data set
|
|
426
|
+
|
|
427
|
+
Usage:
|
|
428
|
+
MLatom.py sample [arguments]
|
|
429
|
+
|
|
430
|
+
Required arguments:
|
|
431
|
+
Data set file
|
|
432
|
+
XYZfile=S file S with XYZ coordinates
|
|
433
|
+
or
|
|
434
|
+
XfileIn=S file S with input vectors X
|
|
435
|
+
|
|
436
|
+
Splitting arguments (at least one is required):
|
|
437
|
+
Splitting the data set into the sub-sets:
|
|
438
|
+
iTrainOut=S file S with indices of training points
|
|
439
|
+
iTestOut=S file S with indices of test points
|
|
440
|
+
iSubtrainOut=S file S with indices of sub-training points
|
|
441
|
+
iValidateOut=S file S with indices of validation points
|
|
442
|
+
|
|
443
|
+
Cross-validation for testing:
|
|
444
|
+
CVtest CV task with optional arguments:
|
|
445
|
+
NcvTestFolds=N sets number of folds to N [5 by default]
|
|
446
|
+
LOOtest leave-one-out cross-validation
|
|
447
|
+
iCVtestPrefOut=S prefix S of files with indices for CVtest
|
|
448
|
+
Cross-validation for hyperparameter optimization:
|
|
449
|
+
CVopt CV task with optional arguments:
|
|
450
|
+
NcvOptFolds=N sets number of folds to N [5 by default]
|
|
451
|
+
LOOopt leave-one-out cross-validation
|
|
452
|
+
iCVoptPrefOut=S prefix S of files with indices for CVopt
|
|
453
|
+
|
|
454
|
+
Optional arguments:
|
|
455
|
+
sampling=S type S of data set sampling into splits
|
|
456
|
+
random [default] random sampling
|
|
457
|
+
none simply split unshuffled data set into
|
|
458
|
+
the training and test sets (in this order)
|
|
459
|
+
(and sub-training and validation sets)
|
|
460
|
+
structure-based structure-based sampling
|
|
461
|
+
farthest-point farthest-point traversal iterative procedure
|
|
462
|
+
Nuse=N N first entries of the data set file to be used
|
|
463
|
+
Ntrain=R number of the training points
|
|
464
|
+
[0.8, i.e. 80% of the data set, by default]
|
|
465
|
+
Ntest=R number of the test points
|
|
466
|
+
[remainder of data set, by default]
|
|
467
|
+
Nsubtrain=R number of the sub-training points
|
|
468
|
+
[0.8, 80% of the training set, by default]
|
|
469
|
+
Nvalidate=R number of the validation points
|
|
470
|
+
[remainder of the training set, by default]
|
|
471
|
+
Note: Number of indices R can either be positive integer or a fraction of 1.
|
|
472
|
+
R entries for integer R >= 1
|
|
473
|
+
fraction of the entire data set for 0<R<1
|
|
474
|
+
|
|
475
|
+
Example:
|
|
476
|
+
MLatom.py sample sampling=structure-based XYZfile=CH3Cl.xyz Ntrain=1000 \\
|
|
477
|
+
Ntest=10000 iTrainOut=itrain.dat iTestOut=itest.dat
|
|
478
|
+
''',
|
|
479
|
+
'slice':'''
|
|
480
|
+
Slice data set
|
|
481
|
+
|
|
482
|
+
Usage:
|
|
483
|
+
MLatom.py slice [arguments]
|
|
484
|
+
|
|
485
|
+
Required arguments:
|
|
486
|
+
XfileIn=S file S with input vectors X
|
|
487
|
+
eqXfileIn=S file S with input vector for equilibrium geometry
|
|
488
|
+
|
|
489
|
+
Optional arguments:
|
|
490
|
+
Nslices=N number of slices [3 by default]
|
|
491
|
+
|
|
492
|
+
Example:
|
|
493
|
+
MLatom.py slice Nslices=3 XfileIn=x_sorted.dat eqXfileIn=eq.x
|
|
494
|
+
|
|
495
|
+
''',
|
|
496
|
+
'sampleFromSlices':'''
|
|
497
|
+
Sample from each slice
|
|
498
|
+
|
|
499
|
+
Usage:
|
|
500
|
+
MLatom.py sampleFromSlices [arguments]
|
|
501
|
+
|
|
502
|
+
Required argument:
|
|
503
|
+
Ntrain=N total integer number N of training points
|
|
504
|
+
from all slices
|
|
505
|
+
|
|
506
|
+
Optional argument:
|
|
507
|
+
Nslices=N number of slices [3 by default]
|
|
508
|
+
|
|
509
|
+
Example:
|
|
510
|
+
MLatom.py sampleFromSlices Nslices=3 sampling=structure-based Ntrain=4480
|
|
511
|
+
''',
|
|
512
|
+
'mergeSlices':'''
|
|
513
|
+
Merge indices from slices
|
|
514
|
+
|
|
515
|
+
Usage:
|
|
516
|
+
MLatom.py mergeSlices [arguments]
|
|
517
|
+
|
|
518
|
+
Required argument:
|
|
519
|
+
Ntrain=N total integer number N of training points
|
|
520
|
+
from all slices
|
|
521
|
+
|
|
522
|
+
Optional argument:
|
|
523
|
+
Nslices=N number of slices [3 by default]
|
|
524
|
+
|
|
525
|
+
Example:
|
|
526
|
+
MLatom.py mlatom mergeSlices Nslices=3 Ntrain=4480
|
|
527
|
+
''',
|
|
528
|
+
"KRR":'''
|
|
529
|
+
Kernel ridge regression (KRR) calculations with MLatomF
|
|
530
|
+
|
|
531
|
+
Optional arguments:
|
|
532
|
+
kernel=S kernel function type S
|
|
533
|
+
Gaussian [default]
|
|
534
|
+
Laplacian
|
|
535
|
+
exponential
|
|
536
|
+
Matern
|
|
537
|
+
permInvKernel permutationally invariant kernel, sub-option:
|
|
538
|
+
Nperm=N number of permutations N (with XfileIn argument)
|
|
539
|
+
molDescrType=permuted (with XYZfile argument, see below)
|
|
540
|
+
lambda=R regularization hyperparameter R [0 by default]
|
|
541
|
+
opt requests optimization of lambda on a log grid
|
|
542
|
+
NlgLambda=N N points on a logarithmic grid
|
|
543
|
+
[6 by default]
|
|
544
|
+
lgLambdaL=R lowest value of log2(lambda) [-16.0 by default]
|
|
545
|
+
lgLambdaH=R highest value of log2(lambda) [ -6.0 by default]
|
|
546
|
+
sigma=S length scale
|
|
547
|
+
[default values: 100 (Gaussian & Matern)
|
|
548
|
+
800 (Laplacian & exponential)]
|
|
549
|
+
opt requests optimization of sigma on a log grid
|
|
550
|
+
NlgSigma=N N points on a logarithmic grid
|
|
551
|
+
[11 by default]
|
|
552
|
+
lgSigmaL=R lowest value of log2(lambda)
|
|
553
|
+
[default values: 2.0 (Gaussian & Matern)
|
|
554
|
+
5.0 (Laplacian & exponential)]
|
|
555
|
+
lgSigmaH=R highest value of log2(lambda)
|
|
556
|
+
[default values: 9.0 (Gaussian & Matern)
|
|
557
|
+
12.0 (Laplacian & exponential)]
|
|
558
|
+
matDecomp=S type of matrix decomposition
|
|
559
|
+
Cholesky [default]
|
|
560
|
+
LU
|
|
561
|
+
Bunch-Kaufman
|
|
562
|
+
invMatrix invert matrix
|
|
563
|
+
refine refine solution matrix
|
|
564
|
+
on-the-fly on-the-fly calculation of kernel
|
|
565
|
+
matrix elements for validation,
|
|
566
|
+
by default it is false and those
|
|
567
|
+
elements are stored
|
|
568
|
+
benchmark additional output for benchmarking
|
|
569
|
+
debug additional output for debugging
|
|
570
|
+
|
|
571
|
+
Additional arguments for hyperparameter optimization on a log grid:
|
|
572
|
+
minimizeError=S type S of error to minimize
|
|
573
|
+
RMSE root-mean-square error [default]
|
|
574
|
+
MAE mean absolute error
|
|
575
|
+
lgOptDepth=N depth of log grid optimization N [3 by default]
|
|
576
|
+
''' +
|
|
577
|
+
molDescriptorDoc +
|
|
578
|
+
'''
|
|
579
|
+
Example:
|
|
580
|
+
MLatom.py createMLmodel XYZfile=CH3Cl.xyz Yfile=en.dat \\
|
|
581
|
+
MLmodelOut=CH3Cl.unf sigma=opt kernel=Matern
|
|
582
|
+
''',
|
|
583
|
+
"hyperopt":'''
|
|
584
|
+
Hyperparameter optimization with the hyperopt package
|
|
585
|
+
For now, only Tree-Structured Parzen Estimator algorithm is supported
|
|
586
|
+
|
|
587
|
+
Usage: substitute numeric value(s) with hyperopt.xx()
|
|
588
|
+
|
|
589
|
+
Arguments for hyperopt.xx():
|
|
590
|
+
hyperopt.uniform(lb,ub) linear search space from lb to ub
|
|
591
|
+
hyperopt.loguniform(lb,ub) logarithmic search space, base 2
|
|
592
|
+
hyperopt.quniform(lb,ub,q) discrete linear space, rounded by q
|
|
593
|
+
lb is lower bound, ub is upper bound
|
|
594
|
+
|
|
595
|
+
Arguments:
|
|
596
|
+
hyperopt.max_evals=N max number of search attempts [8 by default]
|
|
597
|
+
hyperopt.losstype=S type of loss used in optimization
|
|
598
|
+
geomean [default] geometric mean
|
|
599
|
+
weighted weight for gradients, defined by
|
|
600
|
+
hyperopt.w_grad=R [0.1 by default]
|
|
601
|
+
|
|
602
|
+
Cite hyperopt:
|
|
603
|
+
J. Bergstra, D. Yamins, D. D. Cox, Making a Science of Model Search:
|
|
604
|
+
Hyperparameter Optimization in Hundreds of Dimensions for Vision
|
|
605
|
+
Architectures.
|
|
606
|
+
Proceedings of the 30th International Conference on Machine Learning
|
|
607
|
+
(ICML 2013), Vol. 28, JMLR.org, Atlanta, GA, USA, 2013, pp. I-115
|
|
608
|
+
|
|
609
|
+
Cite Tree-Structured Parzen Estimator algorithm:
|
|
610
|
+
J. Bergstra, R. Bardenet, Y. Bengio, B. Kegl,
|
|
611
|
+
Algorithms for Hyper-Parameter Optimization.
|
|
612
|
+
In Advances in Neural Information Processing Systems, Vol. 24.
|
|
613
|
+
Eds.: J. Shawe-Taylor, R. Zemel, P. Bartlett, F. Pereira, K. Q. Weinberger,
|
|
614
|
+
Curan Associates, Inc., 2011
|
|
615
|
+
|
|
616
|
+
Example:
|
|
617
|
+
MLatom.py estAccMLmodel XYZfile=CH3Cl.xyz Yfile=en.dat \\
|
|
618
|
+
sigma=hyperopt.loguniform(4,20)
|
|
619
|
+
'''
|
|
620
|
+
}
|
MLatom/header.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import sys,os
|
|
3
|
+
|
|
4
|
+
def printHeader(args):
|
|
5
|
+
with open(os.path.dirname(__file__)+'/ref.json','r') as f:
|
|
6
|
+
refs = json.load(f)
|
|
7
|
+
refItems = {}
|
|
8
|
+
|
|
9
|
+
# ML tasks
|
|
10
|
+
if args.deltaLearn: refItems['delta-learning'] = refs['JCTC2015_DeltaLearning']
|
|
11
|
+
if args.molDescriptor.upper() == 'CM': refItems['Coulomb matrix'] = refs['CM']
|
|
12
|
+
if args.selfCorrect: refItems['cross-section'] = refs['JCP2017_MLCH3Cl']
|
|
13
|
+
if (args.MLprog.lower() == 'mlatomf' or args.MLprog == '') and (args.MLmodelType.lower() == 'kreg' or not args.MLmodelType) and (args.createMLmodel or args.estAccMLmodel or args.XYZ2X):
|
|
14
|
+
if args.XYZfile != '' and (args.molDescriptor.upper() == 'RE' or not args.molDescriptor):
|
|
15
|
+
if args.kernel.lower() == 'gaussian' or args.kernel == '' and not args.XYZ2X:
|
|
16
|
+
refItems['KREG model'] = refs['JCP2017_MLCH3Cl']
|
|
17
|
+
else:
|
|
18
|
+
refItems['RE descriptor'] = refs['JCP2017_MLCH3Cl']
|
|
19
|
+
if (args.MLprog.lower() == 'sgdml' or args.MLmodelType.lower() == 'sgdml' or args.MLmodelType.lower() == 'gdml'):
|
|
20
|
+
refItems['sGDML program'] = refs['sGDMLprog']
|
|
21
|
+
if (args.MLmodelType.lower() == 'sgdml' or args.MLmodelType.lower() == ''):
|
|
22
|
+
refItems['sGDML model'] = refs['sGDMLmodel']
|
|
23
|
+
if (args.MLmodelType.lower() == 'gdml'):
|
|
24
|
+
refItems['GDML model'] = refs['sGDMLmodel']
|
|
25
|
+
if (args.MLprog.lower() in ['torchani','ani'] or args.MLmodelType.lower() == 'ani' or args.MLmodelType.lower() == 'ani-aev'):
|
|
26
|
+
refItems['TorchANI program'] = refs['TorchANI']
|
|
27
|
+
if (args.MLmodelType.lower() == 'ani' or args.MLmodelType.lower() == 'ani-aev' or args.MLmodelType.lower() == ''):
|
|
28
|
+
refItems['ANI model'] = refs['ANI']
|
|
29
|
+
if (args.MLprog.lower() in ['dp','deepmd','deepmd-kit'] or args.MLmodelType.lower() == 'dpmd' or args.MLmodelType.lower() == 'deeppot-se'):
|
|
30
|
+
refItems['DeePMD-kit program'] = refs['DeePMD-kit']
|
|
31
|
+
if (args.MLmodelType.lower() == 'deeppot-se' or args.MLmodelType.lower() == ''):
|
|
32
|
+
refItems['DeepPot-SE model'] = refs['DeepPot-SE']
|
|
33
|
+
if (args.MLmodelType.lower() == 'dpmd'):
|
|
34
|
+
refItems['DPMD model'] = refs['DPMD']
|
|
35
|
+
if (args.MLprog.lower() == 'physnet' or args.MLmodelType.lower() == 'physnet'):
|
|
36
|
+
refItems['PhysNet model & program'] = refs['PhysNet']
|
|
37
|
+
if (args.MLprog.lower() in [ 'gap', 'gap_fit', 'gapfit'] or args.MLmodelType.lower() == 'gap-soap'):
|
|
38
|
+
refItems['GAP model'] = refs['GAP']
|
|
39
|
+
if (args.MLmodelType.lower() == 'gap-soap' or args.MLmodelType.lower() == ''):
|
|
40
|
+
refItems['SOAP descriptor'] = refs['SOAP']
|
|
41
|
+
|
|
42
|
+
if args.crossSection:
|
|
43
|
+
refItems['ML-NEA'] = refs['ML-NEA']
|
|
44
|
+
refItems['NEA'] = refs['NEA']
|
|
45
|
+
refItems['Wigner distribution'] = refs['Wigner']
|
|
46
|
+
refItems['NEWTON-X'] = refs['NEWTON-X']
|
|
47
|
+
|
|
48
|
+
if 'hyperopt' in ' '.join(args.args2pass).lower():
|
|
49
|
+
refItems['hyperopt program'] = refs['hyperopt']
|
|
50
|
+
refItems['Tree-Structured Parzen Estimator algorithm'] = refs['TPE']
|
|
51
|
+
|
|
52
|
+
# Data set tasks
|
|
53
|
+
if args.sampleFromSlices or args.mergeSlices or args.slice: refItems['slicing'] = refs['JCP2017_MLCH3Cl']
|
|
54
|
+
if args.sampling == 'structure-based': refItems['structure-based sampling'] = refs['JCP2017_MLCH3Cl']
|
|
55
|
+
|
|
56
|
+
if len(refItems.keys()) > 0:
|
|
57
|
+
print('\n %s \n' % ('*'*78))
|
|
58
|
+
print(' You are going to use feature(s) listed below. \n Please cite corresponding work(s) in your paper:')
|
|
59
|
+
for key in refItems.keys():
|
|
60
|
+
print('\n %s:'%key)
|
|
61
|
+
refstrs = refItems[key].split('\n')
|
|
62
|
+
for refstr in refstrs:
|
|
63
|
+
print(' %s' % refstr)
|
|
64
|
+
print('\n %s ' % ('*'*78))
|