AMBERDictionary.py 52.9 KB
Newer Older
Berk Onat's avatar
Berk Onat committed
1
2
3
4
5
6
7
8
import setup_paths
import numpy as np
import logging
import json
import os
import re
from collections import namedtuple

9
class MetaInfoMap(dict):
Berk Onat's avatar
Berk Onat committed
10
11
    """Map cache values to meta info
    """
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    activeInfo=False
    infoPurpose=None
    defaultValue=None
    nameTranslate=None 
    matchStr=None 
    metaHeader=None 
    metaName=None 
    metaNameTag=None
    metaInfoType=None
    value=None 
    valueSize=None 
    sizeMetaName=None 
    depends=None
    lookupdict=None
    subfunction=None
    activeSections=None
28
    autoSections=False
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

    def __init__(self, *args, **kwargs):
        super(MetaInfoMap, self).__init__(*args, **kwargs)
        for arg in args:
            if isinstance(arg, dict):
                for k, v in arg.items():
                    if k in self:
                        self[k] = v 
        if kwargs:
            for k, v in kwargs.items():
                if k in self:
                    self[k] = v

    def __getattr__(self, attr):
        return self.get(attr)

    def __setattr__(self, key, value):
        self.__setitem__(key, value)

    def __setitem__(self, key, value):
        super(MetaInfoMap, self).__setitem__(key, value)
        self.__dict__.update({key: value})
Berk Onat's avatar
Berk Onat committed
51
52
53
54
55

class FileInfoMap(dict):
    """Map cache values to meta info
    """
    activeInfo=False
56
    infoPurpose=None
Berk Onat's avatar
Berk Onat committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    fileName=None
    fileFormat=None 
    fileSupplied=False
    fileHolder=None
    nameTranslate=None 
    matchStr=None 
    metaHeader=None 
    metaName=None 
    metaNameTag=None
    metaInfoType=None
    value=None 
    valueSize=None 
    sizeMetaName=None 
    depends=None
    lookupdict=None
    subfunction=None
    activeSections=None

    def __init__(self, *args, **kwargs):
        super(FileInfoMap, self).__init__(*args, **kwargs)
        for arg in args:
            if isinstance(arg, dict):
                for k, v in arg.items():
                    if k in self:
                        self[k] = v 
        if kwargs:
            for k, v in kwargs.items():
                if k in self:
                    self[k] = v

    def __getattr__(self, attr):
        return self.get(attr)

    def __setattr__(self, key, value):
        self.__setitem__(key, value)

    def __setitem__(self, key, value):
        super(FileInfoMap, self).__setitem__(key, value)
        self.__dict__.update({key: value})

class MapDictionary(dict):
    """
    Modified from the reference source below:
    https://stackoverflow.com/questions/2352181/how-to-use-a-dot-to-access-members-of-dictionary
    Example:
    m = MapDictionary({'Name': 'mdtraj'}, format='.mdcrd', found=True, list=['Value'])
    """
    def __init__(self, *args, **kwargs):
        super(MapDictionary, self).__init__(*args, **kwargs)
        for arg in args:
            if isinstance(arg, dict):
                for k, v in arg.items():
                    if (isinstance(v, FileInfoMap) or
                        isinstance(v, MetaInfoMap)):
                        if v.nameTranslate:
                            v.metaName = v.nameTranslate(k)
                        else:
                            v.metaName = k
                    v.matchStr = k
116
117
118
119
120
                    metaStr = ''
                    if v.metaHeader:
                        metaStr = metaStr + v.metaHeader + '_'
                    if v.metaNameTag:
                        metaStr = metaStr + v.metaNameTag + '_'
121
122
123
124
                    metaStr = metaStr + v.metaName
                    self[metaStr] = v
                    if metaStr != k:
                        self.pop(k, None)
Berk Onat's avatar
Berk Onat committed
125
126
127
128
129
130
131
132
133

        if kwargs:
            for k, v in kwargs.items():
                if (isinstance(v, FileInfoMap) or
                    isinstance(v, MetaInfoMap)):
                    if v.metaTranslate:
                        v.metaName = v.nameTranslate(k)
                    else:
                        v.metaName = k
134
                v.matchStr = k
135
136
137
138
139
                metaStr = ''
                if v.metaHeader:
                    metaStr = metaStr + v.metaHeader + '_'
                if v.metaNameTag:
                    metaStr = metaStr + v.metaNameTag + '_'
140
141
142
143
                metaStr = metaStr + v.metaName
                self[metaStr] = v
                if metaStr != k:
                    self.pop(k, None)
Berk Onat's avatar
Berk Onat committed
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

    def __getattr__(self, attr):
        return self.get(attr)

    def __setattr__(self, key, value):
        self.__setitem__(key, value)

    def __setitem__(self, key, value):
        super(MapDictionary, self).__setitem__(key, value)
        self.__dict__.update({key: value})

    def __delattr__(self, item):
        self.__delitem__(item)

    def __delitem__(self, key):
        super(MapDictionary, self).__delitem__(key)
        del self.__dict__[key]

    def get_keys(self):
        return [val.metaName for val in self.__dict__.values()]

165
def get_unitDict(keyname):
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
    """ Unit dictionary for convertions

        Unit names will be converted to values.
        When defining units in translator dictionary, 
        the unit names in the dictionary should be used.
        The unit convertion values are written for SI units.
        If you would like to change it, just add another key 
        to the dictionary and change the key at parser base.
        Usage:
           Natively support python language in definitions. 
           You can use any python math operator and function. 
           Moreover, you can use space or - for multiplication 
           and ^ for power of values. 
        Example:
            kilogram/meter^2 can be written as
            kilo-gram/meter^2 or kilo-gram/meter**2
            and will be calculated as
            kilo*gram/meter**2

        For a quick check for AMBER units please see: 
        http://ambermd.org/Questions/units.html
    """
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
    unitDict = {
        "si" : {
            "meter"          : "1.0",
            "kilo"           : "1.0e3",
            "gram"           : "1.0e-3",
            "second"         : "1.0",
            "joule"          : "1.0",
            "newton"         : "1.0",
            "kelvin"         : "1.0",
            "pascal"         : "1.0",
            "coulomb"        : "1.0",
            "volt"           : "1.0",
            "centi"          : "1.0e-2",
            "milli"          : "1.0e-3",
            "micro"          : "1.0e-6",
            "nano"           : "1.0e-9",
            "pico"           : "1.0e-12",
            "femto"          : "1.0e-15",
            "atto"           : "1.0e-18",
            "erg"            : "1.0e-7",
            "dyne"           : "1.0e-5",
            "bar"            : "1.0e-1",
            "angstrom"       : "1.0e-10",
            "kcal"           : "4184.096739614824",
212
            "mol"           : "0.602213737699784e24",
213
214
215
216
217
218
219
220
221
222
223
224
225
226
            "atmosphere"     : "1.01325e5",
            "electron"       : "1.602176565e-19",
            "atomicmassunit" : "1.66054e-27",
            "amu"            : "1.66054e-27",
            "bohr"           : "5.29177249e-11",
            "hartree"        : "4.35974e-18",
            "pascal"         : "1.0",
            }}
    if keyname == "amber":
        resDict = unitDict["si"]
    else:
        resDict = unitDict["si"]
    return resDict

Berk Onat's avatar
Berk Onat committed
227
228
def metaNameConverter(keyName):
    newName = keyName.lower().replace(" ", "").replace("-", "")
229
230
231
232
    newName = newName.replace("(", "").replace(")", "")
    newName = newName.replace("[", "").replace("]", "")
    newName = newName.replace(",", "").replace(".", "")
    newName = newName.replace("\\", "").replace("/", "")
