Commit 655554d0 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Remove dependency on old metainfo.

parent c6fe788d
......@@ -22,7 +22,6 @@ import math
import os
import argparse
import logging
import nomad_meta_info
from phonopy.interface.FHIaims import read_aims, write_aims, read_aims_output
......@@ -42,13 +41,6 @@ from phonopy.structure.atoms import PhonopyAtoms as Atoms
phonopy_version = __version__
parser_info = {"name": "parser_phonopy", "version": "1.0"}
metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(
os.path.abspath(nomad_meta_info.__file__)), "phonopy.nomadmetainfo.json"))
metaInfoEnv, warnings = loadJsonFile(
filePath = metaInfoPath, dependencyLoader = None,
extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None)
class PhonopyParserWrapper():
""" A proper class envolop for running this parser using Noamd-FAIRD infra. """
......@@ -58,7 +50,7 @@ class PhonopyParserWrapper():
def parse(self, mainfile):
logging.info('phonopy parser started')
logging.getLogger('nomadcore').setLevel(logging.WARNING)
backend = self.backend_factory(metaInfoEnv)
backend = self.backend_factory("phonopy.nomadmetainfo.json")
# Call the old parser without a class.
mainDir = os.path.dirname(os.path.dirname(os.path.abspath(mainfile)))
cwd = os.getcwd()
......@@ -152,24 +144,3 @@ def parse_without_class(name, backend):
Parse.finishedParsingSession("ParseSuccess", None)
return backend
if __name__ == '__main__':
import sys
parser = argparse.ArgumentParser(description='Parses a phonopy calculation.')
parser.add_argument('mainFileUri',
help='The uri of the main file associated with this calculation.')
parser.add_argument('mainFilePath', default = None,
help='The path to the main file associated with this calculation.')
parser.add_argument('--kind', default = 'FHI-aims', choices = ["FHI-aims"],
help='The kind of phonopy calculation performed')
args = parser.parse_args()
if args.mainFilePath:
mainDir = os.path.dirname(os.path.dirname(os.path.abspath(args.mainFilePath)))
os.chdir(mainDir)
name = args.mainFileUri
backend = JsonParseEventsWriterBackend(metaInfoEnv)
parse_without_class(name, backend)
......@@ -37,6 +37,8 @@ from nomadcore.unit_conversion.unit_conversion import convert_unit_function
from nomadcore.parser_backend import *
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
from nomad.parsing.legacy import Backend
AimsFrequencyUnitFactors = { 'cm^-1' : VaspToCm, 'THz' : VaspToTHz, 'meV' : 1E3*VaspToEv }
def get_pretty_print(json_object):
return json.dumps(json_object, sort_keys=True, indent=4, separators=('"', '\n'))
......@@ -415,7 +417,7 @@ class Get_Properties():
name = self.name
metaInfoEnv = self.metaInfoEnv
parser_info = self.parser_info
Emit = JsonParseEventsWriterBackend(metaInfoEnv)
Emit = Backend(metaInfoEnv)
Emit.startedParsingSession(name, parser_info)
sRun = Emit.openSection("section_run")
sSingleConf = Emit.openSection("section_single_configuration_calculation")
......
# Copyright 2016-2018 Fawzi Mohamed, Danio Brambila
#
# 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.
import sys, os, 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)
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