Skip to content

Commit 9f2c80f

Browse files
Check multiplicity argument passed to compilation script for HF numeric. (#24)
* Catch incorrect multiplicities passed when compiling numeric dataset. Use the table of multiplicities for the isoelectronic series to verify the mult parameter in the run scripts. The results from HF numeric calculations are only for the most stable electronic configuration of an atomic species. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fecdd2d commit 9f2c80f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

atomdb/datasets/numeric/__init__.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
import atomdb
3333

34+
from atomdb.api import MULTIPLICITIES
35+
3436

3537
def load_numerical_hf_data():
3638
"""Load data from desnity.out file into a `SpeciesTable`."""
@@ -107,7 +109,10 @@ def run(elem, charge, mult, nexc, dataset, datapath):
107109
# Check arguments
108110
if nexc != 0:
109111
raise ValueError("Nonzero value of `nexc` is not currently supported")
110-
# FIXME: check input multiplicity against tabulated values for isoelectronic serie
112+
if charge < -1:
113+
raise ValueError("The charge must be greater than or equal to -1.")
114+
if charge == elem:
115+
raise ValueError("The atomic number and charge cannot be the same.")
111116

112117
# Set up internal variables
113118
elem = atomdb.element_symbol(elem)
@@ -118,6 +123,11 @@ def run(elem, charge, mult, nexc, dataset, datapath):
118123
n_dn = (nelec - nspin) // 2
119124
basis = None
120125

126+
# Check that the input multiplicity corresponds to the most stable electronic configuration.
127+
# For charged species take the multiplicity from the neutral isoelectronic species.
128+
if mult != MULTIPLICITIES[nelec]:
129+
raise ValueError(f"Multiplicity {mult} not available for {elem} with charge = {charge}.")
130+
121131
species_table = load_numerical_hf_data()
122132
data = species_table[(natom, nelec)]
123133

0 commit comments

Comments
 (0)