pymatgen.analysis.magnetism.heisenberg module

This module implements a simple algorithm for extracting nearest neighbor exchange parameters by mapping low energy magnetic orderings to a Heisenberg model.

class HeisenbergMapper(ordered_structures, energies, cutoff=0.0, tol=0.02)[source]

Bases: object

Class to compute exchange parameters from low energy magnetic orderings.

Exchange parameters are computed by mapping to a classical Heisenberg model. Strategy is the scheme for generating neighbors. Currently only MinimumDistanceNN is implemented. n+1 unique orderings are required to compute n exchange parameters.

First run a MagneticOrderingsWF to obtain low energy collinear magnetic orderings and find the magnetic ground state. Then enumerate magnetic states with the ground state as the input structure, find the subset of supercells that map to the ground state, and do static calculations for these orderings.

  • ordered_structures (list) – Structure objects with magmoms.

  • energies (list) – Energies of each relaxed magnetic structure.

  • cutoff (float) – Cutoff in Angstrom for nearest neighbor search. Defaults to 0 (only NN, no NNN, etc.)

  • tol (float) – Tolerance (in Angstrom) on nearest neighbor distances being equal.

  • strategy (object) – Class from pymatgen.analysis.local_env for constructing graphs.

  • sgraphs (list) – StructureGraph objects.

  • unique_site_ids (dict) – Maps each site to its unique numerical identifier.

  • wyckoff_ids (dict) – Maps unique numerical identifier to wyckoff position.

  • nn_interacations (dict) – {i: j} pairs of NN interactions between unique sites.

  • dists (dict) – NN, NNN, and NNNN interaction distances

  • ex_mat (DataFrame) – Invertible Heisenberg Hamiltonian for each graph.

  • ex_params (dict) – Exchange parameter values (meV/atom)

estimate_exchange(fm_struct=None, afm_struct=None, fm_e=None, afm_e=None)[source]

Estimate <J> for a structure based on low energy FM and AFM orderings.

  • fm_struct (Structure) – fm structure with ‘magmom’ site property

  • afm_struct (Structure) – afm structure with ‘magmom’ site property

  • fm_e (float) – fm energy

  • afm_e (float) – afm energy


Average exchange parameter (meV/atom)

Return type

j_avg (float)


Take Heisenberg Hamiltonian and corresponding energy for each row and solve for the exchange parameters.


Exchange parameter values (meV/atom).

Return type

ex_params (dict)


Get a StructureGraph with edges and weights that correspond to exchange interactions and J_ij values, respectively.


filename (str) – if not None, save interaction graph to filename.


Exchange interaction graph.

Return type

igraph (StructureGraph)


Find lowest energy FM and AFM orderings to compute E_AFM - E_FM.


fm structure with ‘magmom’ site property afm_struct (Structure): afm structure with ‘magmom’ site property fm_e (float): fm energy afm_e (float): afm energy

Return type

fm_struct (Structure)


Crude mean field estimate of critical temperature based on <J> for one sublattice, or solving the coupled equations for a multisublattice material.


j_avg (float) – j_avg (float): Average exchange parameter (meV/atom)


Critical temperature (K)

Return type

mft_t (float)

class HeisenbergScreener(structures, energies)[source]

Bases: object

Class to clean and screen magnetic orderings.

This class pre-processes magnetic orderings and energies for HeisenbergMapper. It prioritizes low-energy orderings with large and localized magnetic moments.

  • structures (list) – Structure objects with magnetic moments.

  • energies (list) – energies of magnetic orderings.


Sorted structures.




Sorted energies.