From f7b65c059ec2c30d804d59a1928c32f77ebe7e9d Mon Sep 17 00:00:00 2001 From: Matthew Horton Date: Sat, 10 Aug 2024 15:12:22 -0700 Subject: [PATCH 1/2] Add additional metadata to default CIF comment string Should a bug be found in either pymatgen's CIFWriter or spglib, a key package depended upon by pymatgen, this updated comment string will make it easier to find affected CIF files. Signed-off-by: Matthew Horton --- src/pymatgen/io/cif.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pymatgen/io/cif.py b/src/pymatgen/io/cif.py index 6b0a2453a71..ca0bc4a69f2 100644 --- a/src/pymatgen/io/cif.py +++ b/src/pymatgen/io/cif.py @@ -19,8 +19,9 @@ from monty.dev import deprecated from monty.io import zopen from monty.serialization import loadfn +from spglib import __version__ as __spglib_version__ -from pymatgen.core import Composition, DummySpecies, Element, Lattice, PeriodicSite, Species, Structure, get_el_sp +from pymatgen.core import Composition, DummySpecies, Element, Lattice, PeriodicSite, Species, Structure, get_el_sp, __version__ from pymatgen.core.operations import MagSymmOp, SymmOp from pymatgen.electronic_structure.core import Magmom from pymatgen.symmetry.analyzer import SpacegroupAnalyzer, SpacegroupOperations @@ -254,7 +255,7 @@ def __init__( """ self.data = data self.orig_string = orig_string - self.comment: str = comment or "# generated using pymatgen" + self.comment: str = comment or f"# generated using pymatgen {__version__} (spglib {__spglib_version__})" def __str__(self) -> str: out = "\n".join(map(str, self.data.values())) From 5048d4860e1c719b83da6e1df43631a1ad710f94 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:59:10 +0000 Subject: [PATCH 2/2] pre-commit auto-fixes --- src/pymatgen/io/cif.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pymatgen/io/cif.py b/src/pymatgen/io/cif.py index ca0bc4a69f2..1929862b566 100644 --- a/src/pymatgen/io/cif.py +++ b/src/pymatgen/io/cif.py @@ -21,7 +21,17 @@ from monty.serialization import loadfn from spglib import __version__ as __spglib_version__ -from pymatgen.core import Composition, DummySpecies, Element, Lattice, PeriodicSite, Species, Structure, get_el_sp, __version__ +from pymatgen.core import ( + Composition, + DummySpecies, + Element, + Lattice, + PeriodicSite, + Species, + Structure, + __version__, + get_el_sp, +) from pymatgen.core.operations import MagSymmOp, SymmOp from pymatgen.electronic_structure.core import Magmom from pymatgen.symmetry.analyzer import SpacegroupAnalyzer, SpacegroupOperations