Commit 4ac272a1 authored by Berk Onat's avatar Berk Onat

Adding meta info for uri/file restrictions with section_restricted_uri

parent 06a9d552
Pipeline #27065 passed with stage
in 6 minutes and 36 seconds
......@@ -13,6 +13,12 @@ import json
import os
import re
PARSERNAME = "AMBER"
PROGRAMNAME = "amber"
PARSERVERSION = "0.0.3"
PARSERMETANAME = PARSERNAME.lower()
PARSERTAG = 'x_' + PARSERMETANAME
PARSER_INFO_DEFAULT = {
'name':'amber-parser',
'version': '0.0.1'
......@@ -107,6 +113,7 @@ class AMBERParserBase(object):
def __init__(self,cachingLevelForMetaName=None, coverageIgnoreList=None,
re_program_name=None):
self.metaStorage = mStore.Container('section_run')
self.metaStorageRestrict = mStore.Container('section_restricted_uri')
exclude_dict = {
'section_run' : [
'section_processor_info',
......@@ -120,6 +127,7 @@ class AMBERParserBase(object):
META_INFO_PATH
)
self.metaStorage.build(jsonmetadata, 'section_run', exclude_dict)
self.metaStorageRestrict.build(jsonmetadata, 'section_restricted_uri', exclude_dict)
self.re_program_name = re_program_name
self.unitDict = get_unitDict('si')
self.fileDict = get_fileListDict()
......
......@@ -906,6 +906,41 @@ def get_updateDictionary(self, defname):
activeSections=['section_energy_van_der_Waals']
),
}
# Info for section_restricted_uri
restrictions = {
'number_of_restricted_uri_files' : MetaInfoMap(startpage,
value=int(1),
autoSections=True,
activeSections=['section_restricted_uri']
),
'restricted_uri_files' : MetaInfoMap(startpage,
subfunction=self.parameter_file_name,
autoSections=True,
activeSections=['section_restricted_uri']
),
'restricted_uri_license' : MetaInfoMap(startpage,
value='AMBER License',
autoSections=True,
activeSections=['section_restricted_uri']
),
'restricted_uri_restriction' : MetaInfoMap(startpage,
value='any access',
autoSections=True,
activeSections=['section_restricted_uri']
),
'restricted_uri_reason' : MetaInfoMap(startpage,
value='propriety license',
autoSections=True,
activeSections=['section_restricted_uri']
),
'restricted_uri_issue_athority' : MetaInfoMap(startpage,
value='AMBER',
autoSections=True,
activeSections=['section_restricted_uri']
),
}
# ------------------------------------------
# Definitions for section_frame_sequence
......@@ -1227,6 +1262,8 @@ def get_updateDictionary(self, defname):
dictionary = topology
elif defname == 'singleconfcalc':
dictionary = singleconfcalc
elif defname == 'restrictions':
dictionary = restrictions
elif defname == 'frameseq':
dictionary = frameseq
elif defname == 'atom_type':
......
......@@ -8,6 +8,7 @@ from nomadcore.caching_backend import CachingLevel
from nomadcore.simple_parser import mainFunction, ParsingContext
from nomadcore.simple_parser import SimpleMatcher as SM
from AMBERDictionary import set_excludeList, set_includeList, get_updateDictionary, getList_MetaStrInDict, getDict_MetaStrInDict
from nomadcore.smart_parser.SmartParserDictionary import isMetaStrInDict
from contextlib import contextmanager
import AMBERCommon as AmberC
import trajectory_reader as TrajRead
......@@ -218,6 +219,20 @@ class AMBERParser(AmberC.AMBERParserBase):
#else:
# return False
def parameter_file_name(self, itemdict):
""" Function to generate data for parameter files list
"""
working_dir_name = os.path.dirname(os.path.abspath(self.fName))
parmmeta = isMetaStrInDict("PARM",self.fileDict)
filename = []
if parmmeta is not None:
if self.fileDict[parmmeta].value is not None:
filename.append(self.fileDict[parmmeta].value)
if filename:
return False, filename, itemdict
else:
return False, None, itemdict
def topology_to_dictionary(self):
""" This function generates self.topologyDict dictionary
and converts/stores all the topology information
......@@ -478,7 +493,17 @@ class AMBERParser(AmberC.AMBERParserBase):
self.metaStorage.updateBackend(backend,
startsection=['section_sampling_method'],
autoopenclose=False)
#backend.closeSection("section_sampling_method", self.secSamplingGIndex)
self.secRestrictGIndex = backend.openSection("section_restricted_uri")
section_restrictions_Dict = get_updateDictionary(self, 'restrictions')
updateDict = {
'startSection' : [['section_restricted_uri']],
'dictionary' : section_restrictions_Dict
}
self.metaStorageRestrict.update(updateDict)
self.metaStorageRestrict.updateBackend(backend,
startsection=['section_restricted_uri'],
autoopenclose=False)
backend.closeSection("section_restricted_uri", self.secRestrictGIndex)
def onOpen_section_topology(self, backend, gIndex, section):
# keep track of the latest topology description section
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment