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

Molecule.from_ase_atoms() does not pass kwargs appropriately #4320

Open
Andrew-S-Rosen opened this issue Mar 11, 2025 · 1 comment · May be fixed by #4321
Open

Molecule.from_ase_atoms() does not pass kwargs appropriately #4320

Andrew-S-Rosen opened this issue Mar 11, 2025 · 1 comment · May be fixed by #4321
Labels

Comments

@Andrew-S-Rosen
Copy link
Member

Andrew-S-Rosen commented Mar 11, 2025

Python version

3.12

Pymatgen version

2025.3.10

Operating system version

No response

Current behavior

The Molecule.from_ase_atoms method does not accept dedicated keyword arguments for the Molecule class. I demonstrate this below:

from ase.build import molecule
from pymatgen.core import Molecule
from pymatgen.io.ase import AseAtomsAdaptor

atoms = molecule("CH3")
Molecule.from_ase_atoms(atoms, charge_spin_check=False)

The above returns:

TypeError: Structure.__init__() got an unexpected keyword argument 'charge_spin_check'

However, the following works as expected:

from ase.build import molecule
from pymatgen.io.ase import AseAtomsAdaptor

atoms = molecule("CH3")
AseAtomsAdaptor.get_molecule(atoms, charge_spin_check=False)

This is not a hard patch. I personally can't fix it at the moment though. PRs welcome!

@DanielYang59
Copy link
Contributor

I'm happy to look into this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants