mlatom 2.0.1__py3.7.egg

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 (67) hide show
  1. EGG-INFO/PKG-INFO +145 -0
  2. EGG-INFO/SOURCES.txt +40 -0
  3. EGG-INFO/dependency_links.txt +1 -0
  4. EGG-INFO/native_libs.txt +1 -0
  5. EGG-INFO/not-zip-safe +1 -0
  6. EGG-INFO/requires.txt +2 -0
  7. EGG-INFO/scripts/MLatomF +12 -0
  8. EGG-INFO/scripts/mlatom +12 -0
  9. EGG-INFO/top_level.txt +1 -0
  10. MLatom/ML_NEA.py +2697 -0
  11. MLatom/MLatom.py +151 -0
  12. MLatom/MLatomF +0 -0
  13. MLatom/MLtasks.py +784 -0
  14. MLatom/__init__.py +0 -0
  15. MLatom/__pycache__/ML_NEA.cpython-37.pyc +0 -0
  16. MLatom/__pycache__/MLatom.cpython-37.pyc +0 -0
  17. MLatom/__pycache__/MLtasks.cpython-37.pyc +0 -0
  18. MLatom/__pycache__/__init__.cpython-37.pyc +0 -0
  19. MLatom/__pycache__/args_class.cpython-37.pyc +0 -0
  20. MLatom/__pycache__/doc.cpython-37.pyc +0 -0
  21. MLatom/__pycache__/header.cpython-37.pyc +0 -0
  22. MLatom/__pycache__/interface_MLatomF.cpython-37.pyc +0 -0
  23. MLatom/__pycache__/sliceData.cpython-37.pyc +0 -0
  24. MLatom/__pycache__/stopper.cpython-37.pyc +0 -0
  25. MLatom/args_class.py +396 -0
  26. MLatom/cs.so +0 -0
  27. MLatom/doc.py +620 -0
  28. MLatom/header.py +64 -0
  29. MLatom/interface_MLatomF.py +87 -0
  30. MLatom/interfaces/DeePMDkit/DP_inference.py +20 -0
  31. MLatom/interfaces/DeePMDkit/__init__.py +0 -0
  32. MLatom/interfaces/DeePMDkit/__pycache__/DP_inference.cpython-37.pyc +0 -0
  33. MLatom/interfaces/DeePMDkit/__pycache__/__init__.cpython-37.pyc +0 -0
  34. MLatom/interfaces/DeePMDkit/__pycache__/interface_DeePMDkit.cpython-37.pyc +0 -0
  35. MLatom/interfaces/DeePMDkit/interface_DeePMDkit.py +327 -0
  36. MLatom/interfaces/DeePMDkit/template.json +70 -0
  37. MLatom/interfaces/GAP/__init__.py +0 -0
  38. MLatom/interfaces/GAP/__pycache__/__init__.cpython-37.pyc +0 -0
  39. MLatom/interfaces/GAP/__pycache__/interface_GAP.cpython-37.pyc +0 -0
  40. MLatom/interfaces/GAP/interface_GAP.py +415 -0
  41. MLatom/interfaces/PhysNet/PhysNet_predict.py +180 -0
  42. MLatom/interfaces/PhysNet/PhysNet_train.py +425 -0
  43. MLatom/interfaces/PhysNet/__init__.py +0 -0
  44. MLatom/interfaces/PhysNet/__pycache__/PhysNet_predict.cpython-37.pyc +0 -0
  45. MLatom/interfaces/PhysNet/__pycache__/PhysNet_train.cpython-37.pyc +0 -0
  46. MLatom/interfaces/PhysNet/__pycache__/__init__.cpython-37.pyc +0 -0
  47. MLatom/interfaces/PhysNet/__pycache__/interface_PhysNet.cpython-37.pyc +0 -0
  48. MLatom/interfaces/PhysNet/interface_PhysNet.py +270 -0
  49. MLatom/interfaces/TorchANI/TorchANI_predict.py +82 -0
  50. MLatom/interfaces/TorchANI/TorchANI_train.py +217 -0
  51. MLatom/interfaces/TorchANI/__init__.py +0 -0
  52. MLatom/interfaces/TorchANI/__pycache__/TorchANI_predict.cpython-37.pyc +0 -0
  53. MLatom/interfaces/TorchANI/__pycache__/TorchANI_train.cpython-37.pyc +0 -0
  54. MLatom/interfaces/TorchANI/__pycache__/__init__.cpython-37.pyc +0 -0
  55. MLatom/interfaces/TorchANI/__pycache__/interface_TorchANI.cpython-37.pyc +0 -0
  56. MLatom/interfaces/TorchANI/interface_TorchANI.py +323 -0
  57. MLatom/interfaces/__init__.py +0 -0
  58. MLatom/interfaces/__pycache__/__init__.cpython-37.pyc +0 -0
  59. MLatom/interfaces/sGDML/__init__.py +0 -0
  60. MLatom/interfaces/sGDML/__pycache__/__init__.cpython-37.pyc +0 -0
  61. MLatom/interfaces/sGDML/__pycache__/interface_sGDML.cpython-37.pyc +0 -0
  62. MLatom/interfaces/sGDML/__pycache__/sgdml_dataset_from_extxyz.cpython-37.pyc +0 -0
  63. MLatom/interfaces/sGDML/interface_sGDML.py +276 -0
  64. MLatom/interfaces/sGDML/sgdml_dataset_from_extxyz.py +199 -0
  65. MLatom/ref.json +23 -0
  66. MLatom/sliceData.py +334 -0
  67. MLatom/stopper.py +17 -0
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env python3
2
+ '''
3
+ !---------------------------------------------------------------------------!
4
+ ! NX_MLatom_interface: Interface between NEWTON-X and MLatom !
5
+ ! Implementations by: Pavlo O. Dral and Fuchun Ge !
6
+ !---------------------------------------------------------------------------!
7
+ '''
8
+
9
+ import sys, os, subprocess, re
10
+ import stopper
11
+ mlatomdir=os.path.dirname(__file__)
12
+ mlatomfbin="%s/MLatomF" % mlatomdir
13
+
14
+ class ifMLatomCls(object):
15
+ @classmethod
16
+ def run(cls, argsMLatomF, shutup=False, cwdpath='.'):
17
+ t_train=0
18
+ t_descr=0
19
+ t_hyperopt=0
20
+ t_finaltrain=0
21
+ t_pred=0
22
+ t_wc=0
23
+ Ntrain=None
24
+ Ntest=None
25
+ rmsedict={}
26
+ yflag=0
27
+ gflag=0
28
+ deadlist=[]
29
+ for arg in argsMLatomF:
30
+ flagmatch = re.search('(^nthreads)|(^hyperopt)|(^setname=)|(^learningcurve$)|(^lcntrains)|(^lcnrepeats)|(^mlmodeltype)|(^mlprog)|(^deltalearn)|(^yb=)|(^yt=)|(^yestt=)|(^nlayers=)|(^selfcorrect)|(^$)', arg.lower(), flags=re.UNICODE | re.MULTILINE | re.DOTALL | re.IGNORECASE)
31
+ if flagmatch:
32
+ deadlist.append(arg)
33
+ for i in deadlist: argsMLatomF.remove(i)
34
+ proc = subprocess.Popen([mlatomfbin] + argsMLatomF, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwdpath)
35
+ for line in iter(proc.stdout.readline, b''):
36
+ readable = line.decode('ascii')
37
+ if 'Descriptor generation time' in readable:
38
+ t_descr = float(readable.split()[-2])
39
+ if 'Hyperparameter optimization time:' in readable:
40
+ t_hyperopt = float(readable.split()[-2])
41
+ if 'Training time' in readable:
42
+ t_finaltrain = float(readable.split()[-2])
43
+ elif 'Training time' in readable:
44
+ t_train += float(readable.split()[2])
45
+ elif 'Validating time' in readable:
46
+ t_train += float(readable.split()[2])
47
+ elif 'Test time' in readable:
48
+ t_pred = float(readable.split()[-2])
49
+ if 'Wall-clock time:' in readable and not 'min' in readable:
50
+ t_wc = float(readable.split()[-2])
51
+ if 'Statistical analysis for' in readable and 'entries in the training set' in readable and Ntrain == None:
52
+ Ntrain = float(readable.split()[3])
53
+ if 'Statistical analysis for' in readable and 'entries in the test set' in readable and Ntest == None:
54
+ Ntest = float(readable.split()[3])
55
+ elif 'Prediction time' in readable:
56
+ t_pred += float(readable.split()[2])
57
+ elif 'Analysis for values' in readable: yflag=1
58
+ elif 'Analysis for gradients in XYZ coordinates' in readable: gflag=1
59
+ elif 'RMSE ='in readable:
60
+ if yflag:
61
+ rmsedict['eRMSE'] = float(readable.split()[2])
62
+ yflag = 0
63
+ if gflag:
64
+ rmsedict['fRMSE'] = float(readable.split()[2])
65
+ gflag = 0
66
+ # if not shutup or '<!>' in readable: print(readable.replace('\n',''))
67
+ print(readable.replace('\n',''))
68
+ proc.stdout.close()
69
+ if Ntrain != None:
70
+ t_train = t_hyperopt + t_finaltrain + t_descr
71
+ if Ntrain == None and Ntest == None:
72
+ t_pred = t_wc
73
+ if Ntrain != None and Ntest != None:
74
+ t_train -= t_descr / (Ntrain + Ntest) * Ntest
75
+ t_pred += t_descr / (Ntrain + Ntest) * Ntest
76
+
77
+ return [t_train, t_pred, rmsedict]
78
+
79
+ def printHelp():
80
+ proc = subprocess.Popen([mlatomfbin] + ['help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
81
+ for line in iter(proc.stdout.readline, b''):
82
+ readable = line.decode('ascii')
83
+ print(readable.rstrip())
84
+
85
+ if __name__ == '__main__':
86
+ print(__doc__)
87
+ ifMLatomCls.run(sys.argv[1:])
@@ -0,0 +1,20 @@
1
+ import deepmd.DeepPot as DP
2
+ import numpy as np
3
+ import sys
4
+
5
+ path, model, enest, gradest = sys.argv[1:5]
6
+ dp = DP(model)
7
+ coord = np.load(path)
8
+ cell = np.repeat(np.diag(64 * np.ones(3)).reshape([1, -1]),len(coord), axis=0)
9
+ with open('type.raw','r') as ff:
10
+ atype=[int(i) for i in ff.readline().split()]
11
+
12
+ e, f, v = dp.eval(coord, cell, atype)
13
+
14
+ line="%d\n\n" % int(coord.shape[1]/3)
15
+ with open(enest,'wb') as ff:
16
+ np.savetxt(ff, e, fmt='%20.12f', delimiter=" ")
17
+ with open(gradest,'wb') as ff:
18
+ for force in f:
19
+ ff.write(line.encode('utf-8'))
20
+ np.savetxt(ff, -1*force, fmt='%20.12f', delimiter=" ")
File without changes
@@ -0,0 +1,327 @@
1
+ #!/usr/bin/python3
2
+ '''
3
+ !---------------------------------------------------------------------------!
4
+ ! Interface_DeePMDkit: Interface between DeePMD-kit and MLatom !
5
+ ! Implementations by: Fuchun Ge !
6
+ !---------------------------------------------------------------------------!
7
+ '''
8
+ import numpy as np
9
+ import os, sys, subprocess, time, shutil, re, math, random, json
10
+ import stopper
11
+ from args_class import ArgsBase
12
+ from args_class import AttributeDict
13
+
14
+ filedir = os.path.dirname(__file__)
15
+
16
+ class Args(ArgsBase):
17
+ def __init__(self):
18
+ super().__init__()
19
+ self.add_default_dict_args([
20
+ 'learningCurve'
21
+ ],
22
+ bool
23
+ )
24
+ self.add_default_dict_args([
25
+ 'xyzfile', 'yfile', 'ygradxyzfile','itrainin','itestin','isubtrainin','ivalidatein','mlmodelin'
26
+ ],
27
+ ""
28
+ )
29
+ self.add_dict_args({
30
+ 'mlmodeltype': 'DeepPot-SE',
31
+ 'mlmodelout': "graph.pb",
32
+ 'sampling': "random",
33
+ 'yestfile': "enest.dat",
34
+ 'ygradxyzestfile': "gradest.dat",
35
+ 'lcNtrains': [],
36
+ 'natom': 0,
37
+ 'atype': []
38
+ })
39
+ self.parse_input_content([
40
+ 'deepmd.earlystopping.threshold=0.0001',
41
+ 'deepmd.earlystopping.patience=60',
42
+ 'deepmd.earlystopping.enable=0',
43
+ 'deepmd.input=%s/template.json'%filedir
44
+ ])
45
+ def parse(self, argsraw):
46
+ self.parse_input_content(argsraw)
47
+ self.argProcess()
48
+
49
+ def argProcess(self):
50
+
51
+ with open(self.xyzfile,'r') as f:
52
+ self.natom = int(f.readline())
53
+ exec('f.readline()')
54
+ self.atype = [f.readline().split()[0] for i in range(self.natom)]
55
+ if not self.mlmodelin:
56
+ self.mlmodelin = self.mlmodelout
57
+
58
+ if self.learningcurve:
59
+ self.lcNtrains = [int(i) for i in str(self.lcNtrains).split(',')]
60
+ if self.deepmd.batch_sizes:
61
+ self.deepmd.batch_sizes = [int(i) for i in self.lcNtrains.split(',')]
62
+ self.deepmd.batch_size = self.deepmd.batch_sizes[self.lcNtrains.index(self.ntrain)]
63
+
64
+ with open(self.deepmd.input, 'r') as f:
65
+ DeePMDCls.deepmdarg= AttributeDict.dict_to_attributedict(json.load(f))
66
+ DeePMDCls.deepmdarg.merge_dict(DeePMDCls.deepmdarg,self.deepmd.data)
67
+ if self.mlmodeltype.lower() in ['dpmd']:
68
+ DeePMDCls.deepmdarg.data['model']['descriptor']['type'] = 'loc_frame'
69
+
70
+ DeePMDCls.deepmdarg.data['training']['set_prefix']='set'
71
+ DeePMDCls.deepmdarg.data['training']['systems']=['./']
72
+ DeePMDCls.deepmdarg.data["model"]["type_map"] = sorted(set(self.atype), key=lambda x: self.atype.index(x))
73
+ if 'decay_rate' in DeePMDCls.deepmdarg.data['learning_rate'].keys():
74
+ DeePMDCls.deepmdarg.data['learning_rate']['stop_lr']=DeePMDCls.deepmdarg.data['learning_rate']['start_lr']*DeePMDCls.deepmdarg.data['learning_rate']['decay_rate']**(DeePMDCls.deepmdarg.data['training']['stop_batch']//DeePMDCls.deepmdarg.data['learning_rate']['decay_steps'])
75
+ if DeePMDCls.deepmdarg.data['model']['descriptor']['type'] != 'loc_frame':
76
+ DeePMDCls.deepmdarg.data['model']['descriptor']['sel'] = [self.natom+1]*len(DeePMDCls.deepmdarg.data["model"]["type_map"])
77
+ else:
78
+ DeePMDCls.deepmdarg.data['model']['descriptor']['sel_a'] = [self.natom+1]*len(DeePMDCls.deepmdarg.data["model"]["type_map"])
79
+ DeePMDCls.deepmdarg.data['model']['descriptor']['sel_r'] = [self.natom+1]*len(DeePMDCls.deepmdarg.data["model"]["type_map"])
80
+ try:
81
+ del DeePMDCls.deepmdarg.data['model']['descriptor']['sel']
82
+ except: pass
83
+
84
+ if not self.ygradxyzfile:
85
+ DeePMDCls.deepmdarg.data['loss']['limit_pref_f']=0
86
+ DeePMDCls.deepmdarg.data['loss']['start_pref_f']=0
87
+ if not self.yfile:
88
+ DeePMDCls.deepmdarg.data['loss']['limit_pref_e']=0
89
+ DeePMDCls.deepmdarg.data['loss']['start_pref_e']=0
90
+
91
+
92
+
93
+ class DeePMDCls(object):
94
+ deepmdarg=AttributeDict()
95
+ @classmethod
96
+ def load(cls):
97
+ loaded=False
98
+ if not loaded:
99
+ try:
100
+ DeePMDdir = os.environ['DeePMDkit']
101
+ except:
102
+ print('please set $DeePMDkit')
103
+ DeePMDbin = DeePMDdir+'/dp'
104
+
105
+ globals()['DeePMDdir'] = DeePMDdir
106
+ globals()['DeePMDbin'] = DeePMDbin
107
+
108
+ loaded=True
109
+ def __init__(self, argsDeePMD = sys.argv[1:]):
110
+ print(' ___________________________________________________________\n\n%s' % __doc__)
111
+
112
+ @classmethod
113
+ def createMLmodel(cls, argsDeePMD, subdatasets):
114
+ cls.load()
115
+ args=Args()
116
+ args.parse(argsDeePMD)
117
+ # data conversion
118
+ print('\n Converting data...\n\n')
119
+ prefix = ''
120
+ if args.learningcurve: prefix = '../'
121
+ cls.convertdata('coord', 'subtrain', prefix+'xyz.dat_subtrain',args)
122
+ cls.convertdata('coord', 'validate', prefix+'xyz.dat_validate',args)
123
+ if args.yfile:
124
+ cls.convertdata('en', 'subtrain', prefix+'y.dat_subtrain',args)
125
+ cls.convertdata('en', 'validate', prefix+'y.dat_validate',args)
126
+ if args.ygradxyzfile:
127
+ cls.convertdata('force', 'subtrain', prefix+'grad.dat_subtrain',args)
128
+ cls.convertdata('force', 'validate', prefix+'grad.dat_validate',args)
129
+ # write dp input json
130
+ with open("deepmdargs.json","w") as f:
131
+ json.dump(iterdict(AttributeDict.normal_dict(cls.deepmdarg)), f, indent=4)
132
+
133
+ if os.path.exists(cls.deepmdarg.data['training']['disp_file']):
134
+ os.system('rm '+ cls.deepmdarg.data['training']['disp_file']+' '+args.mlmodelout)
135
+
136
+ # run dp train
137
+ FNULL = open(os.devnull, 'w')
138
+ starttime = time.time()
139
+ print('\n\n> %s train deepmdargs.json' % DeePMDbin)
140
+ sys.stdout.flush()
141
+
142
+ proc = subprocess.Popen([DeePMDbin,"train","deepmdargs.json"], stdout=subprocess.PIPE ,stderr=FNULL)
143
+ for line in iter(proc.stdout.readline, b''):
144
+ print(line.decode('ascii').replace('\n',''))
145
+ if args.deepmd.earlystopping.enable:
146
+ try:
147
+ lastline=subprocess.check_output(['tail', '-1', cls.deepmdarg.data['training']['disp_file']],stderr=FNULL).split()
148
+ loss = float(lastline[1])
149
+ nbatch = int(lastline[0])
150
+ sys.stdout.flush()
151
+ if earlyStop(nbatch, loss, patience = args.deepmd.earlystopping.earpatience, threshold=args.deepmd.earlystopping.threshold):
152
+ print('met early-stopping conditions')
153
+ proc.terminate()
154
+ except:
155
+ pass
156
+ sys.stdout.flush()
157
+ proc.stdout.close()
158
+
159
+ print('\n ___________________________________________________________\n\n Learning curve:\n')
160
+ sys.stdout.flush()
161
+ os.system('cat '+cls.deepmdarg.data['training']['disp_file'])
162
+ sys.stdout.flush()
163
+ # save MLmodel
164
+ print('\n\n> %s freeze -o %s' % (DeePMDbin, args.mlmodelout))
165
+ sys.stdout.flush()
166
+ subprocess.call([DeePMDbin,"freeze","-o",args.mlmodelout],stdout=FNULL,stderr=FNULL)
167
+ if os.path.exists(args.mlmodelout):
168
+ print('model saved in %s' % args.mlmodelout)
169
+ FNULL.close()
170
+
171
+ endtime = time.time()
172
+ wallclock = endtime - starttime
173
+ return wallclock
174
+
175
+ @classmethod
176
+ def useMLmodel(cls, argsDeePMD, subdatasets):
177
+ cls.load()
178
+ args=Args()
179
+ args.parse(argsDeePMD)
180
+ cls.convertdata('coord', 'test', args.xyzfile, args)
181
+
182
+ starttime = time.time()
183
+
184
+ FNULL = open(os.devnull, 'w')
185
+ subprocess.call([DeePMDdir+"/python", filedir+"/DP_inference.py", 'testset/coord.npy', args.mlmodelin, args.yestfile, args.ygradxyzestfile],stdout=FNULL , stderr=FNULL)
186
+ FNULL.close()
187
+
188
+ # if os.path.exists(args.yestfile) and os.path.exists(args.ygradxyzestfile):
189
+ # print('estimated values saved in '+args.yestfile+' and '+args.ygradxyzestfile)
190
+
191
+ endtime = time.time()
192
+ wallclock = endtime - starttime
193
+ return wallclock
194
+
195
+ @classmethod
196
+ def convertdata(cls, datatype, dataset, filein, args):
197
+
198
+ if dataset=='subtrain':
199
+ outdir = 'set.000'
200
+ elif dataset=='validate':
201
+ outdir = 'set.001'
202
+ elif dataset=='test':
203
+ outdir = 'testset'
204
+
205
+ if not os.path.isdir(outdir):
206
+ os.system('mkdir '+outdir)
207
+
208
+ # convert to coord.npy box.npy type.raw
209
+ if datatype=='coord':
210
+ dic = {cls.deepmdarg.data["model"]["type_map"][i]:i for i in range(len(cls.deepmdarg.data["model"]["type_map"]))}
211
+ index = [dic[i] for i in args.atype]
212
+ with open('type.raw','w') as ff:
213
+ for i in index:
214
+ ff.writelines("%d " % i)
215
+
216
+ with open(filein,'r') as fi:
217
+ data = np.array([])
218
+ for i, line in enumerate(fi):
219
+ if i%(args.natom+2) > 1:
220
+ data = np.append(data,np.array(line.split()[-3:]).astype('float'))
221
+ data = data.reshape(-1,3*args.natom)
222
+
223
+ with open(outdir+'/coord.npy','wb') as fo:
224
+ np.save(fo, data)
225
+
226
+ with open(outdir+'/box.npy','wb') as fo:
227
+ np.save(fo, np.repeat(np.diag(64 * np.ones(3)).reshape([1, -1]),len(data), axis=0))
228
+
229
+ # convert to force.npy
230
+ elif datatype=='force':
231
+ with open(filein,'r') as fi:
232
+ data = np.array([])
233
+ for i, line in enumerate(fi):
234
+ if i%(args.natom+2) > 1:
235
+ data = np.append(data,-1*np.array(line.split()[-3:]).astype('float'))
236
+ data = data.reshape(-1,3*args.natom)
237
+
238
+ with open(outdir+'/force.npy','wb') as fo:
239
+ np.save(fo, data)
240
+
241
+ # conver to energy.npy
242
+ elif datatype=='en':
243
+ with open(filein,'r') as fi:
244
+ data = np.array([])
245
+ for line in fi:
246
+ data = np.append(data,np.array(line).astype('float'))
247
+
248
+ with open(outdir+'/energy.npy','wb') as fo:
249
+ np.save(fo, data)
250
+ # home-made early stopping for dp
251
+ def earlyStop(nbatch, loss, bestloss=[1000], bestbatch=[0], patience = 2, threshold = 1.0001):
252
+ stop = False
253
+ if loss < (1 - threshold)*bestloss[0]:
254
+ bestloss[0] = loss
255
+ bestbatch[0]=nbatch
256
+ if (nbatch - bestbatch[0])/DeePMDCls.deepmdarg.data['training']['disp_freq'] > patience:
257
+ stop = True
258
+ return stop
259
+
260
+ # function for modifying args in dp input json
261
+ def mapdict(dic,arg):
262
+ try:
263
+ key,value=arg.split('.',1)[1].split("=")
264
+ subdic=dic
265
+ for i in key.split(".")[:-1]:
266
+ subdic = subdic[i.lower()]
267
+ #exec 'subdic[key.split(".")[-1].lower()]'
268
+ subdic[key.split(".")[-1].lower()]=json.loads(value)
269
+ except:
270
+ pass
271
+
272
+ def iterdict(d):
273
+ for k, v in d.items():
274
+ if isinstance(v, dict):
275
+ iterdict(v)
276
+ else:
277
+ if type(v) == str:
278
+ if v[0]=='[' and v[-1]==']':
279
+ v=json.loads(v)
280
+ d.update({k: v})
281
+ return d
282
+
283
+ def printHelp():
284
+ helpText = __doc__ + '''
285
+ To use Interface_DeePMDkit, please define environmental variable $DeePMDkit
286
+ to where dp binary is located (e.g "/home/xxx/deepmd-kit-1.2/bin").
287
+
288
+ Arguments with their default values:
289
+ MLprog=DeePMD-kit enables this interface
290
+ MLmodelType=S requests model S
291
+ DeepPot-SE [defaut]
292
+ DPMD
293
+
294
+ deepmd.xxx.xxx=X specify arguments for DeePMD,
295
+ follows DeePMD-kit's json input file structure
296
+ deepmd.training.stop_batch=4000000
297
+ number of batches to be trained before stopping
298
+ deepmd.training.batch_size=32
299
+ size of each batch
300
+ deepmd.learning_rate.start_lr=0.001
301
+ initial learning rate
302
+ deepmd.learning_rate.decay_steps=4000
303
+ number of batches for one decay
304
+ deepmd.learning_rate.decay_rate=0.95
305
+ decay rate of each decay
306
+ deepmd.model.descriptor.rcut=6.0
307
+ cutoff radius for local environment
308
+ deepmd.model.fitting_net.neuron=80,80,80
309
+ NN structure of fitting network
310
+
311
+ deepmd.input=S file S with DeePMD input parameters
312
+ in json format (as a template)
313
+
314
+ Cite DeePMD-kit:
315
+ H. Wang, L. Zhang, J. Han, W. E, Comput. Phys. Commun. 2018, 228, 178
316
+
317
+ Cite DeepPot-SE method, if you use it:
318
+ L.F. Zhang, J.Q. Han, H. Wang, W.A. Saidi, R. Car, W.N. E,
319
+ Adv. Neural. Inf. Process. Syst. 2018, 31, 4436
320
+
321
+ Cite DPMD method, if you use it:
322
+ L. Hang, J. Han, H. Wang, R. Car, W. E, Phys. Rev. Lett. 2018, 120, 143001
323
+ '''
324
+ print(helpText)
325
+
326
+ if __name__ == '__main__':
327
+ DeePMDCls()
@@ -0,0 +1,70 @@
1
+ {
2
+ "model": {
3
+ "descriptor": {
4
+ "type": "se_a",
5
+ "sel": [
6
+ 10,
7
+ 10,
8
+ 10
9
+ ],
10
+ "rcut_smth": 6.3,
11
+ "rcut": 6.5,
12
+ "neuron": [
13
+ 30,
14
+ 60
15
+ ],
16
+ "resnet_dt": false,
17
+ "axis_neuron": 6,
18
+ "seed": 2068583732
19
+ },
20
+ "fitting_net": {
21
+ "n_neuron": [
22
+ 80,
23
+ 80,
24
+ 80
25
+ ],
26
+ "resnet_dt": true,
27
+ "seed": 536382934
28
+ },
29
+ "type_map": [
30
+ "C",
31
+ "H",
32
+ "O"
33
+ ]
34
+ },
35
+ "learning_rate": {
36
+ "type": "exp",
37
+ "start_lr": 0.005,
38
+ "decay_steps": 2000,
39
+ "decay_rate": 0.95
40
+ },
41
+ "loss": {
42
+ "start_pref_e": 0.02,
43
+ "limit_pref_e": 2,
44
+ "start_pref_f": 1000,
45
+ "limit_pref_f": 1,
46
+ "start_pref_v": 0,
47
+ "limit_pref_v": 0
48
+ },
49
+ "training": {
50
+ "systems": [
51
+ "./"
52
+ ],
53
+ "set_prefix": "set",
54
+ "stop_batch": 400000,
55
+ "batch_size": [
56
+ 32
57
+ ],
58
+ "seed": 3652321178,
59
+ "disp_file": "lcurve.out",
60
+ "disp_freq": 2000,
61
+ "numb_test": 10,
62
+ "save_freq": 20000,
63
+ "save_ckpt": "model.ckpt",
64
+ "load_ckpt": "model.ckpt",
65
+ "disp_training": true,
66
+ "time_training": true,
67
+ "profiling": false,
68
+ "profiling_file": "timeline.json"
69
+ }
70
+ }
File without changes