Commit 8cc4a62c authored by Berk Onat's avatar Berk Onat
Browse files

Data of frame_sequence and single_conf_calc sections are generated in correct order.

parent 488d0409
...@@ -25,6 +25,7 @@ class MetaInfoMap(dict): ...@@ -25,6 +25,7 @@ class MetaInfoMap(dict):
lookupdict=None lookupdict=None
subfunction=None subfunction=None
activeSections=None activeSections=None
autoSections=False
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(MetaInfoMap, self).__init__(*args, **kwargs) super(MetaInfoMap, self).__init__(*args, **kwargs)
...@@ -163,6 +164,10 @@ class MapDictionary(dict): ...@@ -163,6 +164,10 @@ class MapDictionary(dict):
def metaNameConverter(keyName): def metaNameConverter(keyName):
newName = keyName.lower().replace(" ", "").replace("-", "") newName = keyName.lower().replace(" ", "").replace("-", "")
newName = newName.replace("(", "").replace(")", "")
newName = newName.replace("[", "").replace("]", "")
newName = newName.replace(",", "").replace(".", "")
newName = newName.replace("\\", "").replace("/", "")
return newName return newName
def get_fileListDict(): def get_fileListDict():
...@@ -340,9 +345,9 @@ def get_nameListDict(deflist): ...@@ -340,9 +345,9 @@ def get_nameListDict(deflist):
'ew_type' : MetaInfoMap(startpage, defaultValue=0), 'ew_type' : MetaInfoMap(startpage, defaultValue=0),
'dsum_tol' : MetaInfoMap(startpage, defaultValue=1.0E-5), 'dsum_tol' : MetaInfoMap(startpage, defaultValue=1.0E-5),
'rsum_tol' : MetaInfoMap(startpage, defaultValue=5.0E-5), 'rsum_tol' : MetaInfoMap(startpage, defaultValue=5.0E-5),
'mlimit(1)' : MetaInfoMap(startpage), 'mlimit\(1\)' : MetaInfoMap(startpage),
'mlimit(2)' : MetaInfoMap(startpage), 'mlimit\(2\)' : MetaInfoMap(startpage),
'mlimit(3)' : MetaInfoMap(startpage), 'mlimit\(3\)' : MetaInfoMap(startpage),
'ew_coeff' : MetaInfoMap(startpage), 'ew_coeff' : MetaInfoMap(startpage),
'nbflag' : MetaInfoMap(startpage, defaultValue=1), 'nbflag' : MetaInfoMap(startpage, defaultValue=1),
'skinnb' : MetaInfoMap(startpage, defaultValue=2.0), 'skinnb' : MetaInfoMap(startpage, defaultValue=2.0),
...@@ -514,8 +519,8 @@ def get_nameListDict(deflist): ...@@ -514,8 +519,8 @@ def get_nameListDict(deflist):
}) })
mddatalist = { mddatalist = {
'NSTEP' : MetaInfoMap(startpage), 'NSTEP' : MetaInfoMap(startpage),
'TIME' : MetaInfoMap(startpage), 'TIME\(PS\)' : MetaInfoMap(startpage),
'TEMP' : MetaInfoMap(startpage), 'TEMP\(K\)' : MetaInfoMap(startpage),
'PRESS' : MetaInfoMap(startpage), 'PRESS' : MetaInfoMap(startpage),
'Etot' : MetaInfoMap(startpage), 'Etot' : MetaInfoMap(startpage),
'EKtot' : MetaInfoMap(startpage), 'EKtot' : MetaInfoMap(startpage),
...@@ -653,6 +658,27 @@ def get_updateDictionary(self, defname): ...@@ -653,6 +658,27 @@ def get_updateDictionary(self, defname):
'assign' : 'Monte Carlo barostat'} 'assign' : 'Monte Carlo barostat'}
], ],
lookupdict=self.cntrlDict, lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_barostat']
),
'x_amber_barostat_target_pressure' : MetaInfoMap(startpage,
depends=[
{'test' : [['imin', '== 0'],
['ntp', '!= 0']],
'value' : 'pres0'}
],
lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_barostat']
),
'x_amber_barostat_tau' : MetaInfoMap(startpage,
depends=[
{'test' : [['imin', '== 0'],
['ntp', '!= 0']],
'value' : 'taup'}
],
lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_barostat'] activeSections=['settings_barostat']
), ),
'x_amber_integrator_type' : MetaInfoMap(startpage, 'x_amber_integrator_type' : MetaInfoMap(startpage,
...@@ -663,6 +689,22 @@ def get_updateDictionary(self, defname): ...@@ -663,6 +689,22 @@ def get_updateDictionary(self, defname):
'assign' : 'minimization'} 'assign' : 'minimization'}
], ],
lookupdict=self.cntrlDict, lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_integrator']
),
'x_amber_integrator_dt' : MetaInfoMap(startpage,
depends=[
{'test' : [['imin', '== 0']],
'value' : 'dt'}
],
lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_integrator']
),
'x_amber_number_of_steps_requested' : MetaInfoMap(startpage,
depends=[{'value' : 'nstlim'}],
lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_integrator'] activeSections=['settings_integrator']
), ),
'x_amber_thermostat_type' : MetaInfoMap(startpage, 'x_amber_thermostat_type' : MetaInfoMap(startpage,
...@@ -679,8 +721,53 @@ def get_updateDictionary(self, defname): ...@@ -679,8 +721,53 @@ def get_updateDictionary(self, defname):
'assign' : 'RESPA Stochastic Isokinetic Nose-Hoover'} 'assign' : 'RESPA Stochastic Isokinetic Nose-Hoover'}
], ],
lookupdict=self.cntrlDict, lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_thermostat']
),
'x_amber_thermostat_target_temperature' : MetaInfoMap(startpage,
depends=[
{'test' : [['imin', '== 0'], ['ntt', '> 0']],
'value' : 'temp0'}
],
lookupdict=self.cntrlDict,
#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,
#autoSections=True,
activeSections=['settings_thermostat']
),
'x_amber_langevin_gamma' : MetaInfoMap(startpage,
depends=[
{'test' : [['imin', '== 0'], ['ntt', '== 3']],
'value' : 'gamma_ln'}
],
lookupdict=self.cntrlDict,
#autoSections=True,
activeSections=['settings_thermostat'] activeSections=['settings_thermostat']
), ),
'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']
)
} }
singleconfcalc = { singleconfcalc = {
...@@ -689,10 +776,11 @@ def get_updateDictionary(self, defname): ...@@ -689,10 +776,11 @@ def get_updateDictionary(self, defname):
# lookupdict=self.mddataDict # lookupdict=self.mddataDict
# ), # ),
'energy_correction_entropy' : MetaInfoMap(startpage), 'energy_correction_entropy' : MetaInfoMap(startpage),
'energy_current' : MetaInfoMap(startpage, #'energy_current' : MetaInfoMap(startpage,
depends=[{'value' : 'Etot'}], # depends=[{'value' : 'EPtot'}],
lookupdict=self.mddataDict # lookupdict=self.mddataDict
), # ),
'energy_current' : MetaInfoMap(startpage),
'energy_electrostatic' : MetaInfoMap(startpage, 'energy_electrostatic' : MetaInfoMap(startpage,
depends=[{'value' : 'EELEC'}], depends=[{'value' : 'EELEC'}],
lookupdict=self.mddataDict lookupdict=self.mddataDict
...@@ -700,7 +788,7 @@ def get_updateDictionary(self, defname): ...@@ -700,7 +788,7 @@ def get_updateDictionary(self, defname):
'energy_free_per_atom' : MetaInfoMap(startpage), 'energy_free_per_atom' : MetaInfoMap(startpage),
'energy_free' : MetaInfoMap(startpage), 'energy_free' : MetaInfoMap(startpage),
'energy_method_current' : MetaInfoMap(startpage, 'energy_method_current' : MetaInfoMap(startpage,
depends=[{'assign' : 'Amber Force Field'}], depends=[{'assign' : 'Force Field'}],
lookupdict=self.mddataDict lookupdict=self.mddataDict
), ),
'energy_T0_per_atom' : MetaInfoMap(startpage), 'energy_T0_per_atom' : MetaInfoMap(startpage),
...@@ -710,7 +798,6 @@ def get_updateDictionary(self, defname): ...@@ -710,7 +798,6 @@ def get_updateDictionary(self, defname):
depends=[{'value' : 'Etot'}], depends=[{'value' : 'Etot'}],
lookupdict=self.mddataDict lookupdict=self.mddataDict
), ),
'energy_type_van_der_Waals' : MetaInfoMap(startpage),
'hessian_matrix' : MetaInfoMap(startpage), 'hessian_matrix' : MetaInfoMap(startpage),
'single_configuration_calculation_converged' : MetaInfoMap(startpage), 'single_configuration_calculation_converged' : MetaInfoMap(startpage),
'single_configuration_calculation_to_system_ref' : MetaInfoMap(startpage), 'single_configuration_calculation_to_system_ref' : MetaInfoMap(startpage),
...@@ -725,6 +812,15 @@ def get_updateDictionary(self, defname): ...@@ -725,6 +812,15 @@ def get_updateDictionary(self, defname):
'stress_tensor_kind' : MetaInfoMap(startpage), 'stress_tensor_kind' : MetaInfoMap(startpage),
'stress_tensor_value' : MetaInfoMap(startpage) 'stress_tensor_value' : MetaInfoMap(startpage)
} }
singlevdw = {
'energy_van_der_Waals_value' : MetaInfoMap(startpage,
depends=[{'value' : 'VDWAALS'}],
lookupdict=self.mddataDict,
#autoSections=True,
activeSections=['section_energy_van_der_Waals']
),
}
frameseq = { frameseq = {
'frame_sequence_conserved_quantity_frames' : MetaInfoMap(startpage, 'frame_sequence_conserved_quantity_frames' : MetaInfoMap(startpage,
...@@ -772,11 +868,11 @@ def get_updateDictionary(self, defname): ...@@ -772,11 +868,11 @@ def get_updateDictionary(self, defname):
), ),
'frame_sequence_temperature_stats' : MetaInfoMap(startpage), 'frame_sequence_temperature_stats' : MetaInfoMap(startpage),
'frame_sequence_temperature' : MetaInfoMap(startpage, 'frame_sequence_temperature' : MetaInfoMap(startpage,
depends=[{'store' : 'TEMP'}], depends=[{'store' : 'TEMP\(K\)'}],
lookupdict=self.mddataDict lookupdict=self.mddataDict
), ),
'frame_sequence_time' : MetaInfoMap(startpage, 'frame_sequence_time' : MetaInfoMap(startpage,
depends=[{'store' : 'TIME'}], depends=[{'store' : 'TIME\(PS\)'}],
lookupdict=self.mddataDict lookupdict=self.mddataDict
), ),
'x_amber_frame_sequence_volume_frames' : MetaInfoMap(startpage, 'x_amber_frame_sequence_volume_frames' : MetaInfoMap(startpage,
...@@ -796,13 +892,51 @@ def get_updateDictionary(self, defname): ...@@ -796,13 +892,51 @@ def get_updateDictionary(self, defname):
lookupdict=self.mddataDict lookupdict=self.mddataDict
), ),
'frame_sequence_to_sampling_ref' : MetaInfoMap(startpage), 'frame_sequence_to_sampling_ref' : MetaInfoMap(startpage),
'geometry_optimization_converged' : MetaInfoMap(startpage), 'geometry_optimization_converged' : MetaInfoMap(startpage,
'number_of_conserved_quantity_evaluations_in_sequence' : MetaInfoMap(startpage), value=self.minConverged
'number_of_frames_in_sequence' : MetaInfoMap(startpage), ),
'number_of_kinetic_energies_in_sequence' : MetaInfoMap(startpage), 'number_of_conserved_quantity_evaluations_in_sequence' : MetaInfoMap(startpage,
'number_of_potential_energies_in_sequence' : MetaInfoMap(startpage), value=len([
'number_of_pressure_evaluations_in_sequence' : MetaInfoMap(startpage), item for item in self.metaStorage.fetchAttr(
'number_of_temperatures_in_sequence' : MetaInfoMap(startpage), {'frame_sequence_conserved_quantity_frames' : None}
)['frame_sequence_conserved_quantity_frames']
])
),
'number_of_frames_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
{'frame_sequence_potential_energy_frames' : None}
)['frame_sequence_potential_energy_frames']
])
),
'number_of_kinetic_energies_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
{'frame_sequence_kinetic_energy_frames' : None}
)['frame_sequence_kinetic_energy_frames']
])
),
'number_of_potential_energies_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
{'frame_sequence_potential_energy_frames' : None}
)['frame_sequence_potential_energy_frames']
])
),
'number_of_pressure_evaluations_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
{'frame_sequence_pressure_frames' : None}
)['frame_sequence_pressure_frames']
])
),
'number_of_temperatures_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
{'frame_sequence_temperature_frames' : None}
)['frame_sequence_temperature_frames']
])
),
'previous_sequence_ref' : MetaInfoMap(startpage) 'previous_sequence_ref' : MetaInfoMap(startpage)
} }
...@@ -893,6 +1027,8 @@ def get_updateDictionary(self, defname): ...@@ -893,6 +1027,8 @@ def get_updateDictionary(self, defname):
dictionary = interaction dictionary = interaction
elif defname == 'sampling': elif defname == 'sampling':
dictionary = sampling dictionary = sampling
elif defname == 'singlevdw':
dictionary = singlevdw
else: else:
dictionary = singleconfcalclist dictionary = singleconfcalclist
return MapDictionary(dictionary) return MapDictionary(dictionary)
...@@ -907,6 +1043,7 @@ def set_excludeList(self): ...@@ -907,6 +1043,7 @@ def set_excludeList(self):
'x_amber_mdin_verbatim_writeout', 'x_amber_mdin_verbatim_writeout',
'x_amber_dumm_text', 'x_amber_dumm_text',
'x_amber_dummy', 'x_amber_dummy',
'x_amber_mdin_wt'
] ]
excludelist.extend(['x_amber_mdin_file_%s' % fileNL.lower() for fileNL in self.fileDict.keys()]) excludelist.extend(['x_amber_mdin_file_%s' % fileNL.lower() for fileNL in self.fileDict.keys()])
excludelist.extend(['x_amber_mdin_%s' % cntrlNL.lower() for cntrlNL in self.cntrlDict.keys()]) excludelist.extend(['x_amber_mdin_%s' % cntrlNL.lower() for cntrlNL in self.cntrlDict.keys()])
...@@ -920,9 +1057,7 @@ def set_includeList(): ...@@ -920,9 +1057,7 @@ def set_includeList():
Returns: Returns:
the list of names the list of names
""" """
includelist = [ includelist = []
'x_amber_mdin_wt'
]
return includelist return includelist
def getList_MetaStrInDict(sourceDict): def getList_MetaStrInDict(sourceDict):
...@@ -940,8 +1075,8 @@ def getDict_MetaStrInDict(sourceDict): ...@@ -940,8 +1075,8 @@ def getDict_MetaStrInDict(sourceDict):
used as the keywords in the parsing. used as the keywords in the parsing.
""" """
newDict = {} newDict = {}
for item in sourceDict: for key, value in sourceDict.items():
newDict.update({sourceDict[item].matchStr : sourceDict[item]}) newDict.update({sourceDict[key].matchStr : key})
return newDict return newDict
...@@ -7,7 +7,7 @@ import nomadcore.ActivateLogging ...@@ -7,7 +7,7 @@ import nomadcore.ActivateLogging
from nomadcore.caching_backend import CachingLevel from nomadcore.caching_backend import CachingLevel
from nomadcore.simple_parser import AncillaryParser, mainFunction, ParsingContext from nomadcore.simple_parser import AncillaryParser, mainFunction, ParsingContext
from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.simple_parser import SimpleMatcher as SM
from AMBERDictionary import set_excludeList, set_includeList, get_updateDictionary, getList_MetaStrInDict from AMBERDictionary import set_excludeList, set_includeList, get_updateDictionary, getList_MetaStrInDict, getDict_MetaStrInDict
import AMBERCommon as AmberC import AMBERCommon as AmberC
import trajectory_reader as TrajRead import trajectory_reader as TrajRead
import logging import logging
...@@ -37,7 +37,6 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -37,7 +37,6 @@ class AMBERParser(AmberC.AMBERParserBase):
def __init__(self): def __init__(self):
# dictionary of energy values, which are tracked between SCF iterations and written after convergence # dictionary of energy values, which are tracked between SCF iterations and written after convergence
self.totalEnergyList = { self.totalEnergyList = {
'electronic_kinetic_energy': None,
'energy_electrostatic': None, 'energy_electrostatic': None,
'energy_total_T0_per_atom': None, 'energy_total_T0_per_atom': None,
'energy_free_per_atom': None, 'energy_free_per_atom': None,
...@@ -49,8 +48,9 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -49,8 +48,9 @@ class AMBERParser(AmberC.AMBERParserBase):
'x_amber_trajectory_file_detect': CachingLevel.Cache, 'x_amber_trajectory_file_detect': CachingLevel.Cache,
'x_amber_geometry_optimization_cdetect': CachingLevel.Cache, 'x_amber_geometry_optimization_cdetect': CachingLevel.Cache,
'x_amber_mdin_finline': CachingLevel.Ignore, 'x_amber_mdin_finline': CachingLevel.Ignore,
'x_amber_mdin_wt': CachingLevel.Ignore,
'x_amber_single_configuration_calculation_detect': CachingLevel.Cache, 'x_amber_single_configuration_calculation_detect': CachingLevel.Cache,
'x_amber_single_configuration_calculation': CachingLevel.Cache, #'x_amber_single_configuration_calculation': CachingLevel.Cache,
} }
for name in self.metaInfoEnv.infoKinds: for name in self.metaInfoEnv.infoKinds:
metaInfo = self.metaInfoEnv.infoKinds[name] metaInfo = self.metaInfoEnv.infoKinds[name]
...@@ -82,9 +82,11 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -82,9 +82,11 @@ class AMBERParser(AmberC.AMBERParserBase):
This allows a consistent setting and resetting of the variables, This allows a consistent setting and resetting of the variables,
when the parsing starts and when a section_run closes. when the parsing starts and when a section_run closes.
""" """
self.secMethodIndex = None self.secMethodGIndex = None
self.secSystemDescriptionIndex = None self.secSystemGIndex = None
self.samplingGIndex = None self.secSamplingGIndex = None
self.secSingleGIndex = None
self.secVDWGIndex = None
self.inputMethodIndex = None self.inputMethodIndex = None
self.mainMethodIndex = None self.mainMethodIndex = None
self.mainCalcIndex = None self.mainCalcIndex = None
...@@ -101,7 +103,7 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -101,7 +103,7 @@ class AMBERParser(AmberC.AMBERParserBase):
# start with -1 since zeroth iteration is the initialization # start with -1 since zeroth iteration is the initialization
self.mdIterNr = -1 self.mdIterNr = -1
self.singleConfCalcs = [] self.singleConfCalcs = []
self.minConvergence = None self.minConverged = None
self.parsedLogFile = False self.parsedLogFile = False
self.LogSuperContext = None self.LogSuperContext = None
self.forces_raw = [] self.forces_raw = []
...@@ -192,16 +194,6 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -192,16 +194,6 @@ class AMBERParser(AmberC.AMBERParserBase):
#else: #else:
# return False # return False
#def compile_traj_parser(self):
# """Instantiate superContext and construct parser for MD trajactory file.
# """
# self.trajSuperContext = AMBERmdcrdParser.AMBERmdcrdParserContext(False)
# self.trajParser = AncillaryParser(
# fileDescription = AMBERmdcrdParser.build_AMBERmdcrdFileSimpleMatcher(),
# parser = self.parser,
# cachingLevelForMetaName = AMBERmdcrdParser.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.Ignore),
# superContext = self.trajSuperContext)
def onClose_section_run(self, backend, gIndex, section): def onClose_section_run(self, backend, gIndex, section):
"""Trigger called when section_run is closed. """Trigger called when section_run is closed.
...@@ -253,7 +245,7 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -253,7 +245,7 @@ class AMBERParser(AmberC.AMBERParserBase):
self.metaStorage.updateBackend(backend, self.metaStorage.updateBackend(backend,
startsection=['section_frame_sequence'], startsection=['section_frame_sequence'],
autoopenclose=False) autoopenclose=False)
backend.addValue("frame_sequence_to_sampling_ref", self.samplingGIndex) backend.addValue("frame_sequence_to_sampling_ref", self.secSamplingGIndex)
backend.addArrayValues("frame_sequence_local_frames_ref", np.asarray(self.singleConfCalcs)) backend.addArrayValues("frame_sequence_local_frames_ref", np.asarray(self.singleConfCalcs))
backend.closeSection("section_frame_sequence", frameSequenceGIndex) backend.closeSection("section_frame_sequence", frameSequenceGIndex)
...@@ -264,15 +256,6 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -264,15 +256,6 @@ class AMBERParser(AmberC.AMBERParserBase):
# """ # """
# self.MD = True # self.MD = True
# def check_file_exist(self, k, v, filePath, fileList):
# if k.startswith('x_amber_mdin_file_') and
# :
#
# file_name = os.path.normpath(os.path.join(filePath, v[-1]))
# = os.path.isfile(file_name)
# if self.topoFound:
# self.topoFileName = file_name
def onClose_x_amber_section_input_output_files(self, backend, gIndex, section): def onClose_x_amber_section_input_output_files(self, backend, gIndex, section):
"""Trigger called when x_amber_section_input_output_files is closed. """Trigger called when x_amber_section_input_output_files is closed.
...@@ -304,7 +287,7 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -304,7 +287,7 @@ class AMBERParser(AmberC.AMBERParserBase):
def onOpen_section_method(self, backend, gIndex, section): def onOpen_section_method(self, backend, gIndex, section):
# keep track of the latest method section # keep track of the latest method section
self.secMethodIndex = gIndex self.secMethodGIndex = gIndex
if self.inputMethodIndex is None: if self.inputMethodIndex is None:
self.inputMethodIndex = gIndex self.inputMethodIndex = gIndex
else: else:
...@@ -361,28 +344,53 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -361,28 +344,53 @@ class AMBERParser(AmberC.AMBERParserBase):
if int(v[-1]) == 1: if int(v[-1]) == 1:
self.MD = False self.MD = False
def onOpen_section_system(self, backend, gIndex, section): def onOpen_section_sampling_method(self, backend, gIndex, section):
# keep track of the latest system description section # keep track of the latest sampling description section
self.secSystemDescriptionIndex = gIndex self.secSamplingGIndex = gIndex
def onClose_section_system(self, backend, gIndex, section): def onClose_section_sampling_method(self, backend, gIndex, section):
"""Trigger called when section_system is closed. """Trigger called when section_sampling_method is closed.
Writes atomic positions, atom labels and lattice vectors. Writes sampling method details for minimization and molecular dynamics.
""" """
# check if control keywords were found # check control keywords were found throguh dictionary support
section_sampling_Dict = get_updateDictionary(self, 'sampling') section_sampling_Dict = get_updateDictionary(self, 'sampling')
updateDict = { updateDict = {
'startSection' : [['section_sampling_method']], 'startSection' : [['section_sampling_method']],
#'muteSections' : [['section_system']], #'muteSections' : [['section_system']],
'dictionary' : section_sampling_Dict 'dictionary' : section_sampling_Dict
} }
self.samplingGIndex = backend.openSection("section_sampling_method") #self.secSamplingGIndex = backend.openSection("section_sampling_method")
self.metaStorage.update(updateDict) self.metaStorage.update(updateDict)
self.metaStorage.updateBackend(backend, self.metaStorage.updateBackend(backend,
startsection=['section_sampling_method'], startsection=['section_sampling_method'],
autoopenclose=False) autoopenclose=False)
backend.closeSection("section_sampling_method", self.samplingGIndex) #backend.closeSection("section_sampling_method", self.secSamplingGIndex)
def onOpen_section_system(self, backend, gIndex, section):
# keep track of the latest system description section
self.secSystemGIndex = gIndex
def onClose_section_system(self, backend, gIndex, section):
"""Trigger called when section_system is closed.
Writes atomic positions, atom labels and lattice vectors.
"""
# check if control keywords were found
#section_sampling_Dict = get_updateDictionary(self, 'sampling')
#updateDict = {
# 'startSection' : [['section_sampling_method']],
# #'muteSections' : [['section_system']],
# 'dictionary' : section_sampling_Dict
# }
#self.secSamplingGIndex = backend.openSection("section_sampling_method")
#self.metaStorage.update(updateDict)
#self.metaStorage.updateBackend(backend,
# startsection=['section_sampling_method'],
# autoopenclose=False)
#backend.closeSection("section_sampling_method", self.secSamplingGIndex)
#self.secMethodGIndex = backend.openSection("section_method")
#backend.closeSection("section_method", self.secMethodGIndex)
counter = 0 counter = 0
...@@ -401,10 +409,6 @@ class AMBERParser(AmberC.AMBERParserBase): ...@@ -401,10 +409,6 @@ class AMBERParser(AmberC.AMBERParserBase):
# # default writeout # # default writeout
# else: # else:
backend.superBackend.addValue(k, v[-1]) backend.superBackend.addValue(k, v[-1])