Skip to content

Commit ec003c9

Browse files
committed
selective import for copy.deepcopy
in keeping with style of ase.py
1 parent d4375b0 commit ec003c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pymatgen/io/ase.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
import copy
8+
from copy import deepcopy
99
import warnings
1010
from importlib.metadata import PackageNotFoundError
1111
from typing import TYPE_CHECKING
@@ -205,7 +205,7 @@ def get_atoms(structure: SiteCollection, msonable: bool = True, **kwargs) -> MSO
205205

206206
# Atoms.info <---> Structure.properties
207207
if properties := structure.properties:
208-
atoms.info = copy.deepcopy(properties)
208+
atoms.info = deepcopy(properties)
209209

210210
# Regenerate Spacegroup object from `.todict()` representation
211211
if isinstance(atoms.info.get("spacegroup"), dict):
@@ -299,7 +299,7 @@ def get_structure(atoms: Atoms, cls: type[Structure] = Structure, **cls_kwargs)
299299
sel_dyn = None
300300

301301
# Atoms.info <---> Structure.properties
302-
properties = copy.deepcopy(getattr(atoms, "info", {}))
302+
properties = deepcopy(getattr(atoms, "info", {}))
303303
# If present, convert Spacegroup object to JSON-serializable dict
304304
if properties.get("spacegroup") and isinstance(properties["spacegroup"], Spacegroup):
305305
properties["spacegroup"] = properties["spacegroup"].todict()

0 commit comments

Comments
 (0)