Skip to content

Commit 6f3e30b

Browse files
committed
add a placeholder MolecularOrbitalsState
1 parent 95e319c commit 6f3e30b

File tree

2 files changed

+86
-65
lines changed

2 files changed

+86
-65
lines changed

src/nomad_simulations/schema_packages/atoms_state.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,3 +641,72 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
641641
self.chemical_symbol = self.resolve_chemical_symbol(logger=logger)
642642
if self.atomic_number is None:
643643
self.atomic_number = self.resolve_atomic_number(logger=logger)
644+
645+
646+
class MolecularOrbitalsState(Entity):
647+
"""
648+
A base section to define molecular orbitals.
649+
"""
650+
651+
symmetry_label = Quantity(
652+
type=str,
653+
description="""
654+
Symmetry label of the molecular orbital (e.g., 'sigma', 'pi', 'delta').
655+
""",
656+
)
657+
658+
energy = Quantity(
659+
type=np.float64,
660+
#unit='eV',
661+
description="""
662+
Energy of the molecular orbital.
663+
""",
664+
)
665+
666+
occupation = Quantity(
667+
type=np.float64,
668+
description="""
669+
Occupation of the molecular orbital. This value is typically an integer (0 or 2)
670+
in closed-shell systems, but can be fractional in open-shell or spin-polarized
671+
calculations.
672+
""",
673+
)
674+
675+
spin = Quantity(
676+
type=MEnum('alpha', 'beta'),
677+
description="""
678+
Spin of the molecular orbital. 'alpha' corresponds to spin-up, 'beta' corresponds
679+
to spin-down.
680+
""",
681+
)
682+
683+
coefficients = Quantity(
684+
type=np.float64,
685+
shape=['number_of_atoms', 'number_of_basis_functions'],
686+
description="""
687+
Coefficients of the molecular orbital expressed as a linear combination of atomic orbitals.
688+
The shape corresponds to the number of atoms and their associated basis functions.
689+
""",
690+
)
691+
692+
atom_contributions = SubSection(
693+
sub_section=AtomsState.m_def,
694+
repeats=True,
695+
description="""
696+
Contribution of each atom to the molecular orbital, as defined by its basis functions.
697+
""",
698+
)
699+
700+
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
701+
super().normalize(archive, logger)
702+
703+
# Validation: Ensure occupation values are consistent
704+
if self.occupation is not None and (self.occupation < 0 or self.occupation > 2):
705+
logger.error("The molecular orbital occupation must be between 0 and 2.")
706+
707+
# Validation: Ensure coefficients are provided if atom contributions are defined
708+
if self.atom_contributions and self.coefficients is None:
709+
logger.error(
710+
"Coefficients must be defined when atom contributions are provided."
711+
)
712+

src/nomad_simulations/schema_packages/model_method.py

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,31 +1223,6 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
12231223
super().normalize(archive, logger)
12241224

12251225

