Skip to content

Commit

Permalink
Modify JMesPath quotation symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Sep 12, 2024
1 parent 979be15 commit 03a24f0
Showing 1 changed file with 30 additions and 34 deletions.
64 changes: 30 additions & 34 deletions src/nomad_parser_vasp/schema_packages/vasp_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,40 @@
m_package = SchemaPackage()

# note: vasprun.xml has many meta fields, explaining field semantics
Simulation.m_def.m_annotations['xml'] = MappingAnnotationModel(path='modeling')
Simulation.m_def.m_annotations['xml'] = MappingAnnotationModel(path="modeling")

Simulation.program.m_annotations['xml'] = MappingAnnotationModel(path='.generator')
Simulation.program.m_annotations['xml'] = MappingAnnotationModel(path="modeling.generator")

Simulation.model_method.m_annotations['xml'] = MappingAnnotationModel(
path='.parameters'
path="modeling.parameters"
)

Simulation.model_system.m_annotations['xml'] = MappingAnnotationModel(
path='.calculation'
path=".calculation"
)

ModelSystem.cell.m_annotations['xml'] = MappingAnnotationModel(path='.structure')
ModelSystem.cell.m_annotations['xml'] = MappingAnnotationModel(path="modeling.structure")

Simulation.outputs.m_annotations['xml'] = MappingAnnotationModel(path='.calculation')
Simulation.outputs.m_annotations['xml'] = MappingAnnotationModel(path=".calculation")

Program.name.m_annotations['xml'] = MappingAnnotationModel(
path='.i[?"@name"=="program"]'
path="modeling.generator.i[?name == 'program']"
)

Program.version.m_annotations['xml'] = MappingAnnotationModel(
path='.i[?"@name"=="version"]'
path="modeling.generator.i[?name == 'version']"
)

# ? compilation mode
Program.compilation_host.m_annotations['xml'] = MappingAnnotationModel(
path='.i[?"@name"=="platform"]'
path=".i[?name == 'platform']"
)

DFT.numerical_settings.m_annotations['xml'] = MappingAnnotationModel(
path='modeling.kpoints'
)

dft_path = '.separator[?"@name"=="electronic exchange-correlation"]'
dft_path = '.separator[?name == "electronic exchange-correlation"]'
DFT.xc_functionals.m_annotations['xml'] = MappingAnnotationModel(
path=dft_path
) # start from Simulation.model_method path
Expand All @@ -69,97 +69,93 @@
operator=(
'mix_alpha',
[
dft_path + '.i[?"@name"=="HFALPHA"]',
dft_path + '.i[?"@name"=="LHFCALC"]',
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
path=dft_path + '.i[?name == "GGA"]' # TODO add LDA & mGGA, convert_xc
)
)

KMesh.grid.m_annotations['xml'] = MappingAnnotationModel(
path='.generation.v[?"@name"=="divisions"]'
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"]'
path='.generation.v[?name == "shift"]'
) # start from DFT.numerical_settings

KMesh.points.m_annotations['xml'] = MappingAnnotationModel(
path='.varray[?"@name"=="kpointlist"].v'
path='.varray[?name == "kpointlist"].v'
) # start from DFT.numerical_settings

KMesh.weights.m_annotations['xml'] = MappingAnnotationModel(
path='.varray[?"@name"=="weights"].v'
path='.varray[?name == "weights"].v'
) # start from DFT.numerical_settings


# ? target <structure name="initialpos" > and <structure name="finalpos" >


AtomicCell.positions.m_annotations = dict(
xml=MappingAnnotationModel(path='.varray[?"@name"=="positions"]')
xml=MappingAnnotationModel(path='.varray[?name == "positions"]')
) # start from Simulation.model_system.cell path

"""
...forces.m_annotations['xml'] = MappingAnnotationModel(
path='.varray[?"@name"=="forces"]'
path='varray[?name == "forces"]'
) # start from Simulation.model_system.cell path
...stress.m_annotations['xml'] = MappingAnnotationModel(
path='.varray[?"@name"=="stress"]'
path='varray[?name == "stress"]'
) # start from Simulation.model_system.cell path
"""

AtomicCell.lattice_vectors.m_annotations['xml'] = MappingAnnotationModel(
path='.crystal.varray[?"@name"=="basis"]'
path='crystal.varray[?name == "basis"]'
) # start from Simulation.model_system.cell path

"""
cell_volume.m_annotations['xml'] = MappingAnnotationModel(
path='.crystal.i[?"@name"=="volume"]'
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"]'
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"]'
path='calculation.energy.i[?name == "e_fr_energy"]'
)
total_internal_energy.m_annotations['xml'] = MappingAnnotationModel(
path='calculation.energy.i[?"@name"=="e_0_energy"]'
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"]'
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"]'
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]'
path=ElectronicEigenvalues.reciprocal_cell.m_annotations['xml'] + '.r[0]'
)
ElectronicEigenvalues.value.m_annotations['xml'] = MappingAnnotationModel(
path=ElectronicEigenvalues.reciprocal_cell.m_annotations.xml + '.r[1]'
path=ElectronicEigenvalues.reciprocal_cell.m_annotations['xml'] + '.r[1]'
)
"""

Expand Down

0 comments on commit 03a24f0

Please sign in to comment.