Skip to content

Commit 0f92eb9

Browse files
committed
check whether n_primitive matches the lengths of exponents and contraction coefficients
1 parent 42f4f38 commit 0f92eb9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/nomad_simulations/schema_packages/basis_set.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,19 @@ class AtomCenteredFunction(ArchiveSection):
242242

243243
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
244244
super().normalize(archive, logger)
245-
# self.name = self.m_def.name
245+
246+
# Validation: Check that n_primitive matches the lengths of exponents and contraction coefficients
247+
if self.n_primitive is not None:
248+
if len(self.exponents or []) != self.n_primitive:
249+
logger.error(
250+
f"Mismatch in number of exponents: expected {self.n_primitive}, "
251+
f"found {len(self.exponents or [])}."
252+
)
253+
if len(self.contraction_coefficients or []) != self.n_primitive:
254+
logger.error(
255+
f"Mismatch in number of contraction coefficients: expected {self.n_primitive}, "
256+
f"found {len(self.contraction_coefficients or [])}."
257+
)
246258

247259

248260
class AtomCenteredBasisSet(BasisSetComponent):

0 commit comments

Comments
 (0)