Skip to content

Commit

Permalink
Remove remaining ranks
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Nov 12, 2024
1 parent 512dee6 commit 8e80cf4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def __init__(
) -> None:
super().__init__(m_def, m_context, **kwargs)
self.name = self.m_def.name
self.rank = []

def validate_values(self, logger: 'BoundLogger') -> Optional[pint.Quantity]:
"""
Expand Down
45 changes: 20 additions & 25 deletions src/nomad_simulations/schema_packages/properties/greens_function.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

import numpy as np
from nomad.metainfo import MEnum, Quantity
Expand Down Expand Up @@ -129,16 +129,6 @@ class BaseGreensFunction(PhysicalProperty):
""",
)

def __init__(
self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs
) -> None:
super().__init__(m_def, m_context, **kwargs)
# ! n_orbitals need to be set up during initialization of the class
self.rank = [
int(kwargs.get('n_atoms')),
int(kwargs.get('n_correlated_orbitals')),
]

def resolve_space_id(self) -> str:
"""
Resolves the `space_id` based on the stored `variables` in the class.
Expand Down Expand Up @@ -196,9 +186,10 @@ class ElectronicGreensFunction(BaseGreensFunction):

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

value = Quantity(
_base_value = Quantity(
type=np.complex128,
unit='1/joule',
shape=['n_atoms', 'n_correlated_orbitals'],
description="""
Value of the electronic Green's function matrix.
""",
Expand All @@ -221,9 +212,10 @@ class ElectronicSelfEnergy(BaseGreensFunction):

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

value = Quantity(
_base_value = Quantity(
type=np.complex128,
unit='joule',
shape=['n_atoms', 'n_correlated_orbitals'],
description="""
Value of the electronic self-energy matrix.
""",
Expand All @@ -246,9 +238,10 @@ class HybridizationFunction(BaseGreensFunction):

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

value = Quantity(
_base_value = Quantity(
type=np.complex128,
unit='joule',
shape=['n_atoms', 'n_correlated_orbitals'],
description="""
Value of the electronic hybridization function.
""",
Expand Down Expand Up @@ -336,8 +329,9 @@ class QuasiparticleWeight(PhysicalProperty):
""",
)

value = Quantity(
_base_value = Quantity(
type=np.float64,
shape=['n_atoms', 'n_correlated_orbitals'],
description="""
Value of the quasiparticle weight matrices.
""",
Expand All @@ -347,11 +341,6 @@ def __init__(
self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs
) -> None:
super().__init__(m_def, m_context, **kwargs)
# ! n_orbitals need to be set up during initialization of the class
self.rank = [
int(kwargs.get('n_atoms')),
int(kwargs.get('n_correlated_orbitals')),
]
self.name = self.m_def.name

def is_valid_quasiparticle_weight(self) -> bool:
Expand All @@ -362,26 +351,32 @@ def is_valid_quasiparticle_weight(self) -> bool:
Returns:
(bool): True if the quasiparticle weight is valid, False otherwise.
"""
if (self.value < 0.0).any() or (self.value > 1.0).any():
if self.value is None:
return False
elif (self.value < 0.0).any() or (self.value > 1.0).any():
return False
return True
else:
return True

def resolve_system_correlation_strengths(self) -> str:
def resolve_system_correlation_strengths(self) -> Optional[str]:
"""
Resolves the `system_correlation_strengths` of the quasiparticle weight based on the stored `value` values.
Returns:
str: The resolved `system_correlation_strengths` of the quasiparticle weight.
"""
if np.all(self.value > 0.7):
if self.value is None:
return None
elif np.all(self.value > 0.7):
return 'non-correlated metal'
elif np.all((self.value < 0.4) & (self.value > 0)):
return 'strongly-correlated metal'
elif np.any(self.value == 0) and np.any(self.value > 0):
return 'OSMI'
elif np.all(self.value < 1e-2):
return 'Mott insulator'
return None
else:
return None

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

0 comments on commit 8e80cf4

Please sign in to comment.