Skip to content

Commit

Permalink
Add ElectronicGreensFunction and ElectronicSelfEnergy properties (#…
Browse files Browse the repository at this point in the history
…109)

* Added greens_function properties module

Added Time, ImaginaryTime, MatsubaraFrequency variables

Added info in description of hopping matrix

* Added greens function properties to outputs

* Added testing and fix normalize functions

* Added Occupancy property

* Fix output testing
  • Loading branch information
JosePizarro3 authored Aug 27, 2024
1 parent ffe8637 commit 90c99bc
Show file tree
Hide file tree
Showing 9 changed files with 770 additions and 9 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,18 @@ indent-width = 4
[tool.ruff.lint]
select = [
"E", # pycodestyle
"W", # pycodestyle
"PL", # pylint
"F", # Pyflakes
"UP", # pyupgrade
"I", # isort
]

ignore = [
"F401", # Module imported but unused
"E501", # Line too long ({width} > {limit} characters)
"E701", # Multiple statements on one line (colon)
"E731", # Do not assign a lambda expression, use a def
"E402", # Module level import not at top of file
"F401",
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments in function definition
Expand Down
23 changes: 23 additions & 0 deletions src/nomad_simulations/schema_packages/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@
ElectronicBandStructure,
ElectronicDensityOfStates,
ElectronicEigenvalues,
ElectronicGreensFunction,
ElectronicSelfEnergy,
FermiLevel,
FermiSurface,
HoppingMatrix,
HybridizationFunction,
KineticEnergy,
Occupancy,
Permittivity,
PotentialEnergy,
QuasiparticleWeight,
Temperature,
TotalEnergy,
TotalForce,
Expand Down Expand Up @@ -112,6 +117,24 @@ 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
)

electronic_self_energies = SubSection(
sub_section=ElectronicSelfEnergy.m_def, repeats=True
)

hybridization_functions = SubSection(
sub_section=HybridizationFunction.m_def, repeats=True
)

quasiparticle_weights = SubSection(
sub_section=QuasiparticleWeight.m_def, repeats=True
)

permittivities = SubSection(sub_section=Permittivity.m_def, repeats=True)

absorption_spectra = SubSection(sub_section=AbsorptionSpectrum.m_def, repeats=True)
Expand Down
8 changes: 7 additions & 1 deletion src/nomad_simulations/schema_packages/properties/__init__.py
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 All @@ -27,6 +27,12 @@
)
from .fermi_surface import FermiSurface
from .forces import BaseForce, ForceContribution, TotalForce
from .greens_function import (
ElectronicGreensFunction,
ElectronicSelfEnergy,
HybridizationFunction,
QuasiparticleWeight,
)
from .hopping_matrix import CrystalFieldSplitting, HoppingMatrix
from .permittivity import Permittivity
from .spectral_profile import (
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)
Loading

2 comments on commit 90c99bc

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_simulations/schema_packages
   __init__.py14286%53–55
   atoms_state.py1902189%31–33, 219–222, 246, 301–302, 370–371, 373, 555, 567–568, 629–633, 648–652, 659
   general.py75791%29–30, 98, 162, 272–273, 283
   model_method.py2657771%28–30, 189–192, 195–202, 294–295, 315, 336–355, 371–397, 400–417, 771, 782, 824–831, 869, 888, 968, 1025, 1100, 1214
   model_system.py2612292%43–45, 512–515, 562–569, 743–744, 965–969, 975–976, 984–985, 990, 1013
   numerical_settings.py2636575%30–32, 164, 234, 236–237, 240–243, 247–248, 255–258, 267–270, 274–277, 279–282, 287–290, 296–299, 470–497, 572, 607–610, 634, 637, 682, 684–687, 691, 695, 742, 746–767, 822–823, 890, 899–901, 904
   outputs.py1201092%27–28, 270–273, 313–316, 341, 343, 380, 399
   physical_property.py102793%38–40, 220, 349–351
   variables.py861286%26–28, 116, 139, 163, 185, 207, 229, 251, 274, 294
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%26–28, 153–154
   band_structure.py1232580%27–29, 250–283, 296, 303, 339–340, 343, 390–391, 396
   energies.py42979%25–27, 54, 75, 100, 121, 137, 152
   fermi_surface.py17476%25–27, 58
   forces.py22673%26–28, 55, 75, 98
   greens_function.py991387%25–27, 228–229, 232, 253–254, 257, 278–279, 282, 418
   hopping_matrix.py29583%25–27, 76, 112
   permittivity.py48883%25–27, 115–123
   spectral_profile.py26012851%27–29, 75–78, 113–116, 217–318, 374–386, 411–414, 434, 439–442, 484–520, 544, 591–594, 610–611, 616–622
   thermodynamics.py752764%25–27, 53, 74, 90, 99, 108, 119, 128, 155, 165, 175, 190–192, 195, 211, 231–233, 236, 252, 272–274, 277
src/nomad_simulations/schema_packages/utils
   utils.py681479%26–29, 79–88, 97–98, 103, 106
TOTAL223647179% 

Tests Skipped Failures Errors Time
344 0 💤 0 ❌ 0 🔥 2.653s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_simulations/schema_packages
   __init__.py14286%53–55
   atoms_state.py1902189%31–33, 219–222, 246, 301–302, 370–371, 373, 555, 567–568, 629–633, 648–652, 659
   general.py75791%29–30, 98, 162, 272–273, 283
   model_method.py2657771%28–30, 189–192, 195–202, 294–295, 315, 336–355, 371–397, 400–417, 771, 782, 824–831, 869, 888, 968, 1025, 1100, 1214
   model_system.py2612292%43–45, 512–515, 562–569, 743–744, 965–969, 975–976, 984–985, 990, 1013
   numerical_settings.py2636575%30–32, 164, 234, 236–237, 240–243, 247–248, 255–258, 267–270, 274–277, 279–282, 287–290, 296–299, 470–497, 572, 607–610, 634, 637, 682, 684–687, 691, 695, 742, 746–767, 822–823, 890, 899–901, 904
   outputs.py1201092%27–28, 270–273, 313–316, 341, 343, 380, 399
   physical_property.py102793%38–40, 220, 349–351
   variables.py861286%26–28, 116, 139, 163, 185, 207, 229, 251, 274, 294
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%26–28, 153–154
   band_structure.py1232580%27–29, 250–283, 296, 303, 339–340, 343, 390–391, 396
   energies.py42979%25–27, 54, 75, 100, 121, 137, 152
   fermi_surface.py17476%25–27, 58
   forces.py22673%26–28, 55, 75, 98
   greens_function.py991387%25–27, 228–229, 232, 253–254, 257, 278–279, 282, 418
   hopping_matrix.py29583%25–27, 76, 112
   permittivity.py48883%25–27, 115–123
   spectral_profile.py26012851%27–29, 75–78, 113–116, 217–318, 374–386, 411–414, 434, 439–442, 484–520, 544, 591–594, 610–611, 616–622
   thermodynamics.py752764%25–27, 53, 74, 90, 99, 108, 119, 128, 155, 165, 175, 190–192, 195, 211, 231–233, 236, 252, 272–274, 277
src/nomad_simulations/schema_packages/utils
   utils.py681479%26–29, 79–88, 97–98, 103, 106
TOTAL223647179% 

Tests Skipped Failures Errors Time
344 0 💤 0 ❌ 0 🔥 2.495s ⏱️

Please sign in to comment.