diff --git a/src/nomad_simulations/schema_packages/basis_set.py b/src/nomad_simulations/schema_packages/basis_set.py index 7ee5ba87..b19f6618 100644 --- a/src/nomad_simulations/schema_packages/basis_set.py +++ b/src/nomad_simulations/schema_packages/basis_set.py @@ -202,9 +202,21 @@ class AtomCenteredFunction(ArchiveSection): ) function_type = Quantity( - type=MEnum('s', 'p', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', - 'sp', 'spd', 'spdf', - ), + type=MEnum( + 's', + 'p', + 'd', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'sp', + 'spd', + 'spdf', + ), description=""" L=a+b+c The angular momentum of GTO to be added. @@ -229,7 +241,7 @@ class AtomCenteredFunction(ArchiveSection): contraction_coefficients = Quantity( type=np.float32, - shape=['*'], # Flexible shape to handle combined types (e.g. SP, SPD..) + shape=['*'], # Flexible shape to handle combined types (e.g. SP, SPD..) description=""" List of contraction coefficients corresponding to the exponents. """, @@ -255,8 +267,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: if self.n_primitive is not None: if self.exponents is not None and len(self.exponents) != self.n_primitive: raise ValueError( - f"Mismatch in number of exponents: expected {self.n_primitive}, " - f"found {len(self.exponents)}." + f'Mismatch in number of exponents: expected {self.n_primitive}, ' + f'found {len(self.exponents)}.' ) # Resolve combined types @@ -266,8 +278,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: expected_coeffs = num_types * self.n_primitive if len(self.contraction_coefficients) != expected_coeffs: raise ValueError( - f"Mismatch in contraction coefficients for {self.function_type} type: " - f"expected {expected_coeffs}, found {len(self.contraction_coefficients)}." + f'Mismatch in contraction coefficients for {self.function_type} type: ' + f'expected {expected_coeffs}, found {len(self.contraction_coefficients)}.' ) # Split coefficients into separate lists for each type @@ -278,16 +290,18 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: # Debug: Log split coefficients for t, coeffs in self.coefficient_sets.items(): - logger.info(f"{t}-type coefficients: {coeffs}") + logger.info(f'{t}-type coefficients: {coeffs}') else: - logger.warning(f"No contraction coefficients provided for {self.function_type} type.") + logger.warning( + f'No contraction coefficients provided for {self.function_type} type.' + ) # For single types, ensure coefficients match primitives elif self.contraction_coefficients is not None: if len(self.contraction_coefficients) != self.n_primitive: raise ValueError( - f"Mismatch in contraction coefficients: expected {self.n_primitive}, " - f"found {len(self.contraction_coefficients)}." + f'Mismatch in contraction coefficients: expected {self.n_primitive}, ' + f'found {len(self.contraction_coefficients)}.' ) @@ -330,7 +344,7 @@ class AtomCenteredBasisSet(BasisSetComponent): total_number_of_basis_functions = Quantity( type=np.int32, - description="", + description='', ) functional_composition = SubSection( diff --git a/src/nomad_simulations/schema_packages/numerical_settings.py b/src/nomad_simulations/schema_packages/numerical_settings.py index 1a06b8ad..4abe1471 100644 --- a/src/nomad_simulations/schema_packages/numerical_settings.py +++ b/src/nomad_simulations/schema_packages/numerical_settings.py @@ -952,6 +952,42 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: super().normalize(archive, logger) +class OrbitalLocalization(SelfConsistency): + """ + Numerical settings that control orbital localization. + """ + + localization_method = ( + Quantity( + type=MEnum('FB', 'PM', 'IBO', 'IAOIBO', 'IAOBOYS' 'NEWBOYS' 'AHFB'), + description=""" + Name of the localization method. + """, + ), + ) + + orbital_window = ( + Quantity( + shape=['*'], + description=""" + the Molecular orbital range to be localized. + """, + ), + ) + + core_threshold = ( + Quantity( + type=np.float64, + description=""" + the energy window for the first occupied MO to be localized (in a.u.). + """, + ), + ) + + def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: + super().normalize(archive, logger) + + class GTOIntegralDecomposition(NumericalSettings): """ A general class for integral decomposition techniques for Coulomb and exchange integrals. diff --git a/tests/test_basis_set.py b/tests/test_basis_set.py index b209e92a..7e6dd427 100644 --- a/tests/test_basis_set.py +++ b/tests/test_basis_set.py @@ -426,8 +426,22 @@ def test_quick_step() -> None: [ ('cc-pVTZ', 'GTO', 'orbital', 'cc-pVTZ', 'GTO', 'orbital'), ('def2-TZVP', 'GTO', 'auxiliary_scf', 'def2-TZVP', 'GTO', 'auxiliary_scf'), - ('aug-cc-pVDZ', 'STO', 'auxiliary_post_hf', 'aug-cc-pVDZ', 'STO', 'auxiliary_post_hf'), - ('custom_basis', None, None, 'custom_basis', None, None), # Undefined type and role + ( + 'aug-cc-pVDZ', + 'STO', + 'auxiliary_post_hf', + 'aug-cc-pVDZ', + 'STO', + 'auxiliary_post_hf', + ), + ( + 'custom_basis', + None, + None, + 'custom_basis', + None, + None, + ), # Undefined type and role ], ) def test_atom_centered_basis_set_init( @@ -536,4 +550,3 @@ def test_atom_centered_basis_set_invalid_data(): # Call normalize to trigger validation with pytest.raises(ValueError, match='Mismatch in number of exponents'): invalid_function.normalize(None, None) -