NAMDDictionary.py 60.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Copyright 2018-2018 Berk Onat, Fawzi Mohamed
# 
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

Berk Onat's avatar
Berk Onat committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 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
import setup_paths
import numpy as np
from NAMDCommon import PARSERNAME, PROGRAMNAME, PARSERTAG
from nomadcore.smart_parser.SmartParserDictionary import metaNameConverter, metaNameConverter_UnderscoreSpaceDash
from nomadcore.smart_parser.SmartParserDictionary import MetaInfoMap, FileInfoMap, MapDictionary 
from nomadcore.smart_parser.SmartParserDictionary import getDict_MetaStrInDict, getList_MetaStrInDict, get_unitDict
import nomadcore.md_data_access.MDDataAccess as MDData

def get_fileListDict():
    """Loads dictionary for file namelists.

    Returns:
        the list of defaults file namelists
    """
    
    startpage = {
        'nameTranslate'   : metaNameConverter,
        'metaHeader'      : PARSERTAG,
        'metaNameTag'     : 'inout_file',
        'metaInfoType'    : 'C',
        'activeMetaNames' : [],
        'activeSections'  : [PARSERTAG+'_section_input_output_files']
        }
    namelist = {
        'structure'     : FileInfoMap(startpage, fileFormat=['.psf'], activeInfo=True, 
                                      infoPurpose=['topology', 'unitcell']),
        'traj_coord'    : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True, 
                                      infoPurpose=['trajectory', 'unitcell']),
        'traj_vel'      : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True,
                                      infoPurpose=['velocities']),
        'traj_force'    : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True, 
                                      infoPurpose=['forces']),
        'output_coord'  : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False,
                                      infoPurpose=['outputcoordinates', 'unitcell']),
        'output_vel'    : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False, 
                                      infoPurpose=['outputvelocities']),
        'output_force'  : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False, 
                                      infoPurpose=['outputforces']),
        'input_coord'   : FileInfoMap(startpage, fileFormat=['.pdb'],
                                      infoPurpose=['inputcoordinates', 'inputunitcell']),
        'input_vel'     : FileInfoMap(startpage, fileFormat=['.pdb'],
                                      infoPurpose=['inputvelocities']),
        'restart_coord' : FileInfoMap(startpage, fileFormat=['.cpt'],
                                      infoPurpose=['inputcoordinates', 'inputunitcell']),
        'restart_vel'   : FileInfoMap(startpage, fileFormat=['.cpt'],
                                      infoPurpose=['inputvelocities']),
        'fftw_datafile' : FileInfoMap(startpage, fileFormat=['.txt'], infoPurpose=['fftwdata']),
        'mdlog'         : FileInfoMap(startpage),
        }
    return MapDictionary(namelist)

def get_nameListDict(deflist):
    """Loads control in data of NAMD.

    Args:
        deflist: name list definition (cntrl/parm).

    matchWith parameters:
        EOL = End of line
        PL  = Match with previous line 
        PW  = Previous word
        NW  = Next word (until space, comma) (DEFAULT)
        UD  = until delimeter (can be any string/character)
        
        The text matched inside apostrophe or qoutation is extracted

    Returns:
        the list of namelists
    """
    startpage = {
        'nameTranslate'   : metaNameConverter_UnderscoreSpaceDash,
        'metaHeader'      : PARSERTAG,
        'metaNameTag'     : 'inout_control',
        'metaInfoType'    : 'C',
        'activeMetaNames' : [],
        'activeSections'  : [PARSERTAG+'_section_control_parameters'],
        }

    cntrllist = {
        'Info: TIMESTEP'          : MetaInfoMap(startpage, defaultValue=1,
                                                replaceTag='TIMESTEP'),
        'NUMBER OF STEPS'         : MetaInfoMap(startpage, defaultValue=0),
        'STEPS PER CYCLE'         : MetaInfoMap(startpage, defaultValue=1),
        'PERIODIC CELL BASIS 1'   : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'PERIODIC CELL BASIS 2'   : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'PERIODIC CELL BASIS 3'   : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'PERIODIC CELL CENTER'    : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'LOAD BALANCER'           : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'LOAD BALANCING STRATEGY' : MetaInfoMap(startpage, defaultValue="New Load Balancers", matchWith='EOL'),
        'LDB PERIOD'              : MetaInfoMap(startpage, defaultValue=None),
        'FIRST LDB TIMESTEP'      : MetaInfoMap(startpage, defaultValue=None),
        'LAST LDB TIMESTEP'       : MetaInfoMap(startpage, defaultValue=None),
        'LDB BACKGROUND SCALING'  : MetaInfoMap(startpage, defaultValue=None),
        'HOM BACKGROUND SCALING'  : MetaInfoMap(startpage, defaultValue=None),
        'PME BACKGROUND SCALING'  : MetaInfoMap(startpage, defaultValue=None),
        'MIN ATOMS PER PATCH'     : MetaInfoMap(startpage, defaultValue=None),
        'INITIAL TEMPERATURE'     : MetaInfoMap(startpage, defaultValue=None),
        'CENTER OF MASS MOVING INITIALLY?' : MetaInfoMap(startpage, defaultValue=None,
                                                         replaceTag='CENTER OF MASS MOVING INITIALLY'),
        'DIELECTRIC'              : MetaInfoMap(startpage, defaultValue=None),
115 116
        'EXCLUDE'                 : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL',
                                                         replaceTag='EXCLUDED SPECIES OR GROUPS'),
