Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define n_atoms_per_unit_cell for TB model method #139

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions src/nomad_simulations/schema_packages/model_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,20 +429,39 @@ class TB(ModelMethodElectronic):
a_eln=ELNAnnotation(component='EnumEditQuantity'),
)

# ? these 2 quantities will change when `BasisSet` is defined
n_orbitals = Quantity(
# ? these 4 quantities will change when `BasisSet` is defined
n_orbitals_per_atom = Quantity(
type=np.int32,
description="""
Number of orbitals per atom in the unit cell used as a basis to obtain the `TB` model. This
quantity is resolved from `orbitals_ref` via normalization.
""",
)

n_atoms_per_unit_cell = Quantity(
type=np.int32,
description="""
Number of orbitals used as a basis to obtain the `TB` model.
Number of atoms per unit cell relevant for the `TB` model. This quantity is resolved from
`n_total_orbitals` and `n_orbitals_per_atom` via normalization.
""",
)

n_total_orbitals = Quantity(
type=np.int32,
description="""
Total number of orbitals used as a basis to obtain the `TB` model. This quantity is parsed by
the specific parsing code. This is related with `n_orbitals_per_atom` and `n_atoms_per_unit_cell` as:
`n_total_orbitals` = `n_orbitals_per_atom` * `n_atoms_per_unit_cell`
""",
)

orbitals_ref = Quantity(
type=OrbitalsState,
shape=['n_orbitals'],
shape=['n_orbitals_per_atom'],
description="""
References to the `OrbitalsState` sections that contain the orbitals information which are
relevant for the `TB` model.
References to the `OrbitalsState` sections that contain the orbitals per atom in the unit cell information which are
relevant for the `TB` model. This quantity is resolved from normalization when the active atoms sub-systems `model_system.model_system[*]`
are populated.

Example: hydrogenated graphene with 3 atoms in the unit cell. The full list of `AtomsState` would
be
Expand Down Expand Up @@ -560,9 +579,15 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
model_systems=model_systems, logger=logger
)
if orbitals_ref is not None and len(orbitals_ref) > 0 and not self.orbitals_ref:
self.n_orbitals = len(orbitals_ref)
self.n_orbitals_per_atom = len(orbitals_ref)
self.orbitals_ref = orbitals_ref

# Resolve `n_atoms_per_unit_cell` from `n_total_orbitals` and `n_orbitals_per_atom`
if self.n_orbitals_per_atom is not None and self.n_total_orbitals is not None:
self.n_atoms_per_unit_cell = (
self.n_total_orbitals // self.n_orbitals_per_atom
)


class Wannier(TB):
"""
Expand Down