Skip to content

Commit f7b65c0

Browse files
authored
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 <mkhorton@users.noreply.github.com>
1 parent 1bfd330 commit f7b65c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pymatgen/io/cif.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
from monty.dev import deprecated
2020
from monty.io import zopen
2121
from monty.serialization import loadfn
22+
from spglib import __version__ as __spglib_version__
2223

23-
from pymatgen.core import Composition, DummySpecies, Element, Lattice, PeriodicSite, Species, Structure, get_el_sp
24+
from pymatgen.core import Composition, DummySpecies, Element, Lattice, PeriodicSite, Species, Structure, get_el_sp, __version__
2425
from pymatgen.core.operations import MagSymmOp, SymmOp
2526
from pymatgen.electronic_structure.core import Magmom
2627
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer, SpacegroupOperations
@@ -254,7 +255,7 @@ def __init__(
254255
"""
255256
self.data = data
256257
self.orig_string = orig_string
257-
self.comment: str = comment or "# generated using pymatgen"
258+
self.comment: str = comment or f"# generated using pymatgen {__version__} (spglib {__spglib_version__})"
258259

259260
def __str__(self) -> str:
260261
out = "\n".join(map(str, self.data.values()))

0 commit comments

Comments
 (0)