Berk Onat's avatar
Berk Onat committed
117 118
        '1-4 ELECTROSTATICS SCALED BY' : MetaInfoMap(startpage, defaultValue=None,
                                                     replaceTag='1-4 ELECTROSTATICS SCALE'),
119 120 121 122 123 124
        'Info: DCD FILENAME'      : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='TRAJ DCD FILENAME'),
        'Info: DCD FREQUENCY'     : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='TRAJ DCD FREQUENCY'),
        'Info: DCD FIRST STEP'    : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='TRAJ DCD FIRST STEP'),
Berk Onat's avatar
Berk Onat committed
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
        'VELOCITY DCD FILENAME'   : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY DCD FREQUENCY'  : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY DCD FIRST STEP' : MetaInfoMap(startpage, defaultValue=None),
        'FORCE DCD FILENAME'      : MetaInfoMap(startpage, defaultValue=None),
        'FORCE DCD FREQUENCY'     : MetaInfoMap(startpage, defaultValue=None),
        'FORCE DCD FIRST STEP'    : MetaInfoMap(startpage, defaultValue=None),
        'OUTPUT FILENAME'         : MetaInfoMap(startpage, defaultValue=None),
        'BINARY OUTPUT'           : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'RESTART FILENAME'        : MetaInfoMap(startpage, defaultValue=None),
        'RESTART FREQUENCY'       : MetaInfoMap(startpage, defaultValue=None),
        'BINARY RESTART'          : MetaInfoMap(startpage, defaultValue=None),
        'SWITCHING ACT'           : MetaInfoMap(startpage, defaultValue='Active',
                                                replaceTag='SWITCHING'),
        'SWITCHING ON'            : MetaInfoMap(startpage, defaultValue=None),
        'SWITCHING OFF'           : MetaInfoMap(startpage, defaultValue=None),
        'PAIRLIST DISTANCE'       : MetaInfoMap(startpage, defaultValue=None),
        'PAIRLIST SHRINK RATE'    : MetaInfoMap(startpage, defaultValue=None),
        'PAIRLIST GROW RATE'      : MetaInfoMap(startpage, defaultValue=None),
        'PAIRLIST TRIGGER'        : MetaInfoMap(startpage, defaultValue=None),
        'PAIRLISTS PER CYCLE'     : MetaInfoMap(startpage, defaultValue=None),
        'PAIRLISTS EN'            : MetaInfoMap(startpage, defaultValue='ENABLED',
                                                replaceTag='PAIRLISTS'),
        'MARGIN'                  : MetaInfoMap(startpage, defaultValue=None),
        'HYDROGEN GROUP CUTOFF'   : MetaInfoMap(startpage, defaultValue=None),
        'PATCH DIMENSION'         : MetaInfoMap(startpage, defaultValue=None),
        'ENERGY OUTPUT STEPS'     : MetaInfoMap(startpage, defaultValue=None),
        'CROSSTERM ENERGY'        : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'TIMING OUTPUT STEPS'     : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY RESCALE FREQ'   : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY RESCALE TEMP'   : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY REASSIGNMENT FREQ' : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY REASSIGNMENT TEMP' : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY REASSIGNMENT INCR' : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY REASSIGNMENT HOLD' : MetaInfoMap(startpage, defaultValue=None),
        'LOWE-ANDERSEN DYNAMICS'  : MetaInfoMap(startpage, defaultValue=None),
        'LOWE-ANDERSEN TEMPERATURE' : MetaInfoMap(startpage, defaultValue=None),
        'LOWE-ANDERSEN RATE'      : MetaInfoMap(startpage, defaultValue=None),
        'LOWE-ANDERSEN CUTOFF'    : MetaInfoMap(startpage, defaultValue=None),
        'LANGEVIN DYNAMICS'       : MetaInfoMap(startpage, defaultValue=None),
        'LANGEVIN TEMPERATURE'    : MetaInfoMap(startpage, defaultValue=None),
        'LANGEVIN USING'          : MetaInfoMap(startpage, defaultValue=None,
                                                 replaceTag='LANGEVIN INTEGRATOR'),
        'LANGEVIN DAMPING FILE IS' : MetaInfoMap(startpage, defaultValue=None,
                                                 replaceTag='LANGEVIN DAMPING FILE'),
        'LANGEVIN DAMPING COLUMN:' : MetaInfoMap(startpage, defaultValue=None,
                                                 replaceTag='LANGEVIN DAMPING COLUMN'),
        'LANGEVIN DAMPING COEFFICIENT IS' : MetaInfoMap(startpage, defaultValue=None,
                                                 replaceTag='LANGEVIN DAMPING COEFFICIENT UNIT'),
        'LANGEVIN DYNAMICS NOT APPLIED TO' : MetaInfoMap(startpage, defaultValue=None),
        'TEMPERATURE COUPLING'    : MetaInfoMap(startpage, defaultValue=None),
        'COUPLING TEMPERATURE'    : MetaInfoMap(startpage, defaultValue=None),
        'BERENDSEN PRESSURE COUPLING' : MetaInfoMap(startpage, defaultValue=None),
        'COMPRESSIBILITY ESTIMATE IS' : MetaInfoMap(startpage, defaultValue=None,
                                                    replaceTag='BERENDSEN COMPRESSIBILITY ESTIMATE'),
        'RELAXATION TIME IS' : MetaInfoMap(startpage, defaultValue=None,
                                                    replaceTag='BERENDSEN RELAXATION TIME'),
        'APPLIED EVERY'           : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='BERENDSEN COUPLING FREQUENCY'),
        'LANGEVIN PISTON PRESSURE CONTROL' : MetaInfoMap(startpage, defaultValue=None),
        'TARGET PRESSURE IS'      : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='TARGET PRESSURE'),
        'OSCILLATION PERIOD IS'   : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='LANGEVIN OSCILLATION PERIOD'),
        'DECAY TIME IS'           : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='LANGEVIN DECAY TIME'),
        'PISTON TEMPERATURE IS'   : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='LANGEVIN PISTON TEMPERATURE'),
        'PRESSURE CONTROL IS'     : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='PRESSURE CONTROL'),
        'INITIAL STRAIN RATE IS'  : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL',
                                                replaceTag='INITIAL STRAIN RATE'),
        'CELL FLUCTUATION IS'     : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='CELL FLUCTUATION'),
        'PARTICLE MESH EWALD \(PME\)' : MetaInfoMap(startpage, defaultValue=None,
199
                                                    replaceTag='PARTICLE MESH EWALD'),
