|
| 1 | +from typing import TYPE_CHECKING |
| 2 | + |
| 3 | +import numpy as np |
| 4 | +from nomad.config import config |
| 5 | +from nomad.metainfo import Quantity, SchemaPackage, Section, SubSection |
| 6 | +from nomad_simulations.schema_packages.general import ModelBaseSection |
| 7 | + |
| 8 | +configuration = config.get_plugin_entry_point( |
| 9 | + 'nomad_simulations.schema_packages:nomad_simulations_plugin' |
| 10 | +) |
| 11 | + |
| 12 | +m_package = SchemaPackage() |
| 13 | + |
| 14 | + |
| 15 | +class Spin(ModelBaseSection): |
| 16 | + pass |
| 17 | + |
| 18 | +class DOS(ModelBaseSection): |
| 19 | + """Collection of Electronic Density of States""" |
| 20 | + m_def = Section() |
| 21 | + |
| 22 | + class SemanticDOS(ModelBaseSection): |
| 23 | + """Electronic Density of State set that has a clear semantic meaning, |
| 24 | + e.g. total DOS, projected DOS, etc.""" |
| 25 | + |
| 26 | + class SpinResolvedDOS(ModelBaseSection): |
| 27 | + """Spin resolved DOS""" |
| 28 | + |
| 29 | + spin = Quantity( |
| 30 | + type=Spin, |
| 31 | + description="Spin channel", |
| 32 | + ) |
| 33 | + |
| 34 | + values = Quantity( |
| 35 | + type=np.float64, |
| 36 | + shape=['*'], |
| 37 | + description="Actual DOS values", |
| 38 | + ) # ? add renormalized_values |
| 39 | + |
| 40 | + def name_from_section(self, section): |
| 41 | + return self.spin.name_from_section() |
| 42 | + |
| 43 | + label = Quantity( |
| 44 | + type=str, |
| 45 | + description="Label of the DOS", |
| 46 | + ) # TODO: el n m |
| 47 | + |
| 48 | + energies = Quantity( |
| 49 | + type=np.float64, |
| 50 | + unit='J', |
| 51 | + shape=['*'], |
| 52 | + description="Energy values at which the DOS is evaluated", |
| 53 | + ) |
| 54 | + |
| 55 | + spin_channels = SubSection(subsection=SpinResolvedDOS.m_def, repeats=True) |
| 56 | + |
| 57 | + def name_from_section(self, section): |
| 58 | + if section.label: |
| 59 | + return section.label |
| 60 | + else: |
| 61 | + return 'total' |
| 62 | + |
| 63 | + collections = SubSection(subsection=SemanticDOS.m_def, repeats=True) |
| 64 | + |
| 65 | + |
| 66 | +m_package.__init_metainfo__() |
0 commit comments