magnopy.io.load_grogu#

magnopy.io.load_grogu(filename, spin_values=None, spglib_types=None, g_factors=None, missing_bonds='restore', when_present='raise error') SpinHamiltonian[source]#

Reads spin Hamiltonian from the .txt file produced by GROGU.

For more information on GROGU's file format see GROGU file format.

Parameters:
filenamestr

Path to the .txt file produced by GROGU.

spin_values(M, ) iterable of floats, optional

Spin values for all magnetic atom. Order is the same as in GROGU file. Magnetic atoms are defined as those that have at least one parameter associated with them. If none given, Magnopy uses spin values computed from DFT (as provided in the GROGU file).

spglib_types(M_prime, ) iterable of ints, optional

Spglib types for all atoms (not only for magnetic ones, but for all). Order is the same as in GROGU file. If none given, then there will be no "spglib_types" key in spinham.atoms.

g_factors(M, ) iterable of floats, optional

Added in version 0.5.2.

g-factors for all atoms. Order is the same as in TB2J file. If none given, then Magnopy sets \(g = 2\) for all atoms.

missing_bondsbool, default "restore"

Added in version 0.5.2.

What to do if some of the equivalent bonds are missing (see Equivalent parameters and Multiple counting for more details on equivalent bonds). Case-insensitive. Supported options are

  • "restore" (default) Magnopy adds missing equivalent bonds, by inserting additional parameters.

  • "ignore"

    Magnopy does nothing.

when_presentstr, default "raise error"

Added in version 0.5.2.

What to do if the exact same interaction is repeated twice in the file. See SpinHamiltonian.add() for supported values.

Returns:
spinhamSpinHamiltonian

Spin Hamiltonian, that is built from the GROGU file.

Raises:
ValueError

If spin_values is provided and its length does not match the number of magnetic atoms in the Hamiltonian.

ValueError

If spglib_types is provided and its length does not match the number of atoms in the Hamiltonian.