Berk Onat's avatar
Berk Onat committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 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 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
        'PME TOLERANCE'           : MetaInfoMap(startpage, defaultValue=None),
        'PME EWALD COEFFICIENT'   : MetaInfoMap(startpage, defaultValue=None),
        'PME INTERPOLATION ORDER' : MetaInfoMap(startpage, defaultValue=None),
        'PME GRID DIMENSIONS'     : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'PME MAXIMUM GRID SPACING' : MetaInfoMap(startpage, defaultValue=None),
        'Writing FFTW data to'    : MetaInfoMap(startpage, defaultValue=None,
                                                    replaceTag='FFTW data file'),
        'FULL ELECTROSTATIC EVALUATION FREQUENCY' : MetaInfoMap(startpage, defaultValue=None),
        'MINIMIZATION'            : MetaInfoMap(startpage, defaultValue=None),
        'VELOCITY QUENCHING'      : MetaInfoMap(startpage, defaultValue=None),
        'USING VERLET I \(r-RESPA\)' : MetaInfoMap(startpage, defaultValue='r-RESPA',
                replaceTag='VERLET INTEGRATOR', subFunc=lambda x: 'r-RESPA' if x is not None else None),
        'RANDOM NUMBER SEED'      : MetaInfoMap(startpage, defaultValue=None),
        'USE HYDROGEN BONDS?'     : MetaInfoMap(startpage, defaultValue=None,
                                                replaceTag='USE HYDROGEN BONDS'),
        'COORDINATE PDB'          : MetaInfoMap(startpage, defaultValue=None),
        'STRUCTURE FILE'          : MetaInfoMap(startpage, defaultValue=None),
        'PARAMETER file'          : MetaInfoMap(startpage, defaultValue=None, matchWith='EOL'),
        'Info: PARAMETERS'        : MetaInfoMap(startpage, defaultValue=None, addAsList=True,
                                                replaceTag='PARAMETERS'),
        }

    startpage.update({
        'metaNameTag'     : 'mdout',
        'activeSections'  : ['section_single_configuration_calculation']
        })
    mddatalist = {
        'WRITING COORDINATES TO DCD FILE' : MetaInfoMap(startpage, 
            replaceTag='DCDSTEP', subFunc=lambda x: x.split()[-1].replace('\n','').strip()),
        'WRITING VELOCITIES TO DCD FILE AT STEP' : MetaInfoMap(startpage, 
            replaceTag='VELSTEP', subFunc=lambda x: x.replace('\n','').strip()),
        'WRITING FORCES TO DCD FILE AT STEP' : MetaInfoMap(startpage, 
            replaceTag='FORCESTEP', subFunc=lambda x: x.replace('\n','').strip()),
        'TS' : MetaInfoMap(startpage),
        'BOND' : MetaInfoMap(startpage),
        'ANGLE' : MetaInfoMap(startpage),
        'DIHED' : MetaInfoMap(startpage),
        'IMPRP' : MetaInfoMap(startpage),
        'ELECT' : MetaInfoMap(startpage),
        'VDW' : MetaInfoMap(startpage),
        'BOUNDARY' : MetaInfoMap(startpage),
        'MISC' : MetaInfoMap(startpage),
        'KINETIC' : MetaInfoMap(startpage),
        'TOTAL' : MetaInfoMap(startpage),
        'TEMP' : MetaInfoMap(startpage),
        'POTENTIAL' : MetaInfoMap(startpage),
        'TOTAL2' : MetaInfoMap(startpage),
        'TOTAL3' : MetaInfoMap(startpage),
        'TEMPAVG' : MetaInfoMap(startpage),
        'PRESSURE' : MetaInfoMap(startpage),
        'GPRESSURE' : MetaInfoMap(startpage),
        'VOLUME' : MetaInfoMap(startpage),
        'PRESSAVG' : MetaInfoMap(startpage),
        'GPRESSAVG' : MetaInfoMap(startpage),
        'Virial-Tensor' : MetaInfoMap(startpage),
        'Pressure-Tensor' : MetaInfoMap(startpage),
        'TIME' : MetaInfoMap(startpage),
        }

    startpage.update({
        'metaNameTag'     : 'parm',
        'activeSections'  : [PARSERTAG+'_mdin_method']
        })
    extralist = {
        'flags' : MetaInfoMap(startpage),
        'number_of_atoms' : MetaInfoMap(startpage),
        'minimization' : MetaInfoMap(startpage, activeInfo=True),
        'integrator' : MetaInfoMap(startpage, activeInfo=True),
        'thermostat' : MetaInfoMap(startpage, activeInfo=True),
        'barostat' : MetaInfoMap(startpage, activeInfo=True),
        '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)
        }

    if deflist == 'mddata':
        namelist = mddatalist