Berk Onat's avatar
Berk Onat committed
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
    return newName

def get_fileListDict():
    """Loads dictionary for file namelist of AMBER.

    Returns:
        the list of defaults file namelists
    """
    # Default topology format of Amber is parm, prmtop file
    # As of Amber 9, default trajectory format of Amber is in binary NetCDF format.
    # The alternative is formatted ASCII (mdcrd) format and the format will be  
    #     determined after parsing the input control parameters
    # Default input coordinate file format is auto-detected at run time by Amber. 
    # The file format can be either formatted ASCII (inpcrd) or NetCDF.
    # The format will be determined by checking the file with load 
    #     and iread functions that are supplied by TrajectoryReader.
    # Default restart file is also in NetCDF format. 
    # Optionally, velocities and forces can be written to 
    # mdvel (.mdvel) and mdfrc (.mdfrc) files, respectively
    startpage = {
        'nameTranslate'   :  metaNameConverter,
        'metaHeader'      : 'x_amber',
        'metaNameTag'     : 'mdin_file',
        'metaInfoType'    : 'C',
257
        'activeMetaNames' : [],
Berk Onat's avatar
Berk Onat committed
258
259
260
        'activeSections'  : ['x_amber_section_input_output_files']
        }
    namelist = {
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
        'MDIN'   : FileInfoMap(startpage),
        'MDOUT'  : FileInfoMap(startpage), 
        'INPCRD' : FileInfoMap(startpage, activeInfo=True, fileFormat=['.inpcrd', '.ncrst'], 
                               infoPurpose=['inputcoordinates', 'inputvelocities', 'inputunitcell']), 
        'PARM'   : FileInfoMap(startpage, activeInfo=True, fileFormat=['.prmtop', '.parm7'], 
                               infoPurpose=['topology', 'unitcell']),
        'RESTRT' : FileInfoMap(startpage),
        'REFC'   : FileInfoMap(startpage),
        'MDVEL'  : FileInfoMap(startpage, activeInfo=True, infoPurpose=['velocities']),
        'MDFRC'  : FileInfoMap(startpage, activeInfo=True, infoPurpose=['forces']),
        'MDEN'   : FileInfoMap(startpage),
        'MDCRD'  : FileInfoMap(startpage, activeInfo=True, fileFormat=['.netcdf', '.mdcrd'], 
                               infoPurpose=['trajectory', 'unitcell']),
        'MDINFO' : FileInfoMap(startpage),
        'MTMD'   : FileInfoMap(startpage),
        'INPDIP' : FileInfoMap(startpage),
        'RSTDIP' : FileInfoMap(startpage), 
        'INPTRA' : FileInfoMap(startpage)
        }
Berk Onat's avatar
Berk Onat committed
280
281
    return MapDictionary(namelist)

282
def get_nameListDict(deflist):
Berk Onat's avatar
Berk Onat committed
283
284
285
286
287
288
289
290
    """Loads namelist data of AMBER.

    Args:
        deflist: name list definition (cntrl/ewald/qmmm/wt).

    Returns:
        the list of namelists
    """
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
    startpage = {
        'nameTranslate'   :  metaNameConverter,
        'metaHeader'      : 'x_amber',
        'metaNameTag'     : 'mdin',
        'metaInfoType'    : 'C',
        'activeMetaNames' : [],
        'activeSections'  : ['x_amber_mdin_method']
        }
    cntrllist = {
        'imin' : MetaInfoMap(startpage, defaultValue=0), 
        'nmropt' : MetaInfoMap(startpage, defaultValue=0),
        'ntx' : MetaInfoMap(startpage, defaultValue=1), 
        'irest' : MetaInfoMap(startpage, defaultValue=0), 
        'ntxo' : MetaInfoMap(startpage, defaultValue=2),
        'ntpr' : MetaInfoMap(startpage, defaultValue=50),
        'ntave' : MetaInfoMap(startpage, defaultValue=0),
        'ntwr' : MetaInfoMap(startpage, defaultValue='nstlim'),
        'iwrap' : MetaInfoMap(startpage, defaultValue=0), 
        'ntwx' : MetaInfoMap(startpage, defaultValue=0),
        'ntwv' : MetaInfoMap(startpage, defaultValue=0),
        'ntwf' : MetaInfoMap(startpage, defaultValue=0),
        'ntwe' : MetaInfoMap(startpage, defaultValue=0),
        'ioutfm' : MetaInfoMap(startpage, defaultValue=1),
        'ntwprt' : MetaInfoMap(startpage, defaultValue=0),
        'idecomp' : MetaInfoMap(startpage, defaultValue=0),
        'ibelly' : MetaInfoMap(startpage, defaultValue=0),
        'ntr' : MetaInfoMap(startpage, defaultValue=0), 
        'restraint_wt' : MetaInfoMap(startpage), 
        'restraintmask' : MetaInfoMap(startpage),
        'bellymask' : MetaInfoMap(startpage),
        'maxcyc' : MetaInfoMap(startpage, defaultValue=1),
        'ncyc' : MetaInfoMap(startpage, defaultValue=10), 
        'ntmin' : MetaInfoMap(startpage, defaultValue=1), 
        'dx0' : MetaInfoMap(startpage, defaultValue=0.01), 
        'drms' : MetaInfoMap(startpage, defaultValue=1.0E-4), 
        'nstlim' : MetaInfoMap(startpage, defaultValue=1), 
        'nscm' : MetaInfoMap(startpage, defaultValue=1000), 
        't' : MetaInfoMap(startpage, defaultValue=0.0), 
        'dt' : MetaInfoMap(startpage, defaultValue=0.001), 
        'nrespa' : MetaInfoMap(startpage, defaultValue=0), 
        'ntt' : MetaInfoMap(startpage, defaultValue=0), 
        'temp0' : MetaInfoMap(startpage, defaultValue=300), 
        'temp0les' : MetaInfoMap(startpage, defaultValue=-1), 
        'tempi' : MetaInfoMap(startpage, defaultValue=0.0), 
        'ig' : MetaInfoMap(startpage, defaultValue=-1), 
        'tautp' : MetaInfoMap(startpage, defaultValue=1.0), 
        'gamma_ln' : MetaInfoMap(startpage, defaultValue=0), 
        'vrand' : MetaInfoMap(startpage, defaultValue=1000), 
        'vlimit' : MetaInfoMap(startpage, defaultValue=0), 
        'nkija' : MetaInfoMap(startpage, defaultValue=1), 
        'idistr' : MetaInfoMap(startpage, defaultValue=0), 
        'sinrtau' : MetaInfoMap(startpage, defaultValue=1.0), 
        'ntp' : MetaInfoMap(startpage, defaultValue=0), 
        'barostat' : MetaInfoMap(startpage, defaultValue=1), 
        'mcbarint' : MetaInfoMap(startpage, defaultValue=100), 
        'pres0' : MetaInfoMap(startpage, defaultValue=1.0), 
        'comp' : MetaInfoMap(startpage, defaultValue=44.6), 
        'taup' : MetaInfoMap(startpage, defaultValue=1.0), 
        'csurften' : MetaInfoMap(startpage, defaultValue=0), 
        'gamma_ten' : MetaInfoMap(startpage, defaultValue=0), 
        'ninterface' : MetaInfoMap(startpage, defaultValue=2), 
        'ntc' : MetaInfoMap(startpage, defaultValue=0), 
        'tol' : MetaInfoMap(startpage, defaultValue=0.00001), 
        'jfastw' : MetaInfoMap(startpage, defaultValue=0), 
        'noshakemask' : MetaInfoMap(startpage, defaultValue=''), 
        'ivcap' : MetaInfoMap(startpage, defaultValue=0), 
        'fcap' : MetaInfoMap(startpage), 
        'cutcap' : MetaInfoMap(startpage), 
        'xcap' : MetaInfoMap(startpage), 
        'ycap' : MetaInfoMap(startpage), 
        'zcap' : MetaInfoMap(startpage), 
        'iscale' : MetaInfoMap(startpage, defaultValue=0), 
        'noeskp' : MetaInfoMap(startpage, defaultValue=1), 
        'ipnlty' : MetaInfoMap(startpage, defaultValue=1), 
        'mxsub' : MetaInfoMap(startpage, defaultValue=1), 
        'scalm' : MetaInfoMap(startpage, defaultValue=100), 
        'pencut' : MetaInfoMap(startpage, defaultValue=0.1), 
        'tausw' : MetaInfoMap(startpage, defaultValue=0.1), 
        'iemap' : MetaInfoMap(startpage, defaultValue=0), 
        'gammamap' : MetaInfoMap(startpage, defaultValue=1), 
        'ntf' : MetaInfoMap(startpage, defaultValue=1), 
        'ntb' : MetaInfoMap(startpage, defaultValue=1), 
        'dielc' : MetaInfoMap(startpage, defaultValue=1.0), 
        'cut' : MetaInfoMap(startpage, defaultValue=8.0), 
        'fswitch' : MetaInfoMap(startpage, defaultValue=-1), 
        'nsnb' : MetaInfoMap(startpage, defaultValue=25), 
        'ipol' : MetaInfoMap(startpage, defaultValue=0), 
        'ifqnt' : MetaInfoMap(startpage, defaultValue=0), 
        'igb' : MetaInfoMap(startpage, defaultValue=0), 
        'irism' : MetaInfoMap(startpage, defaultValue=0), 
        'ievb' : MetaInfoMap(startpage, defaultValue=0), 
        'iamoeba' : MetaInfoMap(startpage, defaultValue=0), 
        'lj1264' : MetaInfoMap(startpage), 
        'efx' : MetaInfoMap(startpage, defaultValue=0), 
        'efy' : MetaInfoMap(startpage, defaultValue=0), 
        'efz' : MetaInfoMap(startpage, defaultValue=0), 
        'efn' : MetaInfoMap(startpage, defaultValue=0), 
        'efphase' : MetaInfoMap(startpage), 
        'effreq' : MetaInfoMap(startpage)
        }
