From 1e671c8ca45a78633ccc8c3331feda6574b2b8ee Mon Sep 17 00:00:00 2001 From: ndaelman Date: Tue, 12 Nov 2024 20:54:46 +0100 Subject: [PATCH] - Make `PhysicalProperty` initialize `self.name` - Remove wasteful `__init__` and `normalize` --- .../schema_packages/physical_property.py | 3 +- .../schema_packages/properties/band_gap.py | 75 +++---------------- .../properties/band_structure.py | 32 -------- .../schema_packages/properties/energies.py | 43 ----------- .../properties/fermi_surface.py | 12 +-- .../schema_packages/properties/forces.py | 9 --- .../properties/greens_function.py | 33 -------- .../properties/hopping_matrix.py | 18 ----- .../properties/permittivity.py | 1 - .../properties/spectral_profile.py | 35 --------- .../properties/thermodynamics.py | 63 ---------------- tests/properties/test_band_gap.py | 5 -- 12 files changed, 14 insertions(+), 315 deletions(-) diff --git a/src/nomad_simulations/schema_packages/physical_property.py b/src/nomad_simulations/schema_packages/physical_property.py index b073bdb2..15d15b43 100644 --- a/src/nomad_simulations/schema_packages/physical_property.py +++ b/src/nomad_simulations/schema_packages/physical_property.py @@ -31,7 +31,7 @@ logger = utils.get_logger(__name__) -def validate_quantity_wrt_value(name: str = ''): +def validate_quantity_wrt_value(name: str = ''): # ! tone down to `quantity_present` """ Decorator to validate the existence of a quantity and its shape with respect to the `PhysicalProperty.value` before calling a method. An example can be found in the module `properties/band_structure.py` for the method @@ -238,6 +238,7 @@ 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 # Checking if IRI is defined if not self.iri: diff --git a/src/nomad_simulations/schema_packages/properties/band_gap.py b/src/nomad_simulations/schema_packages/properties/band_gap.py index 7348f599..f60d63c5 100644 --- a/src/nomad_simulations/schema_packages/properties/band_gap.py +++ b/src/nomad_simulations/schema_packages/properties/band_gap.py @@ -23,6 +23,7 @@ class ElectronicBandGap(PhysicalProperty): type = Quantity( type=MEnum('direct', 'indirect'), + shape=['*'], description=""" Type categorization of the electronic band gap. This quantity is directly related with `momentum_transfer` as by definition, the electronic band gap is `'direct'` for zero momentum transfer (or if `momentum_transfer` is `None`) and `'indirect'` @@ -34,15 +35,13 @@ class ElectronicBandGap(PhysicalProperty): momentum_transfer = Quantity( type=np.float64, - shape=[2, 3], + shape=['*', 2, 3], description=""" If the electronic band gap is `'indirect'`, the reciprocal momentum transfer for which the band gap is defined in units of the `reciprocal_lattice_vectors`. The initial and final momentum 3D vectors are given in the first and second element. Example, the momentum transfer in bulk Si2 happens between the Γ and the (approximately) X points in the Brillouin zone; thus: - `momentum_transfer = [[0, 0, 0], [0.5, 0.5, 0]]`. - - Note: this quantity only refers to scalar `value`, not to arrays of `value`. + `momentum_transfer = [[[0, 0, 0], [0.5, 0.5, 0]]]`. """, ) @@ -53,7 +52,7 @@ class ElectronicBandGap(PhysicalProperty): """, ) - value = Quantity( + _base_value = Quantity( type=np.float64, unit='joule', description=""" @@ -62,35 +61,7 @@ class ElectronicBandGap(PhysicalProperty): """, ) - 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 - - def validate_values(self, logger: 'BoundLogger') -> Optional[pint.Quantity]: - """ - Validate the electronic band gap `value` by checking if they are negative and sets them to None if they are. - - Args: - logger (BoundLogger): The logger to log messages. - """ - value = self.value.magnitude - if not isinstance(self.value.magnitude, np.ndarray): # for scalars - value = np.array( - [value] - ) # ! check this when talking with Lauri and Theodore - - # Set the value to 0 when it is negative - if (value < 0).any(): - logger.error('The electronic band gap cannot be defined negative.') - return None - - if not isinstance(self.value.magnitude, np.ndarray): # for scalars - value = value[0] - return value * self.value.u - - def resolve_type(self, logger: 'BoundLogger') -> Optional[str]: + def momentum_to_type(self, mtr, logger: 'BoundLogger') -> Optional[str]: """ Resolves the `type` of the electronic band gap based on the stored `momentum_transfer` values. @@ -100,23 +71,7 @@ def resolve_type(self, logger: 'BoundLogger') -> Optional[str]: Returns: (Optional[str]): The resolved `type` of the electronic band gap. """ - mtr = self.momentum_transfer if self.momentum_transfer is not None else [] - - # Check if the `momentum_transfer` is [], and return the type and a warning in the log for `indirect` band gaps - if len(mtr) == 0: - if self.type == 'indirect': - logger.warning( - 'The `momentum_transfer` is not stored for an `indirect` band gap.' - ) - return self.type - - # Check if the `momentum_transfer` has at least two elements, and return None if it does not - if len(mtr) == 1: - logger.warning( - 'The `momentum_transfer` should have at least two elements so that the difference can be calculated and the type of electronic band gap can be resolved.' - ) - return None - + # Resolve `type` from the difference between the initial and final momentum transfer momentum_difference = np.diff(mtr, axis=0) if (np.isclose(momentum_difference, np.zeros(3))).all(): @@ -127,17 +82,9 @@ def resolve_type(self, logger: 'BoundLogger') -> Optional[str]: def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: super().normalize(archive, logger) - # Checks if the `value` is negative and sets it to None if it is. - self.value = self.validate_values(logger) - if self.value is None: + if self.value is not None and np.any(self.value < 0.): + logger.warning('The electronic band gap cannot be defined negative.') # ? What about deleting the class if `value` is None? - logger.error('The `value` of the electronic band gap is not stored.') - return - - # Resolve the `type` of the electronic band gap from `momentum_transfer`, ONLY for scalar `value` - if isinstance(self.value.magnitude, np.ndarray): - logger.info( - 'We do not support `type` which describe individual elements in an array `value`.' - ) - else: - self.type = self.resolve_type(logger) + + if self.momentum_transfer: + self.type = self.momentum_to_type(self.momentum_transfer, logger) diff --git a/src/nomad_simulations/schema_packages/properties/band_structure.py b/src/nomad_simulations/schema_packages/properties/band_structure.py index 1c1d71a7..9d8a20ad 100644 --- a/src/nomad_simulations/schema_packages/properties/band_structure.py +++ b/src/nomad_simulations/schema_packages/properties/band_structure.py @@ -48,14 +48,6 @@ class BaseElectronicEigenvalues(PhysicalProperty): """, ) - def __init__( - self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs - ) -> None: - super().__init__(m_def, m_context, **kwargs) - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class ElectronicEigenvalues(BaseElectronicEigenvalues): """ """ @@ -124,12 +116,6 @@ class ElectronicEigenvalues(BaseElectronicEigenvalues): """, ) - 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 - @validate_quantity_wrt_value(name='occupation') def order_eigenvalues(self) -> Union[bool, tuple[pint.Quantity, np.ndarray]]: """ @@ -314,15 +300,6 @@ class ElectronicBandStructure(ElectronicEigenvalues): iri = 'http://fairmat-nfdi.eu/taxonomy/ElectronicBandStructure' - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class Occupancy(PhysicalProperty): """ @@ -365,13 +342,4 @@ class Occupancy(PhysicalProperty): """, ) - 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) diff --git a/src/nomad_simulations/schema_packages/properties/energies.py b/src/nomad_simulations/schema_packages/properties/energies.py index c3f67501..6a846ae4 100644 --- a/src/nomad_simulations/schema_packages/properties/energies.py +++ b/src/nomad_simulations/schema_packages/properties/energies.py @@ -32,9 +32,6 @@ class BaseEnergy(PhysicalProperty): """, ) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class EnergyContribution(BaseEnergy, PropertyContribution): """ @@ -52,10 +49,6 @@ class EnergyContribution(BaseEnergy, PropertyContribution): relevant atoms or electrons or as a function of them. """ - # TODO address the dual parent normalization explicity - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - #################################### # List of specific energy properties @@ -69,15 +62,6 @@ class FermiLevel(BaseEnergy): iri = 'http://fairmat-nfdi.eu/taxonomy/FermiLevel' - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - #! The only issue with this structure is that total energy will never be a sum of its contributions, #! since kinetic energy lives separately, but I think maybe this is ok? @@ -90,15 +74,6 @@ class TotalEnergy(BaseEnergy): # ? add a generic contributions quantity to PhysicalProperty contributions = SubSection(sub_section=EnergyContribution.m_def, repeats=True) - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - # ? Separate quantities for nuclear and electronic KEs? class KineticEnergy(BaseEnergy): @@ -106,26 +81,8 @@ class KineticEnergy(BaseEnergy): Physical property section describing the kinetic energy of a (sub)system. """ - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class PotentialEnergy(BaseEnergy): """ Physical property section describing the potential energy of a (sub)system. """ - - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) diff --git a/src/nomad_simulations/schema_packages/properties/fermi_surface.py b/src/nomad_simulations/schema_packages/properties/fermi_surface.py index 5ec32782..83117713 100644 --- a/src/nomad_simulations/schema_packages/properties/fermi_surface.py +++ b/src/nomad_simulations/schema_packages/properties/fermi_surface.py @@ -28,14 +28,4 @@ class FermiSurface(PhysicalProperty): """, ) - # ! TODO _base_value - - def __init__( - self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs - ) -> None: - super().__init__(m_def, m_context, **kwargs) - # ! `n_bands` need to be set up during initialization of the class - self.name = self.m_def.name - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) + # ! TODO add `_base_value` diff --git a/src/nomad_simulations/schema_packages/properties/forces.py b/src/nomad_simulations/schema_packages/properties/forces.py index f621dbfa..92c915b8 100644 --- a/src/nomad_simulations/schema_packages/properties/forces.py +++ b/src/nomad_simulations/schema_packages/properties/forces.py @@ -50,9 +50,6 @@ class ForceContribution(BaseForce, PropertyContribution): relevant atoms or electrons or as a function of them. """ - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - ################################### # List of specific force properties @@ -66,9 +63,3 @@ class TotalForce(BaseForce): """ contributions = SubSection(sub_section=ForceContribution.m_def, repeats=True) - - 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 diff --git a/src/nomad_simulations/schema_packages/properties/greens_function.py b/src/nomad_simulations/schema_packages/properties/greens_function.py index d5355919..f1e694f0 100644 --- a/src/nomad_simulations/schema_packages/properties/greens_function.py +++ b/src/nomad_simulations/schema_packages/properties/greens_function.py @@ -195,15 +195,6 @@ class ElectronicGreensFunction(BaseGreensFunction): """, ) - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class ElectronicSelfEnergy(BaseGreensFunction): """ @@ -221,15 +212,6 @@ class ElectronicSelfEnergy(BaseGreensFunction): """, ) - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class HybridizationFunction(BaseGreensFunction): """ @@ -247,15 +229,6 @@ class HybridizationFunction(BaseGreensFunction): """, ) - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class QuasiparticleWeight(PhysicalProperty): """ @@ -337,12 +310,6 @@ class QuasiparticleWeight(PhysicalProperty): """, ) - 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 - def is_valid_quasiparticle_weight(self) -> bool: """ Check if the quasiparticle weight values are valid, i.e., if all `value` are defined between diff --git a/src/nomad_simulations/schema_packages/properties/hopping_matrix.py b/src/nomad_simulations/schema_packages/properties/hopping_matrix.py index 6446fa60..31a8664b 100644 --- a/src/nomad_simulations/schema_packages/properties/hopping_matrix.py +++ b/src/nomad_simulations/schema_packages/properties/hopping_matrix.py @@ -45,17 +45,8 @@ class HoppingMatrix(PhysicalProperty): """, ) - 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 normalization to extract DOS, band structure, etc, properties from `HoppingMatrix` - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class CrystalFieldSplitting(PhysicalProperty): """ @@ -81,12 +72,3 @@ class CrystalFieldSplitting(PhysicalProperty): at the same Wigner-Seitz point (0, 0, 0). """, ) - - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) diff --git a/src/nomad_simulations/schema_packages/properties/permittivity.py b/src/nomad_simulations/schema_packages/properties/permittivity.py index ba5e23ed..41176441 100644 --- a/src/nomad_simulations/schema_packages/properties/permittivity.py +++ b/src/nomad_simulations/schema_packages/properties/permittivity.py @@ -52,7 +52,6 @@ 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 self._axes_map = ['xx', 'yy', 'zz'] def resolve_type(self) -> str: diff --git a/src/nomad_simulations/schema_packages/properties/spectral_profile.py b/src/nomad_simulations/schema_packages/properties/spectral_profile.py index 86ea8f5c..0a18b2f8 100644 --- a/src/nomad_simulations/schema_packages/properties/spectral_profile.py +++ b/src/nomad_simulations/schema_packages/properties/spectral_profile.py @@ -33,11 +33,6 @@ class SpectralProfile(PhysicalProperty): """, ) # TODO check units and normalization_factor of DOS and Spectras and see whether they can be merged - def __init__( - self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs - ) -> None: - super().__init__(m_def, m_context, **kwargs) - def is_valid_spectral_profile(self) -> bool: """ Check if the spectral profile is valid, i.e., if all `value` are defined positive. @@ -73,11 +68,6 @@ class DOSProfile(SpectralProfile): """, ) - def __init__( - self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs - ) -> None: - super().__init__(m_def, m_context, **kwargs) - def resolve_pdos_name(self, logger: 'BoundLogger') -> Optional[str]: """ Resolve the `name` of the projected `DOSProfile` from the `entity_ref` section. This is resolved as: @@ -106,8 +96,6 @@ def resolve_pdos_name(self, logger: 'BoundLogger') -> Optional[str]: def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: super().normalize(archive, logger) - - # We resolve self.name = self.resolve_pdos_name(logger) @@ -169,12 +157,6 @@ class ElectronicDensityOfStates(DOSProfile): """, ) - 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 - def resolve_energies_origin( self, energies: pint.Quantity, @@ -512,16 +494,6 @@ class AbsorptionSpectrum(SpectralProfile): """, ) - def __init__( - self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs - ) -> None: - super().__init__(m_def, m_context, **kwargs) - # Set the name of the section - self.name = self.m_def.name - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class XASSpectrum(AbsorptionSpectrum): """ @@ -544,13 +516,6 @@ class XASSpectrum(AbsorptionSpectrum): repeats=False, ) - def __init__( - self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs - ) -> None: - super().__init__(m_def, m_context, **kwargs) - # Set the name of the section - self.name = self.m_def.name - def generate_from_contributions(self, logger: 'BoundLogger') -> None: """ Generate the `value` of the XAS spectrum by concatenating the XANES and EXAFS contributions. It also concatenates diff --git a/src/nomad_simulations/schema_packages/properties/thermodynamics.py b/src/nomad_simulations/schema_packages/properties/thermodynamics.py index 769f4828..50db0798 100644 --- a/src/nomad_simulations/schema_packages/properties/thermodynamics.py +++ b/src/nomad_simulations/schema_packages/properties/thermodynamics.py @@ -31,9 +31,6 @@ class Pressure(PhysicalProperty): """, ) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class Volume(PhysicalProperty): """ @@ -52,9 +49,6 @@ class Volume(PhysicalProperty): """, ) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class Temperature(PhysicalProperty): """ @@ -68,27 +62,18 @@ class Temperature(PhysicalProperty): """, ) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class Heat(BaseEnergy): """ The transfer of thermal energy **into** a system. """ - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class Work(BaseEnergy): """ The energy transferred to a system by means of force applied over a distance. """ - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class InternalEnergy(BaseEnergy): """ @@ -97,18 +82,12 @@ class InternalEnergy(BaseEnergy): process may be expressed as the `Heat` minus the `Work`. """ - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class Enthalpy(BaseEnergy): """ The total heat content of a system, defined as 'InternalEnergy' + 'Pressure' * 'Volume'. """ - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class Entropy(PhysicalProperty): """ @@ -133,9 +112,6 @@ class Entropy(PhysicalProperty): """, ) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class GibbsFreeEnergy(BaseEnergy): """ @@ -143,9 +119,6 @@ class GibbsFreeEnergy(BaseEnergy): given by `Enthalpy` - `Temperature` * `Entropy`. """ - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class HelmholtzFreeEnergy(BaseEnergy): """ @@ -153,9 +126,6 @@ class HelmholtzFreeEnergy(BaseEnergy): given by `InternalEnergy` - `Temperature` * `Entropy`. """ - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class ChemicalPotential(BaseEnergy): """ @@ -164,15 +134,6 @@ class ChemicalPotential(BaseEnergy): iri = 'http://fairmat-nfdi.eu/taxonomy/ChemicalPotential' - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class HeatCapacity(PhysicalProperty): """ @@ -186,9 +147,6 @@ class HeatCapacity(PhysicalProperty): """, ) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - ################################ # other thermodynamic properties @@ -212,15 +170,6 @@ class VirialTensor(BaseEnergy): # ? retain `BaseEnergy` for a semantic reasons """, ) - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - class MassDensity(PhysicalProperty): """ @@ -234,9 +183,6 @@ class MassDensity(PhysicalProperty): """, ) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) - # ? fit better elsewhere class Hessian(PhysicalProperty): @@ -252,12 +198,3 @@ class Hessian(PhysicalProperty): description=""" """, ) - - 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 - - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: - super().normalize(archive, logger) diff --git a/tests/properties/test_band_gap.py b/tests/properties/test_band_gap.py index 48939ea8..0f928a89 100644 --- a/tests/properties/test_band_gap.py +++ b/tests/properties/test_band_gap.py @@ -22,12 +22,7 @@ def test_default_quantities(self): Test the default quantities assigned when creating an instance of the `ElectronicBandGap` class. """ electronic_band_gap = ElectronicBandGap() - assert ( - electronic_band_gap.iri - == 'http://fairmat-nfdi.eu/taxonomy/ElectronicBandGap' - ) assert electronic_band_gap.name == 'ElectronicBandGap' - assert electronic_band_gap.rank == [] @pytest.mark.parametrize( 'value, result',