1226-
class BaseMolecularOrbital(ArchiveSection):
1227-
"""
1228-
A section representing a single molecular orbital.
1229-
"""
1230-
1231-
energy = Quantity(
1232-
type=np.float64,
1233-
# unit='electron_volt',
1234-
description='Energy of the molecular orbital.',
1235-
)
1236-
1237-
occupation = Quantity(
1238-
type=np.float64, description='Occupation number of the molecular orbital.'
1239-
)
1240-
1241-
symmetry_label = Quantity(
1242-
type=str, description='Symmetry label of the molecular orbital.'
1243-
)
1244-
1245-
orbital_ref = SubSection(
1246-
sub_section=OrbitalsState.m_def,
1247-
description='Reference to the underlying atomic orbital state.',
1248-
)
1249-
1250-
12511226
class MolecularOrbitals(ArchiveSection):
12521227
"""
12531228
A section for molecular orbital schemes used in quantum chemistry calculations.
@@ -1268,18 +1243,6 @@ class MolecularOrbitals(ArchiveSection):
12681243
a_eln=ELNAnnotation(component='EnumEditQuantity'),
12691244
)
12701245

1271-
orbital_set = Quantity(
1272-
type=MEnum('canonical', 'natural', 'localized'),
1273-
description="""
1274-
Specifies the type of orbitals used in the molecular orbital scheme:
1275-
- canonical: Default canonical molecular orbitals.
1276-
- natural: Natural orbitals obtained from the density matrix.
1277-
- localized: Localized orbitals such as Boys or Foster-Boys localization.
1278-
TODO: this will be later connected to MCSCF.
1279-
""",
1280-
a_eln=ELNAnnotation(component='EnumEditQuantity'),
1281-
)
1282-
12831246
n_alpha_electrons = Quantity(
12841247
type=np.int32,
12851248
description="""
@@ -1301,16 +1264,16 @@ class MolecularOrbitals(ArchiveSection):
13011264
""",
13021265
)
13031266

1304-
molecular_orbitals = SubSection(
1305-
sub_section=BaseMolecularOrbital.m_def,
1306-
repeats=True,
1307-
description="""
1308-
Detailed information about each molecular orbital,
1309-
including energy, occupation, and symmetry label.
1310-
""",
1311-
)
1267+
# molecular_orbitals = SubSection(
1268+
# sub_section=BaseMolecularOrbital.m_def,
1269+
# repeats=True,
1270+
# description="""
1271+
# Detailed information about each molecular orbital,
1272+
# including energy, occupation, and symmetry label.
1273+
# """,
1274+
# )
13121275

1313-
total_spin = Quantity(
1276+
sz_projection = Quantity(
13141277
type=np.float64,
13151278
description="""
13161279
Total spin of the system defined as S = (n_alpha_electrons - n_beta_electrons) / 2.
@@ -1364,24 +1327,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
13641327
if not self.validate_scheme(logger):
13651328
logger.error('Invalid molecular orbital scheme.')
13661329

1367-
# Resolve the number of molecular orbitals
1368-
if self.n_molecular_orbitals is None and self.molecular_orbitals:
1369-
self.n_molecular_orbitals = len(self.molecular_orbitals)
1370-
1371-
# Validate molecular orbital occupation
1372-
total_occupation = sum(
1373-
orbital.occupation
1374-
for orbital in self.molecular_orbitals
1375-
if orbital.occupation is not None
1376-
)
1377-
expected_occupation = self.n_alpha_electrons + self.n_beta_electrons
1378-
if total_occupation != expected_occupation:
1379-
logger.warning(
1380-
f'The total occupation ({total_occupation}) does not match the expected value ({expected_occupation}).'
1381-
)
1382-
13831330

1384-
class GTOIntegralDecomposition(BaseModelMethod):
1331+
class IntegralDecomposition(BaseModelMethod):
13851332
"""
13861333
A general class for integral decomposition techniques for Coulomb and exchange integrals to speed up the calculation.
13871334
Examples:
@@ -1463,16 +1410,20 @@ class LocalCorrelation(ArchiveSection):
14631410
"""
14641411

14651412
type = Quantity(
1466-
type=MEnum('PNO', 'domain'),
1413+
type=MEnum('PNO', 'LPNO', 'DLPNO'),
14671414
description="""
14681415
the type of local correlation.
14691416
""",
14701417
)
14711418

14721419
ansatz = Quantity(
1473-
type=MEnum('LMP2', 'LCC', 'LocalDFT'),
1420+
type=MEnum('MP2', 'CC', 'DH-DFT'),
14741421
description="""
14751422
The underlying ansatz for the local correlation treatment.
1423+
LMP2
1424+
LCC
1425+
DH-DFT: double-hybrid DFT
1426+
...
14761427
""",
14771428
)
14781429

@@ -1493,6 +1444,7 @@ class CoupledCluster(ModelMethodElectronic):
14931444
a_eln=ELNAnnotation(component='StringEditQuantity'),
14941445
)
14951446

1447+
# add a real reference determinant reference
14961448
reference_determinant = Quantity(
14971449
type=MEnum('UHF', 'RHF', 'ROHF', 'UKS', 'RKS', 'ROKS'),
14981450
description="""

0 commit comments

Comments
 (0)