Skip to content

Your first structure

This walkthrough enumerates collinear spin-symmetry-adapted structures for MnTe and then generates their oriented descendants.

Page contract

  • Starting point: SpinForge is installed, and you can identify a primitive crystal cell and its magnetic sites.
  • Destination: You can run one bounded enumeration and inspect its oriented structures.
  • Skip: The formal derivation and physical interpretation; those belong to the associated article.

1. Prepare a primitive cell

SpinForge accepts a moyopy.Cell. The direct constructor of SSAGenerator requires the cell to be primitive.

from moyopy.interface import MoyoAdapter
from pymatgen.core import Structure

structure = Structure.from_file("MnTe.cif")
primitive_cell = MoyoAdapter.from_structure(structure)

Select the magnetic sites by their indices in that cell. Here manganese has atomic number 25:

magnetic_site_indices = [
    index
    for index, atomic_number in enumerate(primitive_cell.numbers)
    if atomic_number == 25
]

Site indices follow the cell

If you transform, standardize, or reorder the cell, recompute the site indices. They refer to the exact Cell passed to the generator.

2. Enumerate SSA structures

from spinforge.configuration import SSAGenerator
from spinspg.spin import SpinOnlyGroupType

generator = SSAGenerator(
    prim_cell=primitive_cell,
    magnetic_site_indices=magnetic_site_indices,
)

candidates = generator.enumerate(
    spin_only_group_type=SpinOnlyGroupType.COLLINEAR,
    k_index=1,
    max_depth=0,
)

k_index=1 limits the invariant translation lattice to the primitive lattice. max_depth=0 retains the parent as the only Hermann group while still allowing the bounded descendants described in the enumeration guide.

Each result contains:

  1. the trivial spin-only group;
  2. the nontrivial spin space group;
  3. a SpinSymmetryAdaptedStructure containing a supercell and a basis for allowed magnetic moments.

3. Generate oriented structures

for spin_only_group, spin_space_group, adapted in candidates:
    descendants = generator.generate_oriented(
        adapted,
        spin_only_group=spin_only_group,
        nontrivial_spin_space_group=spin_space_group,
    )

    for magnetic_structure, magnetic_space_subgroup in descendants:
        print(
            magnetic_structure.formula,
            magnetic_space_subgroup.msg_type,
        )

magnetic_structure is a pymatgen Structure whose magmom site property contains Cartesian moment vectors. By default, coplanar enantiomorphs are kept distinct. Pass preserve_spin_planochirality=False to identify structures related by improper spin-frame transformations.

Next steps