generated from FAIRmat-NFDI/nomad-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the plugin setup #2
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
from typing import ( | ||
TYPE_CHECKING, | ||
) | ||
|
||
if TYPE_CHECKING: | ||
from nomad.datamodel.datamodel import ( | ||
EntryArchive, | ||
) | ||
from structlog.stdlib import ( | ||
BoundLogger, | ||
) | ||
|
||
from nomad.metainfo import SchemaPackage | ||
from nomad.parsing.file_parser.mapping_parser import MappingAnnotationModel | ||
from nomad_simulations.schema_packages.general import Simulation, Program | ||
from nomad_simulations.schema_packages.model_system import ( | ||
ModelSystem, | ||
AtomicCell, | ||
) | ||
from nomad_simulations.schema_packages.model_method import ( | ||
DFT, | ||
XCFunctional, | ||
) | ||
from nomad_simulations.schema_packages.numerical_settings import KMesh | ||
|
||
m_package = SchemaPackage() | ||
|
||
# note: vasprun.xml has many meta fields, explaining field semantics | ||
Simulation.m_def.m_annotations['xml'] = MappingAnnotationModel(path='modeling') | ||
|
||
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"]' | ||
) | ||
|
||
# ? compilation mode | ||
Program.compilation_host.m_annotations['xml'] = MappingAnnotationModel( | ||
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 <structure name="initialpos" > and <structure name="finalpos" > | ||
|
||
|
||
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]' | ||
) | ||
""" | ||
|
||
m_package.__init_metainfo__() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is a matching parsee you would meed to.add parsee specs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like the filename to match? I already added it to
XMLParser