Berk Onat's avatar
Berk Onat committed
391

392
393
394
395
396
397
398
399
    wtlist = {
        'istep1' : MetaInfoMap(startpage, defaultValue=0),
        'istep2' : MetaInfoMap(startpage, defaultValue=0),
        'value1' : MetaInfoMap(startpage),
        'value2' : MetaInfoMap(startpage),
        'iinc' : MetaInfoMap(startpage),
        'imult' : MetaInfoMap(startpage)
        }
Berk Onat's avatar
Berk Onat committed
400
    
401
402
403
404
405
406
407
408
409
    ewaldlist = {
        'nfft1' : MetaInfoMap(startpage),
        'nfft2' : MetaInfoMap(startpage),
        'nfft3' : MetaInfoMap(startpage),
        'order' : MetaInfoMap(startpage, defaultValue=4),
        'verbose' : MetaInfoMap(startpage, defaultValue=0),
        'ew_type' : MetaInfoMap(startpage, defaultValue=0),
        'dsum_tol' : MetaInfoMap(startpage, defaultValue=1.0E-5),
        'rsum_tol' : MetaInfoMap(startpage, defaultValue=5.0E-5),
410
411
412
        'mlimit\(1\)' : MetaInfoMap(startpage),
        'mlimit\(2\)' : MetaInfoMap(startpage),
        'mlimit\(3\)' : MetaInfoMap(startpage),
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
        'ew_coeff' : MetaInfoMap(startpage),
        'nbflag' : MetaInfoMap(startpage, defaultValue=1),
        'skinnb' : MetaInfoMap(startpage, defaultValue=2.0),
        'nbtell' : MetaInfoMap(startpage, defaultValue=0),
        'netfrc' : MetaInfoMap(startpage, defaultValue=1),
        'vdwmeth' : MetaInfoMap(startpage, defaultValue=1),
        'eddmet' : MetaInfoMap(startpage, defaultValue=1),
        'eedtbdns' : MetaInfoMap(startpage, defaultValue=500),
        'column_fft' : MetaInfoMap(startpage, defaultValue=0),
        'ips' : MetaInfoMap(startpage, defaultValue=0),
        'raips' : MetaInfoMap(startpage, defaultValue=-1),
        'mipsx' : MetaInfoMap(startpage, defaultValue=-1),
        'mipsy' : MetaInfoMap(startpage, defaultValue=-1),
        'mipsz' : MetaInfoMap(startpage, defaultValue=-1),
        'mipso' : MetaInfoMap(startpage, defaultValue=4),
        'gridips' : MetaInfoMap(startpage, defaultValue=2),
        'dvbips' : MetaInfoMap(startpage, defaultValue=1.0E-8),
        'frameon' : MetaInfoMap(startpage, defaultValue=1),
        'chngmask' : MetaInfoMap(startpage, defaultValue=1),
        'indmeth' : MetaInfoMap(startpage),
        'diptol' : MetaInfoMap(startpage, defaultValue=0.0001),
        'maxiter' : MetaInfoMap(startpage, defaultValue=20),
        'dipmass' : MetaInfoMap(startpage, defaultValue=0.33),
        'diptau' : MetaInfoMap(startpage, defaultValue=11),
        'irstdip' : MetaInfoMap(startpage),
        'scaldip' : MetaInfoMap(startpage, defaultValue=1)
        }
Berk Onat's avatar
Berk Onat committed
440

