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

Promolecule: add default multiplicities for non-int charge (#82) #84

Merged
merged 3 commits into from
May 3, 2024

Conversation

msricher
Copy link
Collaborator

Fixes #82.

The 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",
)

now runs, but it isn't able to construct a Promolecule instance:

ValueError: Unable to construct species with non-integer charge/spin from database entries

This is a valid error to get, but it's not ideal. This is why, when making a Promolecule with non-integer charges, I suggested that the user should also specify the multiplicities.

Open to suggestions.

pre-commit-ci bot and others added 2 commits April 30, 2024 18:56
Added support for making promolecules with fractional charges and
no default multiplicities.
@marco-2023
Copy link
Collaborator

Hi @msricher I added the logic handling the case where charges are fractional and no multiplicity is given. It works now for the example.

@msricher msricher marked this pull request as ready for review May 3, 2024 11:58
@msricher msricher merged commit 23b0501 into theochem:master May 3, 2024
4 of 9 checks passed
msricher added a commit that referenced this pull request May 13, 2024
* Promolecule: add default multiplicities for non-int charge

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add fix to make_promolecule

Added support for making promolecules with fractional charges and
no default multiplicities.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Marco Martínez González <[email protected]>
msricher added a commit that referenced this pull request May 13, 2024
* Promolecule: add default multiplicities for non-int charge

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add fix to make_promolecule

Added support for making promolecules with fractional charges and
no default multiplicities.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Marco Martínez González <[email protected]>
marco-2023 added a commit that referenced this pull request May 13, 2024
* Promolecule: add default multiplicities for non-int charge

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add fix to make_promolecule

Added support for making promolecules with fractional charges and
no default multiplicities.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Marco Martínez González <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promolecules with fractional charges and default multiplicity fail
2 participants