Commit aec0fda5 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added more NOMAD parsers.

parent d41015e7
...@@ -52,3 +52,5 @@ TAGS ...@@ -52,3 +52,5 @@ TAGS
lib/ lib/
env/ env/
*.egg-info
\ No newline at end of file
# Copyright 2018-2018 Berk Onat, Fawzi Mohamed # Copyright 2018-2018 Berk Onat, Fawzi Mohamed
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import setup_paths
import numpy as np import numpy as np
from NAMDCommon import PARSERNAME, PROGRAMNAME, PARSERTAG from .NAMDCommon import PARSERNAME, PROGRAMNAME, PARSERTAG
from nomadcore.smart_parser.SmartParserDictionary import metaNameConverter, metaNameConverter_UnderscoreSpaceDash from nomadcore.smart_parser.SmartParserDictionary import metaNameConverter, metaNameConverter_UnderscoreSpaceDash
from nomadcore.smart_parser.SmartParserDictionary import MetaInfoMap, FileInfoMap, MapDictionary from nomadcore.smart_parser.SmartParserDictionary import MetaInfoMap, FileInfoMap, MapDictionary
from nomadcore.smart_parser.SmartParserDictionary import getDict_MetaStrInDict, getList_MetaStrInDict, get_unitDict from nomadcore.smart_parser.SmartParserDictionary import getDict_MetaStrInDict, getList_MetaStrInDict, get_unitDict
import nomadcore.md_data_access.MDDataAccess as MDData import nomadcore.md_data_access.MDDataAccess as MDData
...@@ -26,7 +25,7 @@ def get_fileListDict(): ...@@ -26,7 +25,7 @@ def get_fileListDict():
Returns: Returns:
the list of defaults file namelists the list of defaults file namelists
""" """
startpage = { startpage = {
'nameTranslate' : metaNameConverter, 'nameTranslate' : metaNameConverter,
'metaHeader' : PARSERTAG, 'metaHeader' : PARSERTAG,
...@@ -36,19 +35,19 @@ def get_fileListDict(): ...@@ -36,19 +35,19 @@ def get_fileListDict():
'activeSections' : [PARSERTAG+'_section_input_output_files'] 'activeSections' : [PARSERTAG+'_section_input_output_files']
} }
namelist = { namelist = {
'structure' : FileInfoMap(startpage, fileFormat=['.psf'], activeInfo=True, 'structure' : FileInfoMap(startpage, fileFormat=['.psf'], activeInfo=True,
infoPurpose=['topology', 'unitcell']), infoPurpose=['topology', 'unitcell']),
'traj_coord' : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True, 'traj_coord' : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True,
infoPurpose=['trajectory', 'unitcell']), infoPurpose=['trajectory', 'unitcell']),
'traj_vel' : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True, 'traj_vel' : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True,
infoPurpose=['velocities']), infoPurpose=['velocities']),
'traj_force' : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True, 'traj_force' : FileInfoMap(startpage, fileFormat=['.dcd'], activeInfo=True,
infoPurpose=['forces']), infoPurpose=['forces']),
'output_coord' : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False, 'output_coord' : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False,
infoPurpose=['outputcoordinates', 'unitcell']), infoPurpose=['outputcoordinates', 'unitcell']),
'output_vel' : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False, 'output_vel' : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False,
infoPurpose=['outputvelocities']), infoPurpose=['outputvelocities']),
'output_force' : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False, 'output_force' : FileInfoMap(startpage, fileFormat=['.namdbin'], activeInfo=False,
infoPurpose=['outputforces']), infoPurpose=['outputforces']),
'input_coord' : FileInfoMap(startpage, fileFormat=['.pdb'], 'input_coord' : FileInfoMap(startpage, fileFormat=['.pdb'],
infoPurpose=['inputcoordinates', 'inputunitcell']), infoPurpose=['inputcoordinates', 'inputunitcell']),
...@@ -71,11 +70,11 @@ def get_nameListDict(deflist): ...@@ -71,11 +70,11 @@ def get_nameListDict(deflist):
matchWith parameters: matchWith parameters:
EOL = End of line EOL = End of line
PL = Match with previous line PL = Match with previous line
PW = Previous word PW = Previous word
NW = Next word (until space, comma) (DEFAULT) NW = Next word (until space, comma) (DEFAULT)
UD = until delimeter (can be any string/character) UD = until delimeter (can be any string/character)
The text matched inside apostrophe or qoutation is extracted The text matched inside apostrophe or qoutation is extracted
Returns: Returns:
...@@ -224,11 +223,11 @@ def get_nameListDict(deflist): ...@@ -224,11 +223,11 @@ def get_nameListDict(deflist):
'activeSections' : ['section_single_configuration_calculation'] 'activeSections' : ['section_single_configuration_calculation']
}) })
mddatalist = { mddatalist = {
'WRITING COORDINATES TO DCD FILE' : MetaInfoMap(startpage, 'WRITING COORDINATES TO DCD FILE' : MetaInfoMap(startpage,
replaceTag='DCDSTEP', subFunc=lambda x: x.split()[-1].replace('\n','').strip()), replaceTag='DCDSTEP', subFunc=lambda x: x.split()[-1].replace('\n','').strip()),
'WRITING VELOCITIES TO DCD FILE AT STEP' : MetaInfoMap(startpage, 'WRITING VELOCITIES TO DCD FILE AT STEP' : MetaInfoMap(startpage,
replaceTag='VELSTEP', subFunc=lambda x: x.replace('\n','').strip()), replaceTag='VELSTEP', subFunc=lambda x: x.replace('\n','').strip()),
'WRITING FORCES TO DCD FILE AT STEP' : MetaInfoMap(startpage, 'WRITING FORCES TO DCD FILE AT STEP' : MetaInfoMap(startpage,
replaceTag='FORCESTEP', subFunc=lambda x: x.replace('\n','').strip()), replaceTag='FORCESTEP', subFunc=lambda x: x.replace('\n','').strip()),
'TS' : MetaInfoMap(startpage), 'TS' : MetaInfoMap(startpage),
'BOND' : MetaInfoMap(startpage), 'BOND' : MetaInfoMap(startpage),
...@@ -299,7 +298,7 @@ def set_Dictionaries(self): ...@@ -299,7 +298,7 @@ def set_Dictionaries(self):
self.stepcontrolDict = { self.stepcontrolDict = {
'logsteps' : None, 'logsteps' : None,
'nextlogsteps' : None, 'nextlogsteps' : None,
'trajsteps' : None, 'trajsteps' : None,
'velsteps' : None, 'velsteps' : None,
'forcesteps' : None, 'forcesteps' : None,
'steps' : None, 'steps' : None,
...@@ -313,12 +312,12 @@ def set_Dictionaries(self): ...@@ -313,12 +312,12 @@ def set_Dictionaries(self):
'mddata' : self.mddataDict, 'mddata' : self.mddataDict,
'extra' : self.extraDict, 'extra' : self.extraDict,
} }
self.sectionDict = { self.sectionDict = {
'section' : { 'section' : {
"metaNameTag" : ['input_output_files', "metaNameTag" : ['input_output_files',
'control_parameters'], 'control_parameters'],
"listTypStr" : 'type_section', "listTypStr" : 'type_section',
"repeatingSection" : False, "repeatingSection" : False,
"supraNames" : ["section_run"] "supraNames" : ["section_run"]
} }
} }
...@@ -340,7 +339,7 @@ def get_updateDictionary(self, defname): ...@@ -340,7 +339,7 @@ def get_updateDictionary(self, defname):
if(st is not None and isinstance(st, str)): if(st is not None and isinstance(st, str)):
if("[" in st or "(" in st): if("[" in st or "(" in st):
val.append(list(storedtext)) val.append(list(storedtext))
if val: if val:
return False, np.linalg.norm(np.asarray(val)), itemdict return False, np.linalg.norm(np.asarray(val)), itemdict
else: else:
return False, itemdict["value"], itemdict return False, itemdict["value"], itemdict
...@@ -355,27 +354,27 @@ def get_updateDictionary(self, defname): ...@@ -355,27 +354,27 @@ def get_updateDictionary(self, defname):
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Definitions of meta data values for section_sampling_method # Definitions of meta data values for section_sampling_method
# --------------------------------------------------------------- # ---------------------------------------------------------------
sampling = { sampling = {
'ensemble_type' : MetaInfoMap(startpage, activeInfo=True, 'ensemble_type' : MetaInfoMap(startpage, activeInfo=True,
depends=[ depends=[
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' in [\"tcouple\",' ['thermostat', ' in [\"tcouple\",'
'\"rescale\",' '\"rescale\",'
'\"reassign\",' '\"reassign\",'
'\"andersen\",' '\"andersen\",'
'\"langevin\"]'], '\"langevin\"]'],
['barostat', ' in [\"berendsen\",' ['barostat', ' in [\"berendsen\",'
'\"langevin\"]']], '\"langevin\"]']],
'assign' : 'NPT'}, 'assign' : 'NPT'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' in [\"langevin\"]'], ['thermostat', ' in [\"langevin\"]'],
['thermostat', ' not in [\"tcouple\",' ['thermostat', ' not in [\"tcouple\",'
'\"rescale\",' '\"rescale\",'
'\"reassign\",' '\"reassign\",'
'\"andersen\"]'], '\"andersen\"]'],
['barostat', ' is None']], ['barostat', ' is None']],
'assign' : 'Langevin'}, 'assign' : 'Langevin'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' in [\"tcouple\",' ['thermostat', ' in [\"tcouple\",'
'\"rescale\",' '\"rescale\",'
'\"reassign\",' '\"reassign\",'
...@@ -384,16 +383,16 @@ def get_updateDictionary(self, defname): ...@@ -384,16 +383,16 @@ def get_updateDictionary(self, defname):
'assign' : 'NVT'}, 'assign' : 'NVT'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' is None'], ['thermostat', ' is None'],
['barostat', ' is None']], ['barostat', ' is None']],
'assign' : 'NVE'}, 'assign' : 'NVE'},
{'test' : [['minimization', ' is not None']], {'test' : [['minimization', ' is not None']],
'assign' : 'minimization'}, 'assign' : 'minimization'},
], ],
lookupdict=self.extraDict lookupdict=self.extraDict
), ),
'sampling_method' : MetaInfoMap(startpage, activeInfo=True, 'sampling_method' : MetaInfoMap(startpage, activeInfo=True,
depends=[ depends=[
{'test' : [['minimization', ' is not None']], {'test' : [['minimization', ' is not None']],
'assign' : 'geometry_optimization'}, 'assign' : 'geometry_optimization'},
{'test' : [['minimization', ' is None']], {'test' : [['minimization', ' is None']],
'assign' : 'molecular_dynamics'} 'assign' : 'molecular_dynamics'}
...@@ -413,9 +412,9 @@ def get_updateDictionary(self, defname): ...@@ -413,9 +412,9 @@ def get_updateDictionary(self, defname):
# 'geometry_optimization_geometry_change' : MetaInfoMap(startpage), # 'geometry_optimization_geometry_change' : MetaInfoMap(startpage),
'geometry_optimization_method' : MetaInfoMap(startpage, 'geometry_optimization_method' : MetaInfoMap(startpage,
depends=[ depends=[
{'test' : [['minimization', ' == \"cg\"']], {'test' : [['minimization', ' == \"cg\"']],
'assign' : 'CG'}, 'assign' : 'CG'},
{'test' : [['minimization', ' == \"quench\"']], {'test' : [['minimization', ' == \"quench\"']],
'assign' : 'Velocity Quenching'}, 'assign' : 'Velocity Quenching'},
], ],
lookupdict=self.extraDict, lookupdict=self.extraDict,
...@@ -424,12 +423,12 @@ def get_updateDictionary(self, defname): ...@@ -424,12 +423,12 @@ def get_updateDictionary(self, defname):
# 'geometry_optimization_threshold_force' : MetaInfoMap(startpage), # 'geometry_optimization_threshold_force' : MetaInfoMap(startpage),
'x_namd_barostat_type' : MetaInfoMap(startpage, 'x_namd_barostat_type' : MetaInfoMap(startpage,
depends=[ depends=[
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['barostat', '== \"berendsen\"']], ['barostat', '== \"berendsen\"']],
'assign' : 'Berendsen'}, 'assign' : 'Berendsen'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['barostat', '== \"langevin\"']], ['barostat', '== \"langevin\"']],
'assign' : 'Nose-Hoover Langevin'} 'assign' : 'Nose-Hoover Langevin'}
], ],
lookupdict=self.extraDict, lookupdict=self.extraDict,
#autoSections=True, #autoSections=True,
...@@ -439,7 +438,7 @@ def get_updateDictionary(self, defname): ...@@ -439,7 +438,7 @@ def get_updateDictionary(self, defname):
'x_namd_barostat_target_pressure' : MetaInfoMap(startpage, 'x_namd_barostat_target_pressure' : MetaInfoMap(startpage,
depends=[ depends=[
{'test' : [['TARGET PRESSURE', ' is not None']], {'test' : [['TARGET PRESSURE', ' is not None']],
'value' : 'TARGET PRESSURE'} 'value' : 'TARGET PRESSURE'}
], ],
lookupdict=self.cntrlDict, lookupdict=self.cntrlDict,
valtype='float', valtype='float',
...@@ -452,9 +451,9 @@ def get_updateDictionary(self, defname): ...@@ -452,9 +451,9 @@ def get_updateDictionary(self, defname):
'x_namd_barostat_tau' : MetaInfoMap(startpage, 'x_namd_barostat_tau' : MetaInfoMap(startpage,
depends=[ depends=[
{'test' : [['LANGEVIN OSCILLATION PERIOD', ' is not None']], {'test' : [['LANGEVIN OSCILLATION PERIOD', ' is not None']],
'value' : 'LANGEVIN OSCILLATION PERIOD'}, 'value' : 'LANGEVIN OSCILLATION PERIOD'},
{'test' : [['BERENDSEN RELAXATION TIME', ' is not None']], {'test' : [['BERENDSEN RELAXATION TIME', ' is not None']],
'value' : 'BERENDSEN RELAXATION TIME'} 'value' : 'BERENDSEN RELAXATION TIME'}
], ],
lookupdict=self.cntrlDict, lookupdict=self.cntrlDict,
valtype='float', valtype='float',
...@@ -467,7 +466,7 @@ def get_updateDictionary(self, defname): ...@@ -467,7 +466,7 @@ def get_updateDictionary(self, defname):
'x_namd_integrator_type' : MetaInfoMap(startpage, 'x_namd_integrator_type' : MetaInfoMap(startpage,
depends=[ depends=[
{'test' : [['integrator', ' is not None']], {'test' : [['integrator', ' is not None']],
'value' : 'integrator'}, 'value' : 'integrator'},
{'test' : [['thermostat', ' == \"langevin\"']], {'test' : [['thermostat', ' == \"langevin\"']],
'assign' : 'Langevin'} 'assign' : 'Langevin'}
], ],
...@@ -500,21 +499,21 @@ def get_updateDictionary(self, defname): ...@@ -500,21 +499,21 @@ def get_updateDictionary(self, defname):
), ),
'x_namd_thermostat_type' : MetaInfoMap(startpage, 'x_namd_thermostat_type' : MetaInfoMap(startpage,
depends=[ depends=[
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' == \"tcouple\"']], ['thermostat', ' == \"tcouple\"']],
'assign' : 'Berendsen'}, 'assign' : 'Berendsen'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' == \"rescale\"']], ['thermostat', ' == \"rescale\"']],
'assign' : 'Velocity Rescaling'}, 'assign' : 'Velocity Rescaling'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' == \"reassign\"']], ['thermostat', ' == \"reassign\"']],
'assign' : 'Velocity Reassigning'}, 'assign' : 'Velocity Reassigning'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' == \"andersen\"']], ['thermostat', ' == \"andersen\"']],
'assign' : 'Andersen'}, 'assign' : 'Andersen'},
{'test' : [['minimization', ' is None'], {'test' : [['minimization', ' is None'],
['thermostat', ' == \"langevin\"']], ['thermostat', ' == \"langevin\"']],
'assign' : 'Nose-Hoover Langevin'}, 'assign' : 'Nose-Hoover Langevin'},
], ],
lookupdict=self.extraDict, lookupdict=self.extraDict,
#autoSections=True, #autoSections=True,
...@@ -592,7 +591,7 @@ def get_updateDictionary(self, defname): ...@@ -592,7 +591,7 @@ def get_updateDictionary(self, defname):
# ------------------------------------------------------------ # ------------------------------------------------------------
# Definitions for section_single_configuration_calculation # Definitions for section_single_configuration_calculation
# ------------------------------------------------------------ # ------------------------------------------------------------
singleconfcalc = { singleconfcalc = {
#'atom_forces_type' : MetaInfoMap(startpage, #'atom_forces_type' : MetaInfoMap(startpage,
# depends=[{'assign' : 'Force Field'}], # depends=[{'assign' : 'Force Field'}],
# lookupdict=self.mddataDict # lookupdict=self.mddataDict
...@@ -648,7 +647,7 @@ def get_updateDictionary(self, defname): ...@@ -648,7 +647,7 @@ def get_updateDictionary(self, defname):
'time_single_configuration_calculation_wall_start' : MetaInfoMap(startpage), 'time_single_configuration_calculation_wall_start' : MetaInfoMap(startpage),
#'stress_tensor_kind' : MetaInfoMap(startpage, #'stress_tensor_kind' : MetaInfoMap(startpage,
# depends=[ # depends=[
# {'test' : [['minimization', ' is not None']], # {'test' : [['minimization', ' is not None']],
# 'assign' : 'geometry_optimization'}, # 'assign' : 'geometry_optimization'},
# {'test' : [['minimization', ' is None']], # {'test' : [['minimization', ' is None']],
# 'assign' : 'molecular_dynamics'} # 'assign' : 'molecular_dynamics'}
...@@ -671,11 +670,11 @@ def get_updateDictionary(self, defname): ...@@ -671,11 +670,11 @@ def get_updateDictionary(self, defname):
activeSections=['section_energy_van_der_Waals'] activeSections=['section_energy_van_der_Waals']
), ),
} }
# ------------------------------------------ # ------------------------------------------
# Definitions for section_frame_sequence # Definitions for section_frame_sequence
# ------------------------------------------ # ------------------------------------------
frameseq = { frameseq = {
#'frame_sequence_conserved_quantity_frames' : MetaInfoMap(startpage, #'frame_sequence_conserved_quantity_frames' : MetaInfoMap(startpage,
# depends=[{'store' : 'TS'}], # depends=[{'store' : 'TS'}],
# valtype='int', # valtype='int',
...@@ -950,7 +949,7 @@ def get_updateDictionary(self, defname): ...@@ -950,7 +949,7 @@ def get_updateDictionary(self, defname):
#'previous_sequence_ref' : MetaInfoMap(startpage) #'previous_sequence_ref' : MetaInfoMap(startpage)
} }
frameseqend = { frameseqend = {
#'number_of_conserved_quantity_evaluations_in_sequence' : MetaInfoMap(startpage, #'number_of_conserved_quantity_evaluations_in_sequence' : MetaInfoMap(startpage,
# activeInfo=True, # activeInfo=True,
# value=(lambda x: np.array(x['val']).flatten().shape[0] if( # value=(lambda x: np.array(x['val']).flatten().shape[0] if(
...@@ -1158,7 +1157,7 @@ def get_updateDictionary(self, defname): ...@@ -1158,7 +1157,7 @@ def get_updateDictionary(self, defname):
'spacegroup_3D_wyckoff' : MetaInfoMap(startpage), 'spacegroup_3D_wyckoff' : MetaInfoMap(startpage),
'symmorphic' : MetaInfoMap(startpage), 'symmorphic' : MetaInfoMap(startpage),
'system_name' : MetaInfoMap(startpage, 'system_name' : MetaInfoMap(startpage,
subfunction={ subfunction={
'function' : MDData.MDDataConverter.topology_system_name, 'function' : MDData.MDDataConverter.topology_system_name,
'supportDict' : self.topoDict, 'supportDict' : self.topoDict,
}, },
...@@ -1285,7 +1284,7 @@ def get_updateDictionary(self, defname): ...@@ -1285,7 +1284,7 @@ def get_updateDictionary(self, defname):
'number_of_atoms_per_molecule_interaction' : MetaInfoMap(startpage), 'number_of_atoms_per_molecule_interaction' : MetaInfoMap(startpage),
'number_of_molecule_interactions' : MetaInfoMap(startpage) 'number_of_molecule_interactions' : MetaInfoMap(startpage)
} }
# section_atom_in_molecule of section_molecule_type # section_atom_in_molecule of section_molecule_type
atom_in_mol = { atom_in_mol = {
'atom_in_molecule_charge' : MetaInfoMap(startpage), 'atom_in_molecule_charge' : MetaInfoMap(startpage),
......
from .NAMDParser import NamdParserInterface as NamdParser
\ No newline at end of file
import sys
from nomad.metainfo import Environment
from nomad.metainfo.legacy import LegacyMetainfoEnvironment
import namdparser.metainfo.namd
import nomad.datamodel.metainfo.common
import nomad.datamodel.metainfo.public
import nomad.datamodel.metainfo.general
m_env = LegacyMetainfoEnvironment()
m_env.m_add_sub_section(Environment.packages, sys.modules['namdparser.metainfo.namd'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.common'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.public'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.general'].m_package) # type: ignore
This diff is collapsed.
# Copyright 2018-2018 Berk Onat, Fawzi Mohamed # Copyright 2015-2018 Berk Onat
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys from setuptools import setup, find_packages
import os
import os.path
basedir = os.path.dirname(os.path.abspath(__file__))
commondir = os.path.normpath(os.path.join(basedir,"../../../../python-common/common/python"))
if not commondir in sys.path:
sys.path.insert(0, commondir) def main():
setup(
name='namdparser',
version='0.1',
description='NOMAD parser implementation for Namd.',
license='APACHE 2.0',
package_dir={'': './'},
packages=find_packages(),
install_requires=[
'nomadcore',
'nomad'
],
)
if __name__ == '__main__':
main()
/*
* 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.
*/
package eu.nomad_lab.parsers
import eu.nomad_lab
import eu.nomad_lab.DefaultPythonInterpreter
import org.{ json4s => jn }
import eu.{ nomad_lab => lab }
import scala.collection.breakOut
object NamdParser extends SimpleExternalParserGenerator(
name = "NamdParser",
parserInfo = jn.JObject(
("name" -> jn.JString("NamdParser")) ::
("parserId" -> jn.JString("NamdParser" + lab.NamdVersionInfo.version)) ::
("versionInfo" -> jn.JObject(
("nomadCoreVersion" -> jn.JObject(lab.NomadCoreVersionInfo.toMap.map {
case (k, v) => k -> jn.JString(v.toString)
}(breakOut): List[(String, jn.JString)])) ::
(lab.NamdVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
mainFileRe = """\s*Info:\s*NAMD\s*[0-9.]+\s*for\s*""".r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/namd/parser/parser-namd/NAMDParser.py",
"${mainFilePath}"),
resList = Seq(
"parser-namd/NAMDParser.py",
"parser-namd/NAMDDictionary.py",
"parser-namd/NAMDCommon.py",
"parser-namd/setup_paths.py",
"nomad_meta_info/public.nomadmetainfo.json",
"nomad_meta_info/common.nomadmetainfo.json",
"nomad_meta_info/meta_types.nomadmetainfo.json",
"nomad_meta_info/namd.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),