441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
    qmmmlist = {
        'qm_theory' : MetaInfoMap(startpage),
        'dftb_slko_path' : MetaInfoMap(startpage),
        'dftb_disper' : MetaInfoMap(startpage),
        'dftb_3rd_order' : MetaInfoMap(startpage),
        'dftb_chg' : MetaInfoMap(startpage),
        'dftb_telec' : MetaInfoMap(startpage),
        'dftb_maxiter' : MetaInfoMap(startpage),
        'qmcharge' : MetaInfoMap(startpage),
        'spin' : MetaInfoMap(startpage),
        'qmqmdx' : MetaInfoMap(startpage),
        'verbosity' : MetaInfoMap(startpage),
        'tight_p_conv' : MetaInfoMap(startpage),
        'scfconv' : MetaInfoMap(startpage),
        'pseudo_diag' : MetaInfoMap(startpage),
        'diag_routine' : MetaInfoMap(startpage),
        'printcharges' : MetaInfoMap(startpage),
        'print_eigenvalues' : MetaInfoMap(startpage),
        'qxd' : MetaInfoMap(startpage),
        'parameter_file' : MetaInfoMap(startpage),
        'peptide_corr' : MetaInfoMap(startpage),
        'itrmax' : MetaInfoMap(startpage),
        'ntpr' : MetaInfoMap(startpage),
        'grms_tol' : MetaInfoMap(startpage),
        'ndiis_attempts' : MetaInfoMap(startpage),
        'ndiis_matrices' : MetaInfoMap(startpage), 
        'vshift' : MetaInfoMap(startpage),
        'errconv' : MetaInfoMap(startpage),
        'qmmm_int' : MetaInfoMap(startpage),
        'qmmask' : MetaInfoMap(startpage),
        'qmcut' : MetaInfoMap(startpage),
        'lnk_dis' : MetaInfoMap(startpage),
        'dftb_telec_step' : MetaInfoMap(startpage),
        'fockp_d1' : MetaInfoMap(startpage),
        'fockp_d2' : MetaInfoMap(startpage),
        'fockp_d3' : MetaInfoMap(startpage), 
        'fockp_d4' : MetaInfoMap(startpage),
        'pseudo_diag_criteria' : MetaInfoMap(startpage),
        'damp' : MetaInfoMap(startpage),
        'kappa' : MetaInfoMap(startpage),
        'min_heavy_mass' : MetaInfoMap(startpage), 
        'r_switch_hi' : MetaInfoMap(startpage),
        'r_switch_lo' : MetaInfoMap(startpage),
        'iqmatoms' : MetaInfoMap(startpage),
        'qmgb' : MetaInfoMap(startpage),
        'lnk_atomic_no' : MetaInfoMap(startpage),
        'lnk_method' : MetaInfoMap(startpage),
        'printbondorders' : MetaInfoMap(startpage),
        'buffercharge' : MetaInfoMap(startpage),
        'printdipole' : MetaInfoMap(startpage),
        'qmshake' : MetaInfoMap(startpage), 
        'qmmmrij_incore' : MetaInfoMap(startpage),
        'qmqm_erep_incore' : MetaInfoMap(startpage),     
        'qm_ewald' : MetaInfoMap(startpage),
        'qm_pme' : MetaInfoMap(startpage),
        'kmaxqx' : MetaInfoMap(startpage), 
        'kmaxqy' : MetaInfoMap(startpage),         
        'kmaxqz' : MetaInfoMap(startpage),
        'ksqmaxsq' : MetaInfoMap(startpage),
        'adjust_q' : MetaInfoMap(startpage),
        'density_predict' : MetaInfoMap(startpage), 
        'fock_predict' : MetaInfoMap(startpage),
        'vsolv' : MetaInfoMap(startpage),
        'abfqmmm' : MetaInfoMap(startpage),
        'hot_spot' : MetaInfoMap(startpage),
        'qmmm_switch' : MetaInfoMap(startpage), 
        'core_iqmatoms' : MetaInfoMap(startpage),
        'coremask' : MetaInfoMap(startpage),
        'buffermask' : MetaInfoMap(startpage),
        'centermask' : MetaInfoMap(startpage),
        'pot_ene' : MetaInfoMap(startpage), 
        'tot' : MetaInfoMap(startpage),
        'vdw' : MetaInfoMap(startpage),
        'elec' : MetaInfoMap(startpage),
        'gb' : MetaInfoMap(startpage),
        'bond' : MetaInfoMap(startpage), 
        'angle' : MetaInfoMap(startpage),
        'dihedral' : MetaInfoMap(startpage),
        'vdw_14' : MetaInfoMap(startpage),
        'elec_14' : MetaInfoMap(startpage),
        'constraint' : MetaInfoMap(startpage), 
        'polar' : MetaInfoMap(startpage),
        'hbond' : MetaInfoMap(startpage),
        'surf' : MetaInfoMap(startpage),
        'scf' : MetaInfoMap(startpage),
        'disp' : MetaInfoMap(startpage), 
        'dvdi' : MetaInfoMap(startpage),
        'angle_ub' : MetaInfoMap(startpage),
        'imp' : MetaInfoMap(startpage),
        'cmap' : MetaInfoMap(startpage),
        'emap' : MetaInfoMap(startpage), 
        'les' : MetaInfoMap(startpage),
        'noe' : MetaInfoMap(startpage),
        'pb' : MetaInfoMap(startpage),
        'rism' : MetaInfoMap(startpage),
        'ct' : MetaInfoMap(startpage), 
        'amd_boost' : MetaInfoMap(startpage)
        }
Berk Onat's avatar
Berk Onat committed
539
    
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
    startpage.update({
        'metaNameTag'     : 'parm'
        })
    parmlist = {
        'NATOM' : MetaInfoMap(startpage),
        'NTYPES' : MetaInfoMap(startpage),
        'NBONH' : MetaInfoMap(startpage),
        'MBONA' : MetaInfoMap(startpage),
        'NTHETH' : MetaInfoMap(startpage),
        'MTHETA' : MetaInfoMap(startpage),
        'NPHIH' : MetaInfoMap(startpage),
        'MPHIA' : MetaInfoMap(startpage),
        'NHPARM' : MetaInfoMap(startpage),
        'NPARM' : MetaInfoMap(startpage),
        'NNB' : MetaInfoMap(startpage),
        'NRES' : MetaInfoMap(startpage),
        'NBONA' : MetaInfoMap(startpage),
        'NTHETA' : MetaInfoMap(startpage),
        'NPHIA' : MetaInfoMap(startpage),
        'NUMBND' : MetaInfoMap(startpage),
        'NUMANG' : MetaInfoMap(startpage),
        'NPTRA' : MetaInfoMap(startpage),
        'NATYP' : MetaInfoMap(startpage),
        'NPHB' : MetaInfoMap(startpage),
        'IFPERT' : MetaInfoMap(startpage),
        'NBPER' : MetaInfoMap(startpage),
        'NGPER' : MetaInfoMap(startpage),
        'NDPER' : MetaInfoMap(startpage),
        'MBPER' : MetaInfoMap(startpage),
        'MGPER' : MetaInfoMap(startpage),
        'MDPER' : MetaInfoMap(startpage),
        'IFBOX' : MetaInfoMap(startpage),
        'NMXRS' : MetaInfoMap(startpage),
        'IFCAP' : MetaInfoMap(startpage),
        'NUMEXTRA' : MetaInfoMap(startpage),
        'NCOPY' : MetaInfoMap(startpage)
        }
Berk Onat's avatar
Berk Onat committed
577

578
579
580
581
582
583
    startpage.update({
        'metaNameTag'     : 'mdout',
        'activeSections'  : ['section_single_configuration_calculation']
        })
    mddatalist = {
        'NSTEP' : MetaInfoMap(startpage),
584
585
        'TIME\(PS\)' : MetaInfoMap(startpage),
        'TEMP\(K\)' : MetaInfoMap(startpage),
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
        'PRESS' : MetaInfoMap(startpage),
        'Etot' : MetaInfoMap(startpage),
        'EKtot' : MetaInfoMap(startpage),
        'EPtot' : MetaInfoMap(startpage),
        'BOND' : MetaInfoMap(startpage),
        'ANGLE' : MetaInfoMap(startpage),
        'DIHED' : MetaInfoMap(startpage),
        '1-4 NB' : MetaInfoMap(startpage),
        '1-4 EEL' : MetaInfoMap(startpage),
        'VDWAALS' : MetaInfoMap(startpage),
        'EELEC' : MetaInfoMap(startpage),
        'EHBOND' : MetaInfoMap(startpage),
        'RESTRAINT' : MetaInfoMap(startpage),
        'MNDOESCF' : MetaInfoMap(startpage),
        'AINT' : MetaInfoMap(startpage),
        'EGB' : MetaInfoMap(startpage),
        'VOLUME' : MetaInfoMap(startpage),
        'EKCMT' : MetaInfoMap(startpage),
        'VIRIAL' : MetaInfoMap(startpage),
        'Density' : MetaInfoMap(startpage)
        }

    startpage.update({
        'metaNameTag'     : 'parm',
        'activeSections'  : ['x_amber_mdin_method']
        })
    extralist = {
        'flags' : MetaInfoMap(startpage),
        'box_info' : MetaInfoMap(startpage),
        'unitcell_radius' : MetaInfoMap(startpage),
        'total_memory' : MetaInfoMap(startpage),
        'file_format' : MetaInfoMap(startpage),
        'file_version' : MetaInfoMap(startpage),
        'file_date' : MetaInfoMap(startpage),
        'file_time' : MetaInfoMap(startpage)
        }
Berk Onat's avatar
Berk Onat committed
622
623
624
625
626
627
628
629
630
631
632

    if deflist == 'mddata':
        namelist = mddatalist
    elif deflist == 'ewald':
        namelist = ewaldlist
    elif deflist == 'qmmm':
        namelist = qmmmlist
    elif deflist == 'wt':
        namelist = wtlist
    elif deflist == 'parm':
        namelist = parmlist
633
634
    elif deflist == 'extra':
        namelist = extralist
Berk Onat's avatar
Berk Onat committed
635
636
    else:
        namelist = cntrllist
637
638
639
640
641
642
643
644
645
646
647
    return MapDictionary(namelist)

def get_updateDictionary(self, defname):

    startpage = {
        'metaHeader'      : '',
        'metaNameTag'     : '',
        'activeMetaNames' : [],
        'activeSections'  : ['x_amber_mdin_method']
        }

648
649
650
    # ---------------------------------------------------------------
    #   Definitions of meta data values for section_sampling_method
    # ---------------------------------------------------------------
651
652
653
    sampling = { 
        'ensemble_type' : MetaInfoMap(startpage, 
            depends=[
654
                {'test' : [['imin', '== 1']], 
655
                 'assign' : 'minimization'},
656
657
                {'test' : [['imin', '== 0'], 
                           ['ntt', '== 0']], 
658
                 'assign' : 'NVE'},
659
660
661
                {'test' : [['imin', '== 0'], 
                           ['ntt', '> 0'], 
                           ['ntt', '< 3']], 
662
                 'assign' : 'NVT'},
663
664
665
                {'test' : [['imin', '== 0'], 
                           ['ntp', '> 0'], 
                           ['ntt', '< 3']], 
666
                 'assign' : 'NPT'},
667
668
                {'test' : [['imin', '== 0'], 
                           ['ntt', '== 3']], 
669
670
671
672
673
674
                 'assign' : 'Langevin'}
                ],
            lookupdict=self.cntrlDict
            ),
        'sampling_method' : MetaInfoMap(startpage, 
            depends=[
675
                {'test' : [['imin', '== 1']], 
676
                 'assign' : 'geometry_optimization'},
677
                {'test' : [['imin', '== 0']], 
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
                 'assign' : 'molecular_dynamics'}
                ],
            lookupdict=self.cntrlDict
            ),
#            'settings_geometry_optimization' : MetaInfoMap(startpage),
#            'settings_metadynamics' : MetaInfoMap(startpage),
#            'settings_molecular_dynamics' : MetaInfoMap(startpage),
#            'settings_Monte_Carlo' : MetaInfoMap(startpage),
#        'geometry_optimization_energy_change' : MetaInfoMap(startpage,
#            depends={
#                '' : {'imin' : '1'},
#                },
#            lookupdict=self.cntrlDict
#            ),
#       'geometry_optimization_geometry_change' : MetaInfoMap(startpage),
        'geometry_optimization_method' : MetaInfoMap(startpage,
            depends=[
695
696
                {'test' : [['imin', '== 1'], 
                           ['ntmin', '== 0']], 
697
                 'assign' : 'CG'},
698
699
                {'test' : [['imin', '== 1'], 
                           ['ntmin', '== 1']], 
700
                 'assign' : 'SD + CG'},
701
702
                {'test' : [['imin', '== 1'], 
                           ['ntmin', '== 2']], 
703
                 'assign' : 'XMIN'},
704
705
                {'test' : [['imin', '== 1'], 
                           ['ntmin', '== 3']], 
706
                 'assign' : 'LMOD'},
707
708
                {'test' : [['imin', '== 1'], 
                           ['ntmin', '== 4']], 
709
710
711
712
713
                 'assign' : 'LMOD'},
                ],
            lookupdict=self.cntrlDict
            ),
#       'geometry_optimization_threshold_force' : MetaInfoMap(startpage),
714
        'x_amber_barostat_type' : MetaInfoMap(startpage,
715
            depends=[
716
717
718
                {'test' : [['imin', '== 0'], 
                           ['ntp', '!= 0'], 
                           ['barostat', '== 1']], 
719
                 'assign' : 'Berendsen'},
720
721
722
                {'test' : [['imin', '== 0'], 
                           ['ntp', '!= 0'], 
                           ['barostat', '== 2']],
723
724
                 'assign' : 'Monte Carlo barostat'} 
                ],
725
            lookupdict=self.cntrlDict,
726
727
728
729
730
731
732
733
734
735
            #autoSections=True,
            activeSections=['settings_barostat']
            ),
        'x_amber_barostat_target_pressure' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['imin', '== 0'], 
                           ['ntp', '!= 0']], 
                 'value' : 'pres0'} 
                ],
            lookupdict=self.cntrlDict,
736
            valtype='float',
737
738
739
740
741
742
743
744
745
746
            #autoSections=True,
            activeSections=['settings_barostat']
            ),
        'x_amber_barostat_tau' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['imin', '== 0'], 
                           ['ntp', '!= 0']], 
                 'value' : 'taup'} 
                ],
            lookupdict=self.cntrlDict,
747
            valtype='float',
748
            #autoSections=True,
749
            activeSections=['settings_barostat']
750
            ),
751
        'x_amber_integrator_type' : MetaInfoMap(startpage,
752
            depends=[
753
                {'test' : [['imin', '== 0']],
754
                 'assign' : 'verlet'}, 
755
                {'test' : [['imin', '== 1']],
756
757
                 'assign' : 'minimization'}
                ],
758
            lookupdict=self.cntrlDict,
759
760
761
762
763
764
765
766
767
            #autoSections=True,
            activeSections=['settings_integrator']
            ),
        'x_amber_integrator_dt' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['imin', '== 0']],
                 'value' : 'dt'}
                ],
            lookupdict=self.cntrlDict,
768
            valtype='float',
769
770
771
772
773
774
            #autoSections=True,
            activeSections=['settings_integrator']
            ),
        'x_amber_number_of_steps_requested' : MetaInfoMap(startpage,
            depends=[{'value' : 'nstlim'}],
            lookupdict=self.cntrlDict,
775
            valtype='int',
776
            #autoSections=True,
777
            activeSections=['settings_integrator']
778
            ),
779
        'x_amber_thermostat_type' : MetaInfoMap(startpage,
780
            depends=[
781
                {'test' : [['imin', '== 0'], ['ntt', '== 1']],
782
                 'assign' : 'Constant Temperature Scaling with weak-coupling'}, 
783
                {'test' : [['imin', '== 0'], ['ntt', '== 2']],
784
                 'assign' : 'Andersen-like'},
785
                {'test' : [['imin', '== 0'], ['ntt', '== 3']],
786
                 'assign' : 'Langevin'},
787
                {'test' : [['imin', '== 0'], ['ntt', '== 9']],
788
                 'assign' : 'Optimized Isokinetic Nose-Hoover'},
789
                {'test' : [['imin', '== 0'], ['ntt', '== 10']],
790
791
                 'assign' : 'RESPA Stochastic Isokinetic Nose-Hoover'} 
                ],
792
            lookupdict=self.cntrlDict,
793
794
795
796
797
798
799
800
801
            #autoSections=True,
            activeSections=['settings_thermostat']
            ),
        'x_amber_thermostat_target_temperature' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['imin', '== 0'], ['ntt', '> 0']],
                 'value' : 'temp0'}
                ],
            lookupdict=self.cntrlDict,
802
            valtype='float',
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
            #autoSections=True,
            activeSections=['settings_thermostat']
            ),
        'x_amber_thermostat_tau' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['imin', '== 0'], ['ntt', '== 1']],
                 'value' : 'tautp'}, 
                {'test' : [['imin', '== 0'], ['ntt', '== 2']],
                 'value' : 'tautp'}, 
                {'test' : [['imin', '== 0'], ['ntt', '== 9']],
                 'value' : 'gamma_ln'}, 
                {'test' : [['imin', '== 0'], ['ntt', '== 10']],
                 'value' : 'gamma_ln'}, 
                ],
            lookupdict=self.cntrlDict,
