MCIF¶
Write a pymatgen magnetic structure as a symmetrized magnetic CIF in the BNS/MAGNDATA convention.
mcif
¶
Write magnetic structures as mcif files (BNS/MAGNDATA convention).
Reading needs no local code: pymatgen.core.Structure.from_file handles
mcif, and its symmetry expansion of _atom_site_moment.crystalaxis_*
components is correct as of pymatgen-core v2026.7.16
(materialsproject/pymatgen-core#76): moments are converted to Cartesian before
applying an operation, so |m| is preserved even when an operation mixes
unequal or non-orthogonal axes (e.g. hexagonal settings; see
materialsproject/pymatgen-core#76 for the old failure mode).
:class:MCifWriter has no upstream equivalent (CifWriter(write_magmoms=True)
dumps every atom in P1 with no magnetic operations).
MCifWriter
¶
A pymatgen-style writer for symmetrized magnetic CIF (BNS/MAGNDATA).
Mirrors :class:pymatgen.io.cif.CifWriter: str(writer) returns the mcif
text and writer.write_file(path) writes it. Unlike
CifWriter(write_magmoms=True) -- which dumps every atom in P1 with no
magnetic operations -- this finds the magnetic space group of struct with
moyopy and writes the asymmetric unit plus the
_space_group_symop_magn_operation.xyz /
_space_group_symop_magn_centering.xyz loops, so the file round-trips
through pymatgen.core.Structure.from_file.
The structure is symmetrized in its own input setting (the basis is not
standardized). struct must carry a magmom site property (pymatgen
Magmom or a Cartesian 3-vector per site). Moment components are written as
_atom_site_moment.crystalaxis_* in the unit-axis convention read back by
CifParser (m = mx*a_hat + my*b_hat + mz*c_hat).
Partial occupancy is preserved: each site's fractional occupancy enters the
moyopy equivalence label (so a 0.79-occupied site is never folded into a fully
occupied orbit) and is written as an _atom_site_occupancy column. Only
single-species sites are supported; a mixed solid-solution site (two species
sharing one position) raises NotImplementedError, since moyopy cannot
symmetrize it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
struct
|
Structure
|
Magnetic structure with a |
required |
symprec
|
float
|
moyopy symmetry-search tolerances (basis units / moment units). |
0.0001
|
mag_symprec
|
float
|
moyopy symmetry-search tolerances (basis units / moment units). |
0.0001
|