Skip to content

Commit e27c38c

Browse files
committed
Refactor Occupancy class to use Pattern A (ElectronicState gateway)
Complete Pattern A migration by refactoring the Occupancy class: 1. Remove atoms_state_ref field (deprecated Pattern B) 2. Update orbitals_state_ref description to document parent navigation 3. Update class docstring to explain ElectronicState gateway pattern 4. Update value description to remove atoms_state_ref reference With this change, all property classes now consistently use Pattern A: - Single orbital/entity reference pointing to ElectronicState - Navigate to parent AtomsState via get_parent_entity() - No circular references or dual reference patterns All 673 tests pass with these changes.
1 parent 17bb814 commit e27c38c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/nomad_simulations/schema_packages/properties/band_structure.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -316,22 +316,20 @@ class Occupancy(PhysicalProperty):
316316
spin-polarized systems, and between 0 and 2 for non-spin-polarized systems. This property is
317317
important when studying if an orbital or spin channel are fully occupied, at half-filling, or
318318
fully emptied, which have an effect on the electron-electron interaction effects.
319+
320+
The `orbitals_state_ref` field points to an `ElectronicState` describing the orbital. To access
321+
the parent AtomsState, use `orbitals_state_ref.get_parent_entity()`. This follows the
322+
ElectronicState gateway pattern.
319323
"""
320324

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

323-
atoms_state_ref = Quantity(
324-
type=AtomsState,
325-
description="""
326-
Reference to the `AtomsState` section in which the occupancy is calculated.
327-
""",
328-
)
329-
330327
orbitals_state_ref = Quantity(
331328
type=ElectronicState,
332329
description="""
333330
Reference to the `ElectronicState` section in which the occupancy is calculated.
334331
This can reference individual orbitals, orbital manifolds, or hybrid/molecular orbitals.
332+
The parent AtomsState can be accessed via `orbitals_state_ref.get_parent_entity()`.
335333
""",
336334
)
337335

@@ -345,10 +343,10 @@ class Occupancy(PhysicalProperty):
345343
value = Quantity(
346344
type=np.float64,
347345
description="""
348-
Value of the electronic occupancy in the atom defined by `atoms_state_ref` and the orbital
349-
defined by `orbitals_state_ref`. the orbital. If `spin_channel` is set, then this number is
350-
between 0 and 1, where 0 means that the state is unoccupied and 1 means that the state is
351-
fully occupied; if `spin_channel` is not set, then this number is between 0 and 2.
346+
Value of the electronic occupancy for the orbital defined by `orbitals_state_ref`.
347+
If `spin_channel` is set, then this number is between 0 and 1, where 0 means that
348+
the state is unoccupied and 1 means that the state is fully occupied; if `spin_channel`
349+
is not set, then this number is between 0 and 2.
352350
""",
353351
)
354352

0 commit comments

Comments
 (0)