818
            valtype='float',
819
820
821
822
823
824
825
826
827
            #autoSections=True,
            activeSections=['settings_thermostat']
            ),
        'x_amber_langevin_gamma' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['imin', '== 0'], ['ntt', '== 3']],
                 'value' : 'gamma_ln'}
                ],
            lookupdict=self.cntrlDict,
828
            valtype='float',
829
            #autoSections=True,
830
            activeSections=['settings_thermostat']
831
            ),
832
833
834
835
836
837
838
839
840
841
842
        'x_amber_periodicity_type' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['ntb', '== 0']],
                 'assign' : 'no periodic boundaries'},
                {'test' : [['ntb', '> 0']],
                 'assign' : 'periodic boundaries'}
                ],
            lookupdict=self.cntrlDict,
            #autoSections=True,
            activeSections=['settings_thermostat']
            )
843
844
        }

845
846
847
    # ------------------------------------------------------------
    #   Definitions for section_single_configuration_calculation
    # ------------------------------------------------------------
848
    singleconfcalc = { 
849
850
851
852
        #'atom_forces_type' : MetaInfoMap(startpage,
        #    depends=[{'assign' : 'Amber Force Field'}],
        #    lookupdict=self.mddataDict
        #    ),
853
        'energy_correction_entropy' : MetaInfoMap(startpage),
854
855
856
857
858
        #'energy_current' : MetaInfoMap(startpage,
        #    depends=[{'value' : 'EPtot'}],
        #    lookupdict=self.mddataDict
        #    ),
        'energy_current' : MetaInfoMap(startpage),
859
860
        'energy_electrostatic' : MetaInfoMap(startpage,
            depends=[{'value' : 'EELEC'}],
861
            valtype='float',
862
            unitdict=self.unitDict,
863
            unit='kcal/mol',
864
865
866
867
            lookupdict=self.mddataDict
            ),
        'energy_free_per_atom' : MetaInfoMap(startpage),
        'energy_free' : MetaInfoMap(startpage),
868
869
870
871
        #'energy_method_current' : MetaInfoMap(startpage,
        #    depends=[{'assign' : 'Force Field'}],
        #    lookupdict=self.mddataDict
        #    ),
872
873
874
875
876
        'energy_T0_per_atom' : MetaInfoMap(startpage),
        'energy_total_T0_per_atom' : MetaInfoMap(startpage),
        'energy_total_T0' : MetaInfoMap(startpage),
        'energy_total' : MetaInfoMap(startpage,
            depends=[{'value' : 'Etot'}],
877
            valtype='float',
878
            unitdict=self.unitDict,
879
            unit='kcal/mol',
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
            lookupdict=self.mddataDict
            ),
        'hessian_matrix' : MetaInfoMap(startpage),
        'single_configuration_calculation_converged' : MetaInfoMap(startpage),
        'single_configuration_calculation_to_system_ref' : MetaInfoMap(startpage),
        'single_configuration_to_calculation_method_ref' : MetaInfoMap(startpage),
        'time_calculation' : MetaInfoMap(startpage),
        'time_single_configuration_calculation_cpu1_end' : MetaInfoMap(startpage),
        'time_single_configuration_calculation_cpu1_start' : MetaInfoMap(startpage),
        'time_single_configuration_calculation_date_end' : MetaInfoMap(startpage),
        'time_single_configuration_calculation_date_start' : MetaInfoMap(startpage),
        'time_single_configuration_calculation_wall_end' : MetaInfoMap(startpage),
        'time_single_configuration_calculation_wall_start' : MetaInfoMap(startpage),
        'stress_tensor_kind' : MetaInfoMap(startpage),
        'stress_tensor_value' : MetaInfoMap(startpage)
        }
896

897
    # section_single_energy_van_der_Waals of section_single_configuration_calculation
898
899
900
901
    singlevdw = {
        'energy_van_der_Waals_value' : MetaInfoMap(startpage,
            depends=[{'value' : 'VDWAALS'}],
            lookupdict=self.mddataDict,
902
            valtype='float',
903
            unitdict=self.unitDict,
904
            unit='kcal/mol',
905
906
907
908
            #autoSections=True,
            activeSections=['section_energy_van_der_Waals']
            ),
        }
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937


    # Info for section_restricted_uri
    restrictions = {
        'number_of_restricted_uri_files' : MetaInfoMap(startpage,
            value=int(1),
            autoSections=True,
            activeSections=['section_restricted_uri']
            ),
        'restricted_uri_files' : MetaInfoMap(startpage,
            subfunction=self.parameter_file_name,
            autoSections=True,
            activeSections=['section_restricted_uri']
            ),
        'restricted_uri_license' : MetaInfoMap(startpage,
            value='AMBER License',
            autoSections=True,
            activeSections=['section_restricted_uri']
            ),
        'restricted_uri_restriction' : MetaInfoMap(startpage,
            value='any access',
            autoSections=True,
            activeSections=['section_restricted_uri']
            ),
        'restricted_uri_reason' : MetaInfoMap(startpage,
            value='propriety license',
            autoSections=True,
            activeSections=['section_restricted_uri']
            ),
938
        'restricted_uri_issue_authority' : MetaInfoMap(startpage,
939
940
941
942
943
            value='AMBER',
            autoSections=True,
            activeSections=['section_restricted_uri']
            ),
        }
944
   
945
946
947
    # ------------------------------------------
    #   Definitions for section_frame_sequence
    # ------------------------------------------
