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

Check multiplicity argument passed to compilation script for HF numeric. #24

Merged
merged 2 commits into from
Feb 17, 2024
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
12 changes: 11 additions & 1 deletion atomdb/datasets/numeric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

import atomdb

from atomdb.api import MULTIPLICITIES


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

# Set up internal variables
elem = atomdb.element_symbol(elem)
Expand All @@ -108,6 +113,11 @@ def run(elem, charge, mult, nexc, dataset, datapath):
n_dn = (nelec - nspin) // 2
basis = None

# Check that the input multiplicity corresponds to the most stable electronic configuration.
# For charged species take the multiplicity from the neutral isoelectronic species.
if mult != MULTIPLICITIES[nelec]:
raise ValueError(f"Multiplicity {mult} not available for {elem} with charge = {charge}.")

species_table = load_numerical_hf_data()
data = species_table[(natom, nelec)]

Expand Down