pymatgen.analysis.magnetism.analyzer module

class CollinearMagneticStructureAnalyzer(structure, overwrite_magmom_mode='none', round_magmoms=False, detect_valences=False, make_primitive=True, default_magmoms=None, threshold=0.1)[source]

Bases: object

A class which provides a few helpful methods to analyze collinear magnetic structures.

If magnetic moments are not defined, moments will be taken either from default_magmoms.yaml (similar to the default magmoms in MPRelaxSet, with a few extra definitions) or from a specie:magmom dict provided by the default_magmoms kwarg.

Input magmoms can be replaced using the ‘overwrite_magmom_mode’ kwarg. This can be “none” to do nothing, “respect_sign” which will overwrite existing magmoms with those from default_magmoms but will keep positive magmoms positive, negative magmoms negative and zero magmoms zero, “respect_zeros”, which will give a ferromagnetic structure (all positive magmoms from default_magmoms) but still keep zero magmoms as zero, or “replace_all” which will try to guess initial magmoms for all species in the structure irrespective of input structure. This is most suitable for an initial DFT calculation.

Parameters:
  • structure – Structure object
  • (str) (overwrite_magmom_mode) – default “none”
  • (int) (round_magmoms) – will round input magmoms to

specified number of decimal places, suggest value of 1 or False for typical DFT calculations depending on application :param detect_valences (bool): if True, will attempt to assign valences to input structure :param make_primitive (bool): if True, will transform to primitive magnetic cell :param default_magmoms (dict): (optional) dict specifying default magmoms :param threshold (float): number (in Bohr magnetons) below which magmoms will be rounded to zero, default of 0.1 can probably be increased for many magnetic systems, depending on your application

get_exchange_group_info(symprec=0.01, angle_tolerance=5.0)[source]

Returns the information on the symmetry of the Hamiltonian describing the exchange energy of the system, taking into account relative direction of magnetic moments but not their absolute direction.

This is not strictly accurate (e.g. some/many atoms will have zero magnetic moments), but defining symmetry this way is a useful way of keeping track of distinct magnetic orderings within pymatgen.

Parameters:
  • symprec – same as SpacegroupAnalyzer
  • angle_tolerance – same as SpacegroupAnalyzer
Returns:

spacegroup_symbol, international_number

get_ferromagnetic_structure(make_primitive=True)[source]

Returns a Structure with all magnetic moments positive or zero. :param make_primitive (bool): Return a primitive structure, defaults to True. :return: Structure

get_nonmagnetic_structure(make_primitive=True)[source]

Returns a Structure without magnetic moments defined. :param make_primitive (bool): Return a primitive structure, defaults to True. :return: Structure

get_structure_with_only_magnetic_atoms(make_primitive=True)[source]

Returns a Structure with only magnetic atoms present. :return: Structure

get_structure_with_spin()[source]

Returns a Structure with species decorated with spin values instead of using magmom site properties. :return: Structure

magmoms

Convenience property, returns magmoms as a numpy array. :return: np.array

magnetic_species_and_magmoms

Returns a dict of magnetic species and the magnitude of their associated magmoms. Implicitly assumes the magnetic moment is the same magnitude for a given species. :return: dict of magnetic species and magmoms

matches_ordering(other)[source]

Compares the magnetic orderings of one structure with another. :param other: Structure :return (bool):

number_of_magnetic_sites

return (int) – Number of magnetic sites present in structure.

number_of_unique_magnetic_sites(symprec=0.001, angle_tolerance=5)[source]
Parameters:
  • (float) (angle_tolerance) – same as in SpacegroupAnalyzer
  • (float) – same as in SpacegroupAnalyzer
Return (int):

Number of symmetrically-distinct magnetic sites present

in structure.

ordering

Applies heuristics to return a magnetic ordering for a collinear magnetic structure. Result is not guaranteed for correctness. :return: Ordering Enum (‘FiM’ is used as the abbreviation for ferrimagnetic)

propagation_vector
types_of_magnetic_specie

Equivalent to Structure.types_of_specie but only returns magnetic species. :return: types of Specie

class Ordering[source]

Bases: enum.Enum

An enumeration.

AFM = 'AFM'
FM = 'FM'
FiM = 'FiM'
NM = 'NM'
Unknown = 'Unknown'