948
    frameseq = { 
949
        'frame_sequence_conserved_quantity_frames' : MetaInfoMap(startpage,
950
            depends=[{'store' : 'NSTEP'}],
951
            valtype='int',
952
953
954
            lookupdict=self.mddataDict
            ),
        'frame_sequence_conserved_quantity_stats' : MetaInfoMap(startpage),
955
        'frame_sequence_conserved_quantity' : MetaInfoMap(startpage,
956
            depends=[{'store' : 'RESTRAINT'}],
957
958
            valtype='float',
            unitdict=self.unitDict,
959
            unit='kcal/mol',
960
961
962
963
            lookupdict=self.mddataDict
            ),
        'frame_sequence_continuation_kind' : MetaInfoMap(startpage),
        'frame_sequence_external_url' : MetaInfoMap(startpage),
964
        'frame_sequence_kinetic_energy_frames' : MetaInfoMap(startpage,
965
            depends=[{'store' : 'NSTEP'}],
966
            valtype='int',
967
968
969
970
            lookupdict=self.mddataDict
            ),
        'frame_sequence_kinetic_energy_stats' : MetaInfoMap(startpage),
        'frame_sequence_kinetic_energy' : MetaInfoMap(startpage,
971
            depends=[{'store' : 'EKtot'}],
972
973
            valtype='float',
            unitdict=self.unitDict,
974
            unit='kcal/mol',
975
976
977
            lookupdict=self.mddataDict
            ),
        'frame_sequence_local_frames_ref' : MetaInfoMap(startpage),
978
        'frame_sequence_potential_energy_frames' : MetaInfoMap(startpage,
979
            depends=[{'store' : 'NSTEP'}],
980
            valtype='int',
981
982
983
984
            lookupdict=self.mddataDict
            ),
        'frame_sequence_potential_energy_stats' : MetaInfoMap(startpage),
        'frame_sequence_potential_energy' : MetaInfoMap(startpage,
985
            depends=[{'store' : 'EPtot'}],
986
987
            valtype='float',
            unitdict=self.unitDict,
988
            unit='kcal/mol',
989
990
            lookupdict=self.mddataDict
            ),
991
        'frame_sequence_pressure_frames' : MetaInfoMap(startpage,
992
            depends=[{'store' : 'NSTEP'}],
993
            valtype='int',
994
995
996
997
            lookupdict=self.mddataDict
            ),
        'frame_sequence_pressure_stats' : MetaInfoMap(startpage),
        'frame_sequence_pressure' : MetaInfoMap(startpage,
998
            depends=[{'store' : 'PRESS'}],
999
            valtype='float',
1000
1001
            lookupdict=self.mddataDict
            ),
1002
        'frame_sequence_temperature_frames' : MetaInfoMap(startpage,
1003
            depends=[{'store' : 'NSTEP'}],
1004
            valtype='int',
1005
1006
1007
1008
            lookupdict=self.mddataDict
            ),
        'frame_sequence_temperature_stats' : MetaInfoMap(startpage),
        'frame_sequence_temperature' : MetaInfoMap(startpage,
1009
            depends=[{'store' : 'TEMP\(K\)'}],
1010
1011
1012
            valtype='float',
            unitdict=self.unitDict,
            unit='Kelvin',
1013
1014
1015
            lookupdict=self.mddataDict
            ),
        'frame_sequence_time' : MetaInfoMap(startpage,
1016
            depends=[{'store' : 'TIME\(PS\)'}],
1017
1018
1019
            valtype='float',
            unitdict=self.unitDict,
            unit='pico-second',
1020
1021
            lookupdict=self.mddataDict
            ),
1022
1023
        'x_amber_frame_sequence_volume_frames' : MetaInfoMap(startpage,
            depends=[{'store' : 'NSTEP'}],
1024
            valtype='int',
1025
1026
            lookupdict=self.mddataDict
            ),
1027
1028
        'x_amber_frame_sequence_volume' : MetaInfoMap(startpage,
            depends=[{'store' : 'VOLUME'}],
1029
1030
1031
            valtype='float',
            unitdict=self.unitDict,
            unit='Angstrom**3',
1032
1033
1034
1035
            lookupdict=self.mddataDict
            ),
        'x_amber_frame_sequence_density_frames' : MetaInfoMap(startpage,
            depends=[{'store' : 'NSTEP'}],
1036
            valtype='int',
1037
1038
1039
1040
            lookupdict=self.mddataDict
            ),
        'x_amber_frame_sequence_density' : MetaInfoMap(startpage,
            depends=[{'store' : 'Density'}],
1041
1042
1043
            valtype='float',
            unitdict=self.unitDict,
            unit='1.0/Angstrom**3',
1044
1045
            lookupdict=self.mddataDict
            ),
1046
        #'frame_sequence_to_sampling_ref' : MetaInfoMap(startpage),
1047
1048
1049
1050
        'geometry_optimization_converged' : MetaInfoMap(startpage,
            value=self.minConverged
            ),
        'number_of_conserved_quantity_evaluations_in_sequence' : MetaInfoMap(startpage,
1051
1052
            value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
                self.metaStorage.fetchAttr(
1053
                    {'frame_sequence_conserved_quantity_frames' : None}
1054
1055
                    )['frame_sequence_conserved_quantity_frames']['val']
                )
1056
1057
            ),
        'number_of_frames_in_sequence' : MetaInfoMap(startpage,
1058
1059
            value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
                self.metaStorage.fetchAttr(
1060
                    {'frame_sequence_potential_energy_frames' : None}
1061
1062
                    )['frame_sequence_potential_energy_frames']['val']
                )
1063
1064
            ),
        'number_of_kinetic_energies_in_sequence' : MetaInfoMap(startpage,
1065
1066
            value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
                self.metaStorage.fetchAttr(
1067
                    {'frame_sequence_kinetic_energy_frames' : None}
1068
1069
                    )['frame_sequence_kinetic_energy_frames']['val']
                )
1070
1071
            ),
        'number_of_potential_energies_in_sequence' : MetaInfoMap(startpage,
1072
1073
            value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
                self.metaStorage.fetchAttr(
1074
                    {'frame_sequence_potential_energy_frames' : None}
1075
1076
                    )['frame_sequence_potential_energy_frames']['val']
                )
1077
1078
            ),
        'number_of_pressure_evaluations_in_sequence' : MetaInfoMap(startpage,
1079
1080
1081
1082
1083
            value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
                self.metaStorage.fetchAttr(
                {'frame_sequence_pressure_frames' : None}
                )['frame_sequence_pressure_frames']['val']
                )
1084
1085
            ),
        'number_of_temperatures_in_sequence' : MetaInfoMap(startpage,
1086
1087
            value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
                self.metaStorage.fetchAttr(
1088
                    {'frame_sequence_temperature_frames' : None}
1089
1090
                    )['frame_sequence_temperature_frames']['val']
                )
1091
            ),
1092
        #'previous_sequence_ref' : MetaInfoMap(startpage)
1093
1094
        }

1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
    # ----------------------------------
    #   Definitions for section_system
    # ----------------------------------
    # section_system
    sec_system = {
        #'topology_ref' : MetaInfoMap(startpage),
        'atom_velocities' : MetaInfoMap(startpage),
        'configuration_raw_gid' : MetaInfoMap(startpage),
        'local_rotations' : MetaInfoMap(startpage),
        'number_of_atoms' : MetaInfoMap(startpage,
1105
            depends=[{'value' : 'NATOM'}],
1106
            valtype='int',
1107
1108
            lookupdict=self.parmDict
            ),
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
        'number_of_sites' : MetaInfoMap(startpage),
        'number_of_symmetry_operations' : MetaInfoMap(startpage),
        'reduced_symmetry_matrices' : MetaInfoMap(startpage),
        'reduced_symmetry_translations' : MetaInfoMap(startpage),
        'SC_matrix' : MetaInfoMap(startpage),
        'spacegroup_3D_choice' : MetaInfoMap(startpage),
        'spacegroup_3D_hall' : MetaInfoMap(startpage),
        'spacegroup_3D_international' : MetaInfoMap(startpage),
        'spacegroup_3D_number' : MetaInfoMap(startpage),
        'spacegroup_3D_origin_shift' : MetaInfoMap(startpage),
        'spacegroup_3D_pointgroup' : MetaInfoMap(startpage),
        'spacegroup_3D_std_lattice' : MetaInfoMap(startpage),
        'spacegroup_3D_std_positions' : MetaInfoMap(startpage),
        'spacegroup_3D_std_types' : MetaInfoMap(startpage),
        'spacegroup_3D_trasformation_matrix' : MetaInfoMap(startpage),
        'spacegroup_3D_wyckoff' : MetaInfoMap(startpage),
        'symmorphic' : MetaInfoMap(startpage),
        'system_name' : MetaInfoMap(startpage,
            subfunction=self.topology_system_name,
            #functionbase=self
            ),
        'time_reversal_symmetry' : MetaInfoMap(startpage)
1131
1132
        }

