Commit fbb6bb86 authored by Mikkel Strange's avatar Mikkel Strange
Browse files

resolved conflicts

parents 78cebe38 eec077a5
......@@ -3,6 +3,7 @@ from contextlib import contextmanager
import numpy as np
from ase.data import chemical_symbols
from nomadcore.unit_conversion.unit_conversion import convert_unit as cu
import setup_paths
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
from nomadcore.parser_backend import JsonParseEventsWriterBackend
from tar import Reader
......
import setup_paths
from nomadcore.simple_parser import mainFunction, SimpleMatcher as SM
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
import os, sys, json
# description of the input
mainFileDescription = SM(
name = 'root',
weak = True,
startReStr = "",
subMatchers = [
SM(name = 'newRun',
startReStr = r"\s*# SampleParser #\s*",
repeats = True,
required = True,
forwardMatch = True,
sections = ['section_run'],
subMatchers = [
SM(name = 'header',
startReStr = r"\s*# SampleParser #\s*")
])
])
# loading metadata from nomad-meta-info/meta_info/nomad_meta_info/gpaw.nomadmetainfo.json
metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../../../../nomad-meta-info/meta_info/nomad_meta_info/gpaw.nomadmetainfo.json"))
metaInfoEnv, warnings = loadJsonFile(filePath = metaInfoPath, dependencyLoader = None, extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None)
parserInfo = {
"name": "parser_gpaw",
"version": "1.0"
}
class GpawParserContext(object):
"""main place to keep the parser status, open ancillary files,..."""
def __init__(self):
self.scfIterNr = 0
# just examples, you probably want to remove the following two triggers
def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
"""trigger called when section_single_configuration_calculation is closed"""
#backend.addValue("", self.scfIterNr)
logging.getLogger("nomadcore.parsing").info("closing section_single_configuration_calculation gIndex %d %s", gIndex, section.simpleValues)
self.scfIterNr = 0
def onClose_section_scf_iteration(self, backend, gIndex, section):
"""trigger called when section_scf_iteration is closed"""
logging.getLogger("nomadcore.parsing").info("closing section_scf_iteration bla gIndex %d %s", gIndex, section.simpleValues)
self.scfIterNr += 1
# which values to cache or forward (mapping meta name -> CachingLevel)
cachingLevelForMetaName = {}
if __name__ == "__main__":
mainFunction(mainFileDescription, metaInfoEnv, parserInfo,
cachingLevelForMetaName = cachingLevelForMetaName,
superContext = GpawParserContext())
......@@ -2,13 +2,13 @@ package eu.nomad_lab.parsers
import eu.nomad_lab.DefaultPythonInterpreter
import org.{json4s => jn}
object GPAWParser extends SimpleExternalParserGenerator(
name = "GPAWParser",
object GpawParser extends SimpleExternalParserGenerator(
name = "GpawParser",
parserInfo = jn.JObject(
("name" -> jn.JString("GPAWParser")) ::
("name" -> jn.JString("GpawParser")) ::
("version" -> jn.JString("1.0")) :: Nil),
mainFileTypes = Seq("application/tar"),
mainFileRe = "",
mainFileTypes = Seq("application/x-gtar"),
mainFileRe = "".r,
cmd = Seq(DefaultPythonInterpreter.python2Exe(), "${envDir}/parsers/gpaw/parser/parser-gpaw/parser.py",
"${mainFilePath}"),
resList = Seq(
......
Supports Markdown
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