From 76b3358832f26e812966e461de043462d46fe9f7 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 5 Jul 2024 14:19:30 +0200 Subject: [PATCH] Add back in the annotated output --- src/nomad_parser_vasp/parsers/xml_parser.py | 120 +++++++++++++++++++- 1 file changed, 118 insertions(+), 2 deletions(-) diff --git a/src/nomad_parser_vasp/parsers/xml_parser.py b/src/nomad_parser_vasp/parsers/xml_parser.py index ee144c7..9d9e236 100644 --- a/src/nomad_parser_vasp/parsers/xml_parser.py +++ b/src/nomad_parser_vasp/parsers/xml_parser.py @@ -21,7 +21,6 @@ DFT, XCFunctional, ) -from nomad_simulations.schema_packages.outputs import ElectronicEigenvalues from nomad_simulations.schema_packages.numerical_settings import KMesh configuration = config.get_plugin_entry_point( @@ -36,12 +35,24 @@ Simulation.program.m_annotations['xml'] = MappingAnnotationModel(path='.generator') +Simulation.model_method.m_annotations['xml'] = MappingAnnotationModel( + path='.parameters' +) + +Simulation.model_system.m_annotations['xml'] = MappingAnnotationModel( + path='.calculation' +) + +Simulation.model_system.cell.m_annotations['xml'] = MappingAnnotationModel( + path='.structure' +) + +Simulation.outputs.m_annotations['xml'] = MappingAnnotationModel(path='.calculation') Program.name.m_annotations['xml'] = MappingAnnotationModel( path='.i[?"@name"="program"]' ) - Program.version.m_annotations['xml'] = MappingAnnotationModel( path='.i[?"@name"="version"]' ) @@ -51,6 +62,111 @@ path='.i[?"@name"="platform"]' ) +DFT.numerical_settings.m_annotations['xml'] = MappingAnnotationModel( + path='modeling.kpoints' +) + +dft_path = '.separator[?"@name"="electronic exchange-correlation"]' +DFT.xc_functionals.m_annotations['xml'] = MappingAnnotationModel( + path=dft_path +) # start from Simulation.model_method path + +DFT.exact_exchange_mixing_factor.m_annotations = dict( + xml=MappingAnnotationModel( + operator=( + lambda mix, cond: mix if cond else 0, + [dft_path + '.i[?"@name"="HFALPHA"]', dft_path + '.i[?"@name"="LHFCALC"]'], + ) + ) # TODO convert vasp bool +) + +XCFunctional.libxc_name.m_annotations = dict( + xml=MappingAnnotationModel( + path=dft_path + '.i[?"@name"="GGA"]' # TODO add LDA & mGGA, convert_xc + ) +) + +KMesh.grid.m_annotations['xml'] = MappingAnnotationModel( + path='.generation.v[?"@name"="divisions"]' +) # start from DFT.numerical_settings + +KMesh.offset.m_annotations['xml'] = MappingAnnotationModel( + path='.generation.v[?"@name"="shift"]' +) # start from DFT.numerical_settings + +KMesh.offset.m_annotations['xml'] = MappingAnnotationModel( + path='.generation.v[?"@name"="shift"]' +) # start from DFT.numerical_settings + +KMesh.points.m_annotations['xml'] = MappingAnnotationModel( + path='.varray[?"@name"="kpointlist"].v' +) # start from DFT.numerical_settings + +KMesh.weights.m_annotations['xml'] = MappingAnnotationModel( + path='.varray[?"@name"="weights"].v' +) # start from DFT.numerical_settings + + +# ? target and + + +AtomicCell.positions.m_annotations = dict( + xml=MappingAnnotationModel(path='.varray[?"@name"="positions"]') +) # start from Simulation.model_system.cell path + +""" +...forces.m_annotations['xml'] = MappingAnnotationModel( + path='.varray[?"@name"="forces"]' +) # start from Simulation.model_system.cell path + +...stress.m_annotations['xml'] = MappingAnnotationModel( + path='.varray[?"@name"="stress"]' +) # start from Simulation.model_system.cell path +""" + +AtomicCell.lattice_vectors.m_annotations['xml'] = MappingAnnotationModel( + path='.crystal.varray[?"@name"="basis"]' +) # start from Simulation.model_system.cell path + +""" +cell_volume.m_annotations['xml'] = MappingAnnotationModel( + path='.crystal.i[?"@name"="volume"]' +) # start from Simulation.model_system.cell path + +reciprocal_lattice_vectors.m_annotations['xml'] = MappingAnnotationModel( + path='.crystal.varray[?"@name"="rec_basis"]' +) # start from Simulation.model_system.cell path + +total_free_energy.m_annotations['xml'] = MappingAnnotationModel( + path='calculation.energy.i[?"@name"="e_fr_energy"]' +) + +total_internal_energy.m_annotations['xml'] = MappingAnnotationModel( + path='calculation.energy.i[?"@name"="e_0_energy"]' +) + +...eigenvalues.m_annotations['xml'] = MappingAnnotationModel( + path='.eigenvalues.array' +) + +ElectronicEigenvalues.spin_channel.m_annotations['xml'] = MappingAnnotationModel( + path='.eigenvalues.set.set[?"@comment"="spin 1"]' +) # start from Simulation.outputs path + +ElectronicEigenvalues.reciprocal_cell.m_annotations['xml'] = MappingAnnotationModel( + path=ElectronicEigenvalues.spin_channel.m_annotations.xml + + '.set[?"@comment"="kpoint 1"]' +) # TODO not going to work: add conversion to reference + +ElectronicEigenvalues.occupation.m_annotations['xml'] = MappingAnnotationModel( + path=ElectronicEigenvalues.reciprocal_cell.m_annotations.xml + '.r[0]' +) + +ElectronicEigenvalues.value.m_annotations['xml'] = MappingAnnotationModel( + path=ElectronicEigenvalues.reciprocal_cell.m_annotations.xml + '.r[1]' +) +""" + class VasprunXMLParser(MatchingParser): def parse(