1133
1134
    # section_configuration_core of section_system
    configuration_core = {
1135
1136
        'number_of_electrons' : MetaInfoMap(startpage,
            value=0,
1137
            valtype='float',
1138
            ),
1139
        'atom_labels' : MetaInfoMap(startpage,
1140
            #subfunction=self.system_atom_labels()
1141
1142
            ),
        'atom_positions' : MetaInfoMap(startpage,
1143
            #subfunction=self.system_atom_positions()
1144
1145
            ),
        'configuration_periodic_dimensions' : MetaInfoMap(startpage,
1146
1147
1148
1149
1150
1151
1152
            depends=[
                {'test' : [['ntb', '== 0']],
                 'assign' : np.asarray([False, False, False])},
                {'test' : [['ntb', '> 0']],
                 'assign' : np.asarray([True, True, True])}
                ],
            lookupdict=self.cntrlDict,
1153
1154
1155
            ),
        'embedded_system' : MetaInfoMap(startpage),
        'lattice_vectors' : MetaInfoMap(startpage,
1156
            #subfunction=self.system_lattice_vectors()
1157
1158
            ),
        'simulation_cell' : MetaInfoMap(startpage,
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
            #subfunction=self.system_simulation_cell()
            )
        }

    # section_spacegroup_3D_operation of section_system
    spacegroup_op = {
            'spacegroup_3D_rotation' : MetaInfoMap(startpage),
            'spacegroup_3D_translation' : MetaInfoMap(startpage)
        }

    # section_system_to_system_refs of section_system
    sys_to_sys = {
            'system_to_system_kind' : MetaInfoMap(startpage),
            'system_to_system_ref' : MetaInfoMap(startpage)
        }

    # --------------------------------------------------------
    #   Definitions of meta data values for section_topology
    # --------------------------------------------------------
    # section_topology of section_run
    topology = {
        'atom_to_molecule' : MetaInfoMap(startpage,
            subfunction=self.topology_atom_to_mol,
            #functionbase=self
            ),
        'molecule_to_molecule_type_map' : MetaInfoMap(startpage),
        'number_of_topology_atoms' : MetaInfoMap(startpage,
            depends=[{'value' : 'NATOM'}],
1187
            valtype='int',
1188
1189
1190
            lookupdict=self.parmDict
            ),
        'number_of_topology_molecules' : MetaInfoMap(startpage,
1191
1192
            subfunction=self.topology_num_topo_mol,
            valtype='int',
1193
1194
            ),
        'topology_force_field_name' : MetaInfoMap(startpage,
1195
            value='AMBER Force Field',
1196
1197
1198
            )
        }

1199
    # section_atom_type of section_topology
1200
1201
1202
1203
1204
1205
    atom_type = {
        'atom_type_charge' : MetaInfoMap(startpage),
        'atom_type_mass' : MetaInfoMap(startpage),
        'atom_type_name' : MetaInfoMap(startpage)
        }

1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
    # section_constraint of section_topology
    constraint = {
        'constraint_atoms' : MetaInfoMap(startpage),
        'constraint_kind' : MetaInfoMap(startpage),
        'constraint_parameters' : MetaInfoMap(startpage),
        'number_of_atoms_per_constraint' : MetaInfoMap(startpage),
        'number_of_constraints' : MetaInfoMap(startpage)
        }

    # section_interaction of section_topology
1216
1217
1218
1219
1220
1221
1222
1223
    interaction = {
        'interaction_atoms' : MetaInfoMap(startpage),
        'interaction_kind' : MetaInfoMap(startpage),
        'interaction_parameters' : MetaInfoMap(startpage),
        'number_of_atoms_per_interaction' : MetaInfoMap(startpage),
        'number_of_interactions' : MetaInfoMap(startpage)
        }

1224
1225
1226
1227
    # -------------------------------------------------------------
    #   Definitions of meta data values for section_molecule_type
    # -------------------------------------------------------------
    # section_molecule_type of section_topology
1228
1229
1230
1231
1232
    mol_type = {
        'molecule_type_name' : MetaInfoMap(startpage),
        'number_of_atoms_in_molecule' : MetaInfoMap(startpage),
        'settings_atom_in_molecule' : MetaInfoMap(startpage)
        }
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244

    # section_molecule_constraint of section_molecule_type
    mol_constraint = {
        'molecule_constraint_atoms' : MetaInfoMap(startpage),
        'molecule_constraint_kind' : MetaInfoMap(startpage),
        'molecule_constraint_parameters' : MetaInfoMap(startpage),
        'number_of_atoms_per_molecule_constraint' : MetaInfoMap(startpage),
        'number_of_molecule_constraints' : MetaInfoMap(startpage)
        }

    # section_molecule_interaction of section_molecule_type
    mol_interaction = {
1245
1246
1247
1248
1249
1250
1251
        'molecule_interaction_atoms' : MetaInfoMap(startpage),
        'molecule_interaction_kind' : MetaInfoMap(startpage),
        'molecule_interaction_parameters' : MetaInfoMap(startpage),
        'number_of_atoms_per_molecule_interaction' : MetaInfoMap(startpage),
        'number_of_molecule_interactions' : MetaInfoMap(startpage)
        }
   
1252
    # section_atom_in_molecule of section_molecule_type
1253
1254
1255
1256
1257
1258
1259
1260
1261
    atom_in_mol = {
        'atom_in_molecule_charge' : MetaInfoMap(startpage),
        'atom_in_molecule_name' : MetaInfoMap(startpage),
        'atom_in_molecule_to_atom_type_ref' : MetaInfoMap(startpage)
        }

    if defname == 'system':
        dictionary = systemDict
    elif defname == 'topology':
1262
1263
1264
        dictionary = topology
    elif defname == 'singleconfcalc':
        dictionary = singleconfcalc
1265
1266
    elif defname == 'restrictions':
        dictionary = restrictions
1267
1268
    elif defname == 'frameseq':
        dictionary = frameseq
1269
    elif defname == 'atom_type':
1270
        dictionary = atom_type
1271
1272
1273
    elif defname == 'molecule_type':
        dictionary = moltypeDict
    elif defname == 'interaction':
1274
        dictionary = interaction
1275
    elif defname == 'sampling':
1276
        dictionary = sampling
1277
1278
    elif defname == 'singlevdw':
        dictionary = singlevdw
1279
1280
1281
    else:
        dictionary = singleconfcalclist
    return MapDictionary(dictionary)
Berk Onat's avatar
Berk Onat committed
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292

def set_excludeList(self):
    """Sets the exclude list for x_amber

    Returns:
        the list of names
    """
    excludelist = [
        'x_amber_mdin_verbatim_writeout',
        'x_amber_dumm_text',
        'x_amber_dummy',
1293
        'x_amber_mdin_wt'
Berk Onat's avatar
Berk Onat committed
1294
1295
        ]
    excludelist.extend(['x_amber_mdin_file_%s' % fileNL.lower() for fileNL in self.fileDict.keys()])
1296
1297
1298
    excludelist.extend(['x_amber_mdin_%s' % cntrlNL.lower() for cntrlNL in self.cntrlDict.keys()])
    excludelist.extend(['x_amber_mdin_%s' % ewaldNL.lower() for ewaldNL in self.ewaldDict.keys()])
    excludelist.extend(['x_amber_mdin_%s' % qmmmNL.lower() for qmmmNL in self.qmmmDict.keys()])
Berk Onat's avatar
Berk Onat committed
1299
1300
1301
1302
1303
1304
1305
1306
    return excludelist

def set_includeList():
    """Sets the include list for x_amber

    Returns:
        the list of names
    """
1307
    includelist = []
Berk Onat's avatar
Berk Onat committed
1308
1309
    return includelist

1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
def getList_MetaStrInDict(sourceDict):
    """Returns a list that includes all meta name 
       strings for the given dictionary.
       Meta name strings are not actual meta names but 
       used as the keywords in the parsing.
    """
    return [sourceDict[item].matchStr for item in sourceDict]

def getDict_MetaStrInDict(sourceDict):
    """Returns a dict that includes all meta name 
       strings and corresponding values for the given dictionary.
       Meta name strings are not actual meta names but 
       used as the keywords in the parsing.
    """
    newDict = {}
1325
1326
    for key, value in sourceDict.items():
        newDict.update({sourceDict[key].matchStr : key}) 
1327
1328
    return newDict

Berk Onat's avatar
Berk Onat committed
1329