theochem / AtomDB

An Extended Periodic Table of Neutral and Charged Atomic Species
http://atomdb.qcdevs.org/
GNU General Public License v3.0
16 stars 14 forks source link

Promolecules with fractional charges and default multiplicity fail #82

Closed marco-2023 closed 6 months ago

marco-2023 commented 7 months ago

The make_promolecules fail for small fractional charges. See code example.

from atomdb import make_promolecule
import numpy as np

atnums = [7]
charges = [0.1]
atcoords = np.array([[0.0, 0.0, 0.0]])

# Build a promolecule
promol = make_promolecule(
    atnums,
    atcoords,
    charges=charges,
    units="bohr",
    dataset="gaussian",
)

The cause is in lines 620-623 of promolecules.py

    # Handle default multiplicity parameters
    if mults is None:
        # Force non-int charge to be integer here; will be overwritten below.
        mults = [MULTIPLICITIES[(atnum, charge)] for (atnum, charge) in zip(atnums, charges)]