Skip to content

Commit

Permalink
Added Occupancy property
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed Aug 27, 2024
1 parent bc037d5 commit 40deb93
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/nomad_simulations/schema_packages/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
HoppingMatrix,
HybridizationFunction,
KineticEnergy,
Occupancy,
Permittivity,
PotentialEnergy,
QuasiparticleWeight,
Expand Down Expand Up @@ -116,6 +117,8 @@ class Outputs(ArchiveSection):
sub_section=ElectronicBandStructure.m_def, repeats=True
)

occupancies = SubSection(sub_section=Occupancy.m_def, repeats=True)

electronic_greens_functions = SubSection(
sub_section=ElectronicGreensFunction.m_def, repeats=True
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# limitations under the License.

from .band_gap import ElectronicBandGap
from .band_structure import ElectronicBandStructure, ElectronicEigenvalues
from .band_structure import ElectronicBandStructure, ElectronicEigenvalues, Occupancy
from .energies import (
EnergyContribution,
FermiLevel,
Expand Down
58 changes: 56 additions & 2 deletions src/nomad_simulations/schema_packages/properties/band_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from nomad.metainfo import Context, Section
from structlog.stdlib import BoundLogger

from nomad_simulations.schema_packages.atoms_state import AtomsState, OrbitalsState
from nomad_simulations.schema_packages.numerical_settings import KSpace
from nomad_simulations.schema_packages.physical_property import (
PhysicalProperty,
Expand Down Expand Up @@ -92,8 +93,8 @@ class ElectronicEigenvalues(BaseElectronicEigenvalues):
shape=['*', 'n_bands'],
description="""
Occupation of the electronic eigenvalues. This is a number depending whether the `spin_channel` has been set or not.
If `spin_channel` is set, then this number is between 0 and 2, where 0 means that the state is unoccupied and 2 means
that the state is fully occupied; if `spin_channel` is not set, then this number is between 0 and 1. The shape of
If `spin_channel` is set, then this number is between 0 and 1, where 0 means that the state is unoccupied and 1 means
that the state is fully occupied; if `spin_channel` is not set, then this number is between 0 and 2. The shape of
this quantity is defined as `[K.n_points, K.dimensionality, n_bands]`, where `K` is a `variable` which can
be `KMesh` or `KLinePath`, depending whether the simulation mapped the whole Brillouin zone or just a specific
path.
Expand Down Expand Up @@ -340,3 +341,56 @@ def __init__(

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)


class Occupancy(PhysicalProperty):
"""
Electrons occupancy of an atom per orbital and spin. This is a number defined between 0 and 1 for
spin-polarized systems, and between 0 and 2 for non-spin-polarized systems. This property is
important when studying if an orbital or spin channel are fully occupied, at half-filling, or
fully emptied, which have an effect on the electron-electron interaction effects.
"""

iri = 'http://fairmat-nfdi.eu/taxonomy/Occupancy'

atoms_state_ref = Quantity(
type=AtomsState,
description="""
Reference to the `AtomsState` section in which the occupancy is calculated.
""",
)

orbitals_state_ref = Quantity(
type=OrbitalsState,
description="""
Reference to the `OrbitalsState` section in which the occupancy is calculated.
""",
)

spin_channel = Quantity(
type=np.int32,
description="""
Spin channel of the corresponding electronic property. It can take values of 0 and 1.
""",
)

value = Quantity(
type=np.float64,
description="""
Value of the electronic occupancy in the atom defined by `atoms_state_ref` and the orbital
defined by `orbitals_state_ref`. the orbital. If `spin_channel` is set, then this number is
between 0 and 1, where 0 means that the state is unoccupied and 1 means that the state is
fully occupied; if `spin_channel` is not set, then this number is between 0 and 2.
""",
)

def __init__(
self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs
) -> None:
super().__init__(m_def, m_context, **kwargs)
self.name = self.m_def.name

# TODO add extraction from `ElectronicEigenvalues.occupation`

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)
4 changes: 2 additions & 2 deletions tests/test_greens_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
# limitations under the License.
#

from typing import Union, Optional
from typing import Optional, Union

import pytest

from nomad.datamodel import EntryArchive

from nomad_simulations.schema_packages.properties import (
QuasiparticleWeight,
)
Expand Down

0 comments on commit 40deb93

Please sign in to comment.