diff --git a/src/pymatgen/io/aims/inputs.py b/src/pymatgen/io/aims/inputs.py index 8304a6eb0d5..6f370aeae21 100644 --- a/src/pymatgen/io/aims/inputs.py +++ b/src/pymatgen/io/aims/inputs.py @@ -154,16 +154,22 @@ def from_structure(cls, structure: Structure | Molecule) -> Self: content_lines.append(f"lattice_vector {lv[0]: .12e} {lv[1]: .12e} {lv[2]: .12e}") for site in structure: - element = site.species_string + element = site.species_string.split(",spin=")[0] charge = site.properties.get("charge", 0) spin = site.properties.get("magmom", None) coord = site.coords v = site.properties.get("velocity", [0.0, 0.0, 0.0]) + if isinstance(site.specie, Species) and site.specie.spin is not None: if spin is not None and spin != site.specie.spin: raise ValueError("species.spin and magnetic moments don't agree. Please only define one") spin = site.specie.spin + if isinstance(site.specie, Species) and site.specie.oxi_state is not None: + if charge is not None and charge != site.specie.oxi_state: + raise ValueError("species.oxi_state and charge don't agree. Please only define one") + charge = site.specie.oxi_state + content_lines.append(f"atom {coord[0]: .12e} {coord[1]: .12e} {coord[2]: .12e} {element}") if charge != 0: content_lines.append(f" initial_charge {charge:.12e}") diff --git a/src/pymatgen/symmetry/groups.py b/src/pymatgen/symmetry/groups.py index e6a4c762bd8..9c0f39b111e 100644 --- a/src/pymatgen/symmetry/groups.py +++ b/src/pymatgen/symmetry/groups.py @@ -18,6 +18,7 @@ from monty.design_patterns import cached_class from monty.serialization import loadfn +from pymatgen.core.operations import SymmOp from pymatgen.util.string import Stringify if TYPE_CHECKING: