Commit 3de50ada authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added metainfo python code.

parent 6e4654fa
import sys
from nomad.metainfo import Environment
from nomad.metainfo.legacy import LegacyMetainfoEnvironment
import vaspparser.metainfo.vasp
import nomad.datamodel.metainfo.common
import nomad.datamodel.metainfo.public
import nomad.datamodel.metainfo.general
import vaspparser.metainfo.vasp_incars
import vaspparser.metainfo.vasp_incarsOut
import vaspparser.metainfo.vasp_incarsUnknown
m_env = LegacyMetainfoEnvironment()
m_env.m_add_sub_section(Environment.packages, sys.modules['vaspparser.metainfo.vasp'].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
m_env.m_add_sub_section(Environment.packages, sys.modules['vaspparser.metainfo.vasp_incars'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['vaspparser.metainfo.vasp_incarsOut'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['vaspparser.metainfo.vasp_incarsUnknown'].m_package) # type: ignore
import numpy as np # pylint: disable=unused-import
import typing # pylint: disable=unused-import
from nomad.metainfo import ( # pylint: disable=unused-import
MSection, MCategory, Category, Package, Quantity, Section, SubSection, SectionProxy,
Reference
)
from nomad.metainfo.legacy import LegacyDefinition
from vaspparser.metainfo import vasp_incars
from nomad.datamodel.metainfo import public
m_package = Package(
name='vasp_nomadmetainfo_json',
description='None',
a_legacy=LegacyDefinition(name='vasp.nomadmetainfo.json'))
class section_run(public.section_run):
m_def = Section(validate=False, extends_base_section=True, a_legacy=LegacyDefinition(name='section_run'))
vasp_build_date = Quantity(
type=str,
shape=[],
description='''
build date as string
''',
categories=[public.program_info, public.accessory_info],
a_legacy=LegacyDefinition(name='vasp_build_date'))
vasp_src_date = Quantity(
type=str,
shape=[],
description='''
date of last modification of the source as string
''',
categories=[public.program_info, public.accessory_info],
a_legacy=LegacyDefinition(name='vasp_src_date'))
class section_method(public.section_method):
m_def = Section(validate=False, extends_base_section=True, a_legacy=LegacyDefinition(name='section_method'))
x_vasp_unknown_incars = Quantity(
type=typing.Any,
shape=[],
description='''
INCAR variables uknown wrt to Vasp Wiki
''',
a_legacy=LegacyDefinition(name='x_vasp_unknown_incars'))
x_vasp_atom_kind_refs = Quantity(
type=public.section_method_atom_kind,
shape=['number_of_atoms'],
description='''
reference to the atom kinds of each atom
''',
a_legacy=LegacyDefinition(name='x_vasp_atom_kind_refs'))
x_vasp_k_points_generation_method = Quantity(
type=str,
shape=[],
description='''
k points generation method
''',
categories=[public.settings_potential_energy_surface, vasp_incars.x_vasp_incar_param, public.settings_k_points],
a_legacy=LegacyDefinition(name='x_vasp_k_points_generation_method'))
x_vasp_k_points = Quantity(
type=int,
shape=['x_vasp_number_of_k_points'],
description='''
k points
''',
categories=[vasp_incars.x_vasp_incar_param],
a_legacy=LegacyDefinition(name='x_vasp_k_points'))
x_vasp_numer_of_magmom = Quantity(
type=int,
shape=[],
description='''
number of magnetic moments, number_of_atoms for ISPIN = 2, 3*number of atoms for
non-collinear magnetic systems
''',
categories=[vasp_incars.x_vasp_incar_param],
a_legacy=LegacyDefinition(name='x_vasp_numer_of_magmom'))
x_vasp_tetrahedrons_list = Quantity(
type=np.dtype(np.int32),
shape=['N', 5],
description='''
Rows of 5 elements. First the weight (symmetry degeneration), then the four corner
points of each tetrahedron.
''',
categories=[vasp_incars.x_vasp_incar_param],
a_legacy=LegacyDefinition(name='x_vasp_tetrahedrons_list'))
x_vasp_tetrahedron_volume = Quantity(
type=np.dtype(np.float64),
shape=[1],
description='''
Volume weight of a single tetrahedron (all tetra's must have the same volume)
''',
categories=[vasp_incars.x_vasp_incar_param],
a_legacy=LegacyDefinition(name='x_vasp_tetrahedron_volume'))
x_vasp_nose_thermostat = Quantity(
type=np.dtype(np.float64),
shape=[4],
description='''
Nose thermostat output
''',
categories=[vasp_incars.x_vasp_incar_param],
a_legacy=LegacyDefinition(name='x_vasp_nose_thermostat'))
class section_system(public.section_system):
m_def = Section(validate=False, extends_base_section=True, a_legacy=LegacyDefinition(name='section_system'))
x_vasp_selective_dynamics = Quantity(
type=bool,
shape=['number_of_atoms', 3],
description='''
Boolean array to eiter allow or forbid coordinate modifications during relaxation
''',
a_legacy=LegacyDefinition(name='x_vasp_selective_dynamics'))
m_package.__init_metainfo__()
This diff is collapsed.
This diff is collapsed.
import numpy as np # pylint: disable=unused-import
import typing # pylint: disable=unused-import
from nomad.metainfo import ( # pylint: disable=unused-import
MSection, MCategory, Category, Package, Quantity, Section, SubSection, SectionProxy,
Reference
)
from nomad.metainfo.legacy import LegacyDefinition
from vaspparser.metainfo import vasp_incars
from nomad.datamodel.metainfo import public
from vaspparser.metainfo import vasp_incarsOut
m_package = Package(
name='vasp_incarsUnknown_nomadmetainfo_json',
description='None',
a_legacy=LegacyDefinition(name='vasp.incarsUnknown.nomadmetainfo.json'))
class x_vasp_incarUnknown_param(MCategory):
'''
Unknown incar parameters. By 'unknown' we refer to incar parameters in the OLD
(predated Sept.2019) 'vasp.nomadmetainfo.json' that are **not** listed in the current
(Oct.2019) VaspWiki
'''
m_def = Category(
a_legacy=LegacyDefinition(name='x_vasp_incarUnknown_param'))
class section_method(public.section_method):
m_def = Section(validate=False, extends_base_section=True, a_legacy=LegacyDefinition(name='section_method'))
x_vasp_incarOut_ENMAX = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
Maximum cutoff (normally specified only in POTCAR). Value prinded out after
evaluating the input.
''',
categories=[vasp_incarsOut.x_vasp_incarOut_param],
a_legacy=LegacyDefinition(name='x_vasp_incarOut_ENMAX'))
x_vasp_incar_ENMAX = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
Maximum cutoff (normally specified only in POTCAR). Value prinded out after
evaluating the input.
''',
categories=[vasp_incars.x_vasp_incar_param],
a_legacy=LegacyDefinition(name='x_vasp_incar_ENMAX'))
x_vasp_incarOut_LCOMPAT = Quantity(
type=bool,
shape=[],
description='''
In vasp.4.2 the augmentation charges are forced to be zero at the boundary of the
augmentation sphere, therefore results are slightly different from vasp.3.2
(usually differences are smaller than 0.01 meV). The old behavior can be restored
by setting LCOMPAT = .TRUE. in the INCAR file.
''',
categories=[vasp_incarsOut.x_vasp_incarOut_param],
a_legacy=LegacyDefinition(name='x_vasp_incarOut_LCOMPAT'))
m_package.__init_metainfo__()
......@@ -20,7 +20,7 @@ from ase.io import read as ase_read
from nomadcore.simple_parser import SimpleMatcher
from nomadcore.baseclasses import ParserInterface, MainHierarchicalParser
from nomad.parsing import LocalBackend
from nomad.parsing import Backend
"""
......@@ -87,6 +87,6 @@ class MainParser(MainHierarchicalParser):
if __name__ == "__main__":
parser = VaspOutcarParser(backend=LocalBackend)
parser = VaspOutcarParser(backend=Backend)
parser.parse(sys.argv[1])
print(parser.parser_context.super_backend)
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