mag4.spinconfig
Generate, group and merge the four spin configurations of the four-state method.
Functions
|
Build the reference magnetic bath. |
|
Build a reference bath that respects the requested coupling signs. |
|
Build a collinear reference bath |
|
±1 reference bath from a MAGMOM-style string of the WORKING SUPERCELL. |
|
Group configurations equivalent under the magnetic (grey) group. |
|
Generate the four spin configurations |
|
Parse |
Expand a VASP MAGMOM-style string into a flat list of floats. |
|
|
Parse |
|
Pairs of unitary-only classes that time reversal proves degenerate. |
- mag4.spinconfig.build_reference_bath(n_atoms, user_ref=None)[source]
Build the reference magnetic bath.
Default behaviour is fully ferromagnetic (all +1). Pass
user_refas a list of ±1 of lengthn_atomsto override.- Raises:
ValueError – If the length is wrong or values other than ±1 are present.
- Return type:
- Parameters:
- mag4.spinconfig.parse_magmom_tokens(s)[source]
Expand a VASP MAGMOM-style string into a flat list of floats.
Accepts plain values and
n*vrepetitions, whitespace- or comma-separated:"32*0 1 -1 2*1.5"→[0.0]*32 + [1.0, -1.0, 1.5, 1.5].
- mag4.spinconfig.build_reference_from_magmom(magmom, crystal)[source]
±1 reference bath from a MAGMOM-style string of the WORKING SUPERCELL.
The string is written exactly as one would set VASP’s
MAGMOMfor the supercell — POSCAR atom order (crystal.all_speciesspecies blocks),n*vrepetitions allowed — e.g. for a 2×2×1 La₂CuO₄ √2 cell:32*0 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 64*0
Only the SIGNS of the magnetic entries are used (any magnitude, e.g. ±1 or ±0.6); non-magnetic entries must be 0 and are validated against the species layout so an atom-order mismatch fails loudly. As a shorthand the string may instead carry just the
N_magmagnetic values (in the magnetic-sublattice order). Returns the ±1 bath incrystal.target_speciesorder.
- mag4.spinconfig.parse_ref_couplings(spec, coupling_names)[source]
Parse
"J1:AFM,J2:FM"→{"J1": -1, "J2": +1}.Raises
ValueErroron unknown coupling names or unrecognised signs.
- mag4.spinconfig.build_reference_from_couplings(atoms, lat_mat, couplings, spec, tol)[source]
Build a reference bath that respects the requested coupling signs.
- Parameters:
atoms (magnetic atoms in legacy
[label, x, y, z, …]format.)lat_mat (3×3 lattice matrix (columns are lattice vectors).)
couplings (
[[name, distance], …].)spec (e.g.
"J1:AFM,J2:FM".)tol (distance tolerance for the bond search.)
``(ref_bath (Returns) –
used (report)``. report carries the method)
any
conflict (frustration)
``(satisfied (and per-coupling) –
counts. (total)`` bond)
- Return type:
- mag4.spinconfig.build_reference_from_kvector(atoms, kfrac, supercell, node_tol=1e-06)[source]
Build a collinear reference bath
s_i = sign(cos(2π k·R_i)).- Parameters:
atoms (magnetic atoms in legacy
[label, x, y, z, …]format, with) – fractional coordinates in the working (super)cell.kfrac (propagation vector (3
Fraction) in parent reciprocal-lattice units.)supercell (
(na, nb, nc)multipliers used to build the working cell.)``(ref_bath (Returns) –
report)``.
node_tol (float)
- Return type:
- mag4.spinconfig.generate_four_states(ref_bath, dimer, coupling_name)[source]
Generate the four spin configurations
uu, dd, ud, dufor one dimer.Only the two atoms of the dimer differ between configurations; the rest of the magnetic bath is frozen to
ref_bath.- Return type:
- Parameters:
- mag4.spinconfig.find_unique_configs(all_configs, sym_ops, *, time_reversal=True)[source]
Group configurations equivalent under the magnetic (grey) group.
The group is the unitary crystal operations
sym_opsplus, whentime_reversalis True (the default), each of them composed with time reversal T (global spin flip) — exact in a collinear calculation without spin-orbit coupling. Returns a list of groups; the energy of any member of a group can be used interchangeably in the J extraction formulas.time_reversal=Falserestricts to the unitary subgroup — used by--check-degeneracyto keep the T-redundant configurations as separate DFT runs whose energy agreement then tests the antiunitary symmetry (and the completeness of the spin model).- Return type:
- Parameters:
- mag4.spinconfig.time_reversal_pairs(unitary_groups, sym_ops)[source]
Pairs of unitary-only classes that time reversal proves degenerate.
unitary_groupsmust come fromfind_unique_configs()withtime_reversal=False. Two classes pair up when an ANTIUNITARY operation P×T (unitary op composed with global spin flip) maps one representative onto the other — their DFT energies must then coincide even though no unitary operation relates them (they typically differ in total Sz). Returns 1-based(uid_a, uid_b)index pairs; since the unitary subgroup has index 2 in the grey group, each class belongs to at most one pair.