Skip to content

Commit

Permalink
fix return types
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Mar 11, 2025
1 parent 0b4d315 commit 7ffec98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/pymatgen/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3296,14 +3296,14 @@ def from_file(
struct.__class__ = cls
return struct

def from_ase_atoms(self, **kwargs) -> Self:
def from_ase_atoms(self, **kwargs) -> Structure:
"""Convert ase.Atoms to pymatgen Structure.
Args:
kwargs: Passed to AseAtomsAdaptor.get_structure.
Returns:
IStructure
Structure
"""
from pymatgen.io.ase import AseAtomsAdaptor

Expand Down Expand Up @@ -4133,14 +4133,14 @@ def from_file(cls, filename: PathLike) -> Self | None:
return new
raise ValueError("Cannot determine file type.")

def from_ase_atoms(self, **kwargs) -> Self:
def from_ase_atoms(self, **kwargs) -> Molecule:
"""Convert ase.Atoms to pymatgen Molecule.
Args:
kwargs: Passed to AseAtomsAdaptor.get_molecule.
Returns:
IMolecule
Molecule
"""
from pymatgen.io.ase import AseAtomsAdaptor

Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,7 @@ def test_to_conventional(self):
assert struct.formula == "Dy8 Sb6"
assert conventional.formula == "Dy16 Sb12"

def test_to_ase_atoms(self):
def test_to_from_ase_atoms(self):
pytest.importorskip("ase")
atoms = self.struct.to_ase_atoms()
assert isinstance(atoms, Atoms)
Expand Down

0 comments on commit 7ffec98

Please sign in to comment.