#    elif deflist == 'parm':
#        namelist = parmlist
    elif deflist == 'extra':
        namelist = extralist
    elif deflist == 'stepcontrol':
        namelist = stepcontrol
    else:
        namelist = cntrllist
    return MapDictionary(namelist)

def set_Dictionaries(self):
        self.unitDict = get_unitDict('si')
        self.fileDict = get_fileListDict()
        self.cntrlDict = get_nameListDict('cntrl')
        #self.parmDict = get_nameListDict('parm')
        self.mddataDict = get_nameListDict('mddata')
        self.extraDict = get_nameListDict('extra')
        self.mdoutHeaderDict = {}
        self.stepcontrolDict = {
            'logsteps'       : None,
            'nextlogsteps'   : None,
            'trajsteps'      : None, 
            'velsteps'       : None,
            'forcesteps'     : None,
            'steps'          : None,
            'follow'         : None,
            'sectioncontrol' : None,
        }
        self.metaDicts = {
            'file'   : self.fileDict,
            'cntrl'  : self.cntrlDict,
#            'parm'   : self.parmDict,
            'mddata' : self.mddataDict,
            'extra'  : self.extraDict,
            }
        self.sectionDict = { 
                'section' : { 
                    "metaNameTag"      : ['input_output_files', 
                                          'control_parameters'], 
                    "listTypStr"       : 'type_section', 
                    "repeatingSection" : False, 
                    "supraNames"       : ["section_run"]
                    }
                }

def get_updateDictionary(self, defname):

    def value_convert_array(itemdict):
        val = itemdict["value"]
        if(val is not None and isinstance(val, str)):
            if("[" in val or "(" in val):
                return False, np.asarray(val), itemdict
        return False, val, itemdict

    def value_convert_array_norm(itemdict):
        val = []
        depdict = itemdict["depends"]
        for item in depdict["value"]:
            st=self.metaStorage.fetchAttrValue(item)
            if(st is not None and isinstance(st, str)):
                if("[" in st or "(" in st):
                    val.append(list(storedtext))
        if val: 
            return False, np.linalg.norm(np.asarray(val)), itemdict
        else:
            return False, itemdict["value"], itemdict

    startpage = {
        'metaHeader'      : '',
        'metaNameTag'     : '',
        'activeMetaNames' : [],
        'activeSections'  : ['section_sampling_method','section_single_configuration_calculation',PARSERTAG+'_mdout']
        }

    # ---------------------------------------------------------------
    #   Definitions of meta data values for section_sampling_method
    # ---------------------------------------------------------------
    sampling = { 
        'ensemble_type' : MetaInfoMap(startpage, activeInfo=True,
            depends=[
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' in [\"tcouple\",'
                                          '\"rescale\",'
                                          '\"reassign\",'
                                          '\"andersen\",'
                                          '\"langevin\"]'], 
                           ['barostat', ' in [\"berendsen\",'
                                         '\"langevin\"]']], 
                 'assign' : 'NPT'},
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' in [\"langevin\"]'], 
                           ['thermostat', ' not in [\"tcouple\",'
                                          '\"rescale\",'
                                          '\"reassign\",'
                                          '\"andersen\"]'],
                           ['barostat', ' is None']],
                 'assign' : 'Langevin'},
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' in [\"tcouple\",'
                                          '\"rescale\",'
                                          '\"reassign\",'
                                          '\"andersen\"]'],
                           ['barostat', ' is None']],
                 'assign' : 'NVT'},
                {'test' : [['minimization', ' is None'],
                           ['thermostat', ' is None'],
                           ['barostat', ' is None']], 
                 'assign' : 'NVE'},
                {'test' : [['minimization', ' is not None']], 
                 'assign' : 'minimization'},
                ],
            lookupdict=self.extraDict
            ),
        'sampling_method' : MetaInfoMap(startpage, activeInfo=True, 
            depends=[
                {'test' : [['minimization', ' is not None']], 
                 'assign' : 'geometry_optimization'},
                {'test' : [['minimization', ' is None']],
                 'assign' : 'molecular_dynamics'}
                ],
            lookupdict=self.extraDict
            ),
#            'settings_geometry_optimization' : MetaInfoMap(startpage),
#            'settings_metadynamics' : MetaInfoMap(startpage),
#            'settings_molecular_dynamics' : MetaInfoMap(startpage),
406
#            'settings_monte_carlo' : MetaInfoMap(startpage),
Berk Onat's avatar
Berk Onat committed
407 408 409 410 411 412 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 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 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 577 578 579 580 581 582 583 584 585 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
#        'geometry_optimization_energy_change' : MetaInfoMap(startpage,
#            depends={
#                '' : {'imin' : '1'},
#                },
#            lookupdict=self.cntrlDict
#            ),
#       'geometry_optimization_geometry_change' : MetaInfoMap(startpage),
        'geometry_optimization_method' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['minimization', ' == \"cg\"']], 
                 'assign' : 'CG'},
                {'test' : [['minimization', ' == \"quench\"']], 
                 'assign' : 'Velocity Quenching'},
                ],
            lookupdict=self.extraDict,
            activeInfo=True,
            ),
#       'geometry_optimization_threshold_force' : MetaInfoMap(startpage),
        'x_namd_barostat_type' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['minimization', ' is None'], 
                           ['barostat', '== \"berendsen\"']],
                 'assign' : 'Berendsen'},
                {'test' : [['minimization', ' is None'], 
                           ['barostat', '== \"langevin\"']],
                 'assign' : 'Nose-Hoover Langevin'} 
                ],
            lookupdict=self.extraDict,
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_barostat']
            ),
        'x_namd_barostat_target_pressure' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['TARGET PRESSURE', ' is not None']],
                 'value' : 'TARGET PRESSURE'} 
                ],
            lookupdict=self.cntrlDict,
            valtype='float',
            unitdict=self.unitDict,
            unit='bar',
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_barostat']
            ),
        'x_namd_barostat_tau' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['LANGEVIN OSCILLATION PERIOD', ' is not None']],
                 'value' : 'LANGEVIN OSCILLATION PERIOD'}, 
                {'test' : [['BERENDSEN RELAXATION TIME', ' is not None']],
                 'value' : 'BERENDSEN RELAXATION TIME'} 
                ],
            lookupdict=self.cntrlDict,
            valtype='float',
            unitdict=self.unitDict,
            unit='femto-second',
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_barostat']
            ),
        'x_namd_integrator_type' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['integrator', ' is not None']],
                 'value' : 'integrator'}, 
                {'test' : [['thermostat', ' == \"langevin\"']],
                 'assign' : 'Langevin'}
                ],
            lookupdict=self.extraDict,
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_integrator']
            ),
        'x_namd_integrator_dt' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None']],
                 'value' : 'TIMESTEP'},
                ],
            lookupdict=self.cntrlDict,
            valtype='float',
            unitdict=self.unitDict,
            unit='femto-second',
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_integrator']
            ),
        'x_namd_number_of_steps_requested' : MetaInfoMap(startpage,
            depends=[{'value' : 'NUMBER OF STEPS'}],
            lookupdict=self.cntrlDict,
            valtype='int',
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_integrator']
            ),
        'x_namd_thermostat_type' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' == \"tcouple\"']],
                 'assign' : 'Berendsen'}, 
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' == \"rescale\"']],
                 'assign' : 'Velocity Rescaling'}, 
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' == \"reassign\"']],
                 'assign' : 'Velocity Reassigning'}, 
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' == \"andersen\"']],
                 'assign' : 'Andersen'}, 
                {'test' : [['minimization', ' is None'], 
                           ['thermostat', ' == \"langevin\"']], 
                 'assign' : 'Nose-Hoover Langevin'}, 
                ],
            lookupdict=self.extraDict,
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_thermostat']
            ),
        'x_namd_thermostat_target_temperature' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['VELOCITY RESCALE TEMP', ' is not None']],
                 'value' : 'VELOCITY RESCALE TEMP'},
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['VELOCITY REASSIGNMENT TEMP', ' is not None']],
                 'value' : 'VELOCITY REASSIGNMENT TEMP'},
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['LOWE-ANDERSEN TEMPERATURE', ' is not None']],
                 'value' : 'LOWE-ANDERSEN TEMPERATURE'},
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['LANGEVIN TEMPERATURE', ' is not None']],
                 'value' : 'LANGEVIN TEMPERATURE'},
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['COUPLING TEMPERATURE', ' is not None']],
                 'value' : 'COUPLING TEMPERATURE'},
                ],
            lookupdict=self.cntrlDict,
            valtype='float',
            unitdict=self.unitDict,
            unit='kelvin',
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_thermostat']
            ),
        'x_namd_thermostat_tau' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['VELOCITY RESCALE FREQ', ' is not None']],
                 'value' : 'VELOCITY RESCALE FREQ'},
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['VELOCITY REASSIGNMENT FREQ', ' is not None']],
                 'value' : 'VELOCITY REASSIGNMENT FREQ'},
                {'test' : [['MINIMIZATION', ' is None'],
                           ['VELOCITY QUENCHING', ' is None'],
                           ['LOWE-ANDERSEN RATE', ' is not None']],
                 'value' : 'LOWE-ANDERSEN RATE'},
                ],
            lookupdict=self.cntrlDict,
            valtype='float',
            unitdict=self.unitDict,
            unit='pico-second',
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_thermostat']
            ),
        'x_namd_periodicity_type' : MetaInfoMap(startpage,
            depends=[
                {'test' : [['PERIODIC CELL BASIS', ' is None']],
                 'assign' : 'no periodic boundaries'},
                {'test' : [['PERIODIC CELL BASIS', ' is not None']],
                 'assign' : 'periodic boundaries'}
                ],
            lookupdict=self.cntrlDict,
            #autoSections=True,
            activeInfo=True,
            activeSections=['settings_thermostat']
            )
        }

    # ------------------------------------------------------------
    #   Definitions for section_single_configuration_calculation
    # ------------------------------------------------------------
    singleconfcalc = { 
        #'atom_forces_type' : MetaInfoMap(startpage,
        #    depends=[{'assign' : 'Force Field'}],
        #    lookupdict=self.mddataDict
        #    ),
        'energy_correction_entropy' : MetaInfoMap(startpage),
        #'energy_current' : MetaInfoMap(startpage,
        #    depends=[{'value' : 'EPtot'}],
        #    lookupdict=self.mddataDict
        #    ),
        'energy_current' : MetaInfoMap(startpage),
        'energy_electrostatic' : MetaInfoMap(startpage,
            depends=[{'value' : 'ELECT'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            activeInfo=True,
            lookupdict=self.mddataDict
            ),
        'energy_free_per_atom' : MetaInfoMap(startpage),
        'energy_free' : MetaInfoMap(startpage),
        #'energy_method_current' : MetaInfoMap(startpage,
        #    depends=[{'assign' : 'Force Field'}],
        #    lookupdict=self.mddataDict
        #    ),
620 621 622
        'energy_t0_per_atom' : MetaInfoMap(startpage),
        'energy_total_t0_per_atom' : MetaInfoMap(startpage),
        'energy_total_t0' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
            depends=[{'value' : 'POTENTIAL'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            activeInfo=True,
            lookupdict=self.mddataDict
            ),
        'energy_total' : MetaInfoMap(startpage,
            depends=[{'value' : 'TOTAL'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            activeInfo=True,
            lookupdict=self.mddataDict
            ),
        'hessian_matrix' : MetaInfoMap(startpage),
        'single_configuration_calculation_converged' : MetaInfoMap(startpage),
        'single_configuration_calculation_to_system_ref' : MetaInfoMap(startpage),
641
        'single_configuration_calculation_to_method_ref' : MetaInfoMap(startpage),
Berk Onat's avatar
Berk Onat committed
642 643 644 645 646 647 648
        '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),
649 650 651 652 653 654 655 656 657 658
        #'stress_tensor_kind' : MetaInfoMap(startpage,
        #    depends=[
        #        {'test' : [['minimization', ' is not None']], 
        #         'assign' : 'geometry_optimization'},
        #        {'test' : [['minimization', ' is None']],
        #         'assign' : 'molecular_dynamics'}
        #        ],
        #    activeInfo=True,
        #    lookupdict=self.extraDict
        #    ),
Berk Onat's avatar
Berk Onat committed
659 660 661 662 663
        'stress_tensor_value' : MetaInfoMap(startpage)
        }

    # section_single_energy_van_der_Waals of section_single_configuration_calculation
    singlevdw = {
664
        'energy_van_der_waals_value' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
665 666 667 668 669 670
            depends=[{'value' : 'VDW'}],
            lookupdict=self.mddataDict,
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            #autoSections=True,
671
            activeSections=['section_energy_van_der_waals']
Berk Onat's avatar
Berk Onat committed
672 673 674 675 676 677 678
            ),
        }
   
    # ------------------------------------------
    #   Definitions for section_frame_sequence
    # ------------------------------------------
    frameseq = { 
679
        #'xxx_to_rm_frame_sequence_conserved_quantity_frames' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
680 681 682 683 684
        #    depends=[{'store' : 'TS'}],
        #    valtype='int',
        #    lookupdict=self.mddataDict
        #    ),
        #'frame_sequence_conserved_quantity_stats' : MetaInfoMap(startpage),
685
        #'xxx_conserved_quantity' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
686 687 688 689 690 691 692 693
        #    depends=[{'store' : ''}],
        #    valtype='float',
        #    unitdict=self.unitDict,
        #    unit='kilo-joule/mol',
        #    lookupdict=self.mddataDict
        #    ),
        'frame_sequence_continuation_kind' : MetaInfoMap(startpage),
        'frame_sequence_external_url' : MetaInfoMap(startpage),
694
        'xxx_to_rm_frame_sequence_kinetic_energy_frames' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
695 696 697 698 699
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_kinetic_energy_stats' : MetaInfoMap(startpage),
700
        'xxx_kinetic_energy' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
701 702 703 704 705 706
            depends=[{'store' : 'KINETIC'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
707 708
        'frame_sequence_to_frames_ref' : MetaInfoMap(startpage),
        'xxx_to_rm_frame_sequence_potential_energy_frames' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
709 710 711 712 713
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_potential_energy_stats' : MetaInfoMap(startpage),
714
        'xxx_potential_energy' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732
            depends=[{'store' : 'POTENTIAL'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_pressure_average_frames' : MetaInfoMap(startpage,
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_pressure_average' : MetaInfoMap(startpage,
            depends=[{'store' : 'PRESSAVG'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='bar',
            lookupdict=self.mddataDict
            ),
733
        'xxx_to_rm_frame_sequence_pressure_frames' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
734 735 736 737 738
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_pressure_stats' : MetaInfoMap(startpage),
739
        'xxx_instant_pressure' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757
            depends=[{'store' : 'PRESSURE'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='bar',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_temperature_average_frames' : MetaInfoMap(startpage,
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_temperature_average' : MetaInfoMap(startpage,
            depends=[{'store' : 'TEMPAVG'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='Kelvin',
            lookupdict=self.mddataDict
            ),
758
        'xxx_to_rm_frame_sequence_temperature_frames' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
759 760 761 762 763
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_temperature_stats' : MetaInfoMap(startpage),
764
        'xxx_instant_temperature' : MetaInfoMap(startpage,
Berk Onat's avatar
Berk Onat committed
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 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 938 939 940 941 942 943 944 945
            depends=[{'store' : 'TEMP'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='Kelvin',
            lookupdict=self.mddataDict
            ),
        'frame_sequence_time' : MetaInfoMap(startpage,
            depends=[{'store' : 'TIME'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='pico-second',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_volume_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_volume' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'VOLUME'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='Angstrom**3',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_boundary_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_boundary' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'BOUNDARY'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_bond_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_bond_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'BOND'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_angle_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_angle_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'ANGLE'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_proper_dihedral_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_proper_dihedral_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'DIHED'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_improper_dihedral_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_improper_dihedral_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'IMPRP'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_cmap_dihedral_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_cmap_dihedral_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'CMAP'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_vdw_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_vdw_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'VDW'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_electrostatic_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_electrostatic_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'ELECT'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_total2_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_total2_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TOTAL2'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_total3_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_total3_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TOTAL3'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_misc_energy_frames' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'TS'}],
            valtype='int',
            lookupdict=self.mddataDict
            ),
        'x_namd_frame_sequence_misc_energy' : MetaInfoMap(startpage,
            activeSections=['section_frame_sequence'],
            depends=[{'store' : 'MISC'}],
            valtype='float',
            unitdict=self.unitDict,
            unit='kilo-joule/mol',
            lookupdict=self.mddataDict
            ),
946
        #'frame_sequence_to_sampling_method_ref' : MetaInfoMap(startpage),
Berk Onat's avatar
Berk Onat committed
947 948 949 950 951 952 953 954 955 956 957 958
        'geometry_optimization_converged' : MetaInfoMap(startpage,
            value=self.minConverged
            ),
        #'previous_sequence_ref' : MetaInfoMap(startpage)
        }

    frameseqend = { 
        #'number_of_conserved_quantity_evaluations_in_sequence' : MetaInfoMap(startpage,
        #    activeInfo=True,
        #    value=(lambda x: np.array(x['val']).flatten().shape[0] if(
        #        x is not None and x['val'] is not None) else None)(
        #        self.metaStorage.fetchAttrValue(
959
        #            'xxx_to_rm_frame_sequence_conserved_quantity_frames'
Berk Onat's avatar
Berk Onat committed
960 961 962 963 964 965 966
        #            )
        #        )
        #    ),
        'number_of_frames_in_sequence' : MetaInfoMap(startpage, activeInfo=True,
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
967
                    'xxx_to_rm_frame_sequence_potential_energy_frames'
Berk Onat's avatar
Berk Onat committed
968 969 970 971 972 973 974
                    )
                )
            ),
        'number_of_kinetic_energies_in_sequence' : MetaInfoMap(startpage, activeInfo=True,
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
975
                    'xxx_to_rm_frame_sequence_kinetic_energy_frames'
Berk Onat's avatar
Berk Onat committed
976 977 978 979 980 981 982 983
                    )
                )
            ),
        'number_of_potential_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
984
                    'xxx_to_rm_frame_sequence_potential_energy_frames'
Berk Onat's avatar
Berk Onat committed
985 986 987 988 989 990 991 992
                    )
                )
            ),
        'number_of_pressure_evaluations_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
993
                    'xxx_to_rm_frame_sequence_pressure_frames'
Berk Onat's avatar
Berk Onat committed
994 995 996 997 998 999 1000 1001
                    )
                )
            ),
        'number_of_temperatures_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
1002
                    'xxx_to_rm_frame_sequence_temperature_frames'
Berk Onat's avatar
Berk Onat committed
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146
                    )
                )
            ),
        'x_namd_number_of_volumes_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_volume_frames'
                    )
                )
            ),
        'x_namd_number_of_boundary_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_boundary_frames'
                    )
                )
            ),
        'x_namd_number_of_bond_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_bond_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_angle_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_angle_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_electrostatic_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_electrostatic_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_vdw_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_vdw_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_total2_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_total2_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_total3_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_total3_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_proper_dihedral_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_proper_dihedral_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_improper_dihedral_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_improper_dihedral_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_cmap_dihedral_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_cmap_dihedral_energy_frames'
                    )
                )
            ),
        'x_namd_number_of_misc_energies_in_sequence' : MetaInfoMap(startpage,
            activeInfo=True,
            activeSections=['section_frame_sequence'],
            value=(lambda x: np.array(x['val']).flatten().shape[0] if(
                x is not None and x['val'] is not None) else None)(
                self.metaStorage.fetchAttrValue(
                    'x_namd_frame_sequence_misc_energy_frames'
                    )
                )
            ),
        #'previous_sequence_ref' : MetaInfoMap(startpage)
        }

    # ----------------------------------
    #   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,
            depends=[{'value' : 'number_of_atoms'}],
            valtype='int',
            lookupdict=self.extraDict
            ),
        'number_of_sites' : MetaInfoMap(startpage),
        'number_of_symmetry_operations' : MetaInfoMap(startpage),
        'reduced_symmetry_matrices' : MetaInfoMap(startpage),
        'reduced_symmetry_translations' : MetaInfoMap(startpage),
1147
        'sc_matrix' : MetaInfoMap(startpage),
Berk Onat's avatar
Berk Onat committed
1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 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 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323
        '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={ 
                'function' : MDData.MDDataConverter.topology_system_name,
                'supportDict' : self.topoDict,
                },
            #functionbase=self
            ),
        'time_reversal_symmetry' : MetaInfoMap(startpage)
        }

    # section_configuration_core of section_system
    configuration_core = {
        'number_of_electrons' : MetaInfoMap(startpage,
            #value=0,
            #valtype='float',
            ),
        'atom_labels' : MetaInfoMap(startpage,
            #subfunction=self.system_atom_labels()
            ),
        'atom_positions' : MetaInfoMap(startpage,
            #subfunction=self.system_atom_positions()
            ),
        'configuration_periodic_dimensions' : MetaInfoMap(startpage,
            ),
        'embedded_system' : MetaInfoMap(startpage),
        'lattice_vectors' : MetaInfoMap(startpage,
            #subfunction=self.system_lattice_vectors()
            ),
        'simulation_cell' : MetaInfoMap(startpage,
            #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={
                'function' : MDData.MDDataConverter.topology_atom_to_mol,
                'supportDict' : self.topoDict,
                },
            #functionbase=self
            ),
        'molecule_to_molecule_type_map' : MetaInfoMap(startpage),
        'number_of_topology_atoms' : MetaInfoMap(startpage,
            depends=[{'value' : 'number_of_atoms'}],
            valtype='int',
            lookupdict=self.extraDict
            ),
        'number_of_topology_molecules' : MetaInfoMap(startpage,
            subfunction={
                'function' : MDData.MDDataConverter.topology_num_topo_mol,
                'supportDict' : self.topoDict,
                },
            valtype='int',
            ),
        'topology_force_field_name' : MetaInfoMap(startpage,
            depends=[{'value' : 'PARAMETER file'}],
            lookupdict=self.cntrlDict
            )
        }

    # section_atom_type of section_topology
    atom_type = {
        'atom_type_charge' : MetaInfoMap(startpage),
        'atom_type_mass' : MetaInfoMap(startpage),
        'atom_type_name' : MetaInfoMap(startpage)
        }

    # 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
    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)
        }

    # -------------------------------------------------------------
    #   Definitions of meta data values for section_molecule_type
    # -------------------------------------------------------------
    # section_molecule_type of section_topology
    mol_type = {
        'molecule_type_name' : MetaInfoMap(startpage),
        'number_of_atoms_in_molecule' : MetaInfoMap(startpage),
        'settings_atom_in_molecule' : MetaInfoMap(startpage)
        }

    # 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 = {
        '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)
        }
   
    # section_atom_in_molecule of section_molecule_type
    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':
        dictionary = topology
    elif defname == 'singleconfcalc':
        dictionary = singleconfcalc
    elif defname == 'frameseq':
        dictionary = frameseq
    elif defname == 'frameseqend':
        dictionary = frameseqend
    elif defname == 'atom_type':
        dictionary = atom_type
    elif defname == 'molecule_type':
        dictionary = moltypeDict
    elif defname == 'interaction':
        dictionary = interaction
    elif defname == 'sampling':
        dictionary = sampling
    elif defname == 'singlevdw':
        dictionary = singlevdw
    elif defname == 'confcore':
        dictionary = configuration_core
    else:
        dictionary = singleconfcalclist
    return MapDictionary(dictionary)