grogupy.physics.Builder

class grogupy.physics.Builder(ref_xcf_orientations: list[list[float]] | ndarray[Any, dtype[_ScalarType_co]] | list[dict] = [[1, 0, 0], [0, 1, 0], [0, 0, 1]])[source]

This class contains the data and the methods related to the Simulation.

Parameters

ref_xcf_orientations: Union[list[list[Union[int, float]]], NDArray[Union[np.int64, np.float64]], dict[str, Union[NDArray[Union[np.int64, np.float64]], list[float]]]], optional

The reference directions. The perpendicular directions are created by rotating the x,y,z frame to the given reference directions, by default [[1,0,0], [0,1,0], [0,0,1]]

Examples

Creating a Simulation from the DFT exchange field orientation, Hamiltonian, Kspace and Contour.

>>> kspace, contour, hamiltonian = getfixture('setup')
>>> simulation = Builder(np.array([[1,0,0], [0,1,0], [0,0,1]]))
>>> simulation.add_kspace(kspace)
>>> simulation.add_contour(contour)
>>> simulation.add_hamiltonian(hamiltonian)
>>> simulation
<grogupy.Builder npairs=0, numk=1, kset=[1 1 1], eset=100>

Methods

add_kspace(kspace) :

Adds the k-space information to the instance.

add_contour(contour) :

Adds the energy contour information to the instance.

add_hamiltonian(hamiltonian) :

Adds the Hamiltonian and geometrical information to the instance.

add_magnetic_entities(magnetic_entities) :

Adds a MagneticEntity or a list of MagneticEntity to the instance.

add_pairs(pairs) :

Adds a Pair or a list of Pair to the instance.

create_magnetic_entities(magnetic_entities) :

Creates a list of MagneticEntity from a list of dictionaries.

create_pairs(pairs) :

Creates a list of Pair from a list of dictionaries.

solve() :

Wrapper for Greens function solver.

to_magnopy(): str

The magnopy output file as a string

save_magnopy(outfile) :

Creates a magnopy input file based on a path.

save_pickle(outfile) :

It dumps the simulation parameters to a pickle file.

copy() :

Return a copy of this Pair

Attributes

infile: str

Input path to the .fdf file

scf_xcf_orientation: NDArray

The DFT exchange filed orientation from the instance Hamiltonian

ref_xcf_orientations: list[dict]

The reference directions and two perpendicular direction. Every element is a dictionary, wth two elements, ‘o’, the reference direction and ‘vw’, the two perpendicular directions and a third direction that is the linear combination of the two

kspace: Union[None, Kspace]

The k-space part of the integral

contour: Union[None, Contour]

The energy part of the integral

hamiltonian: Union[None, Hamiltonian]

The Hamiltonian of the previous article

magnetic_entities: MagneticEntityList

List of magnetic entities

pairs: PairList

List of pairs

low_memory_mode: bool, optional

The memory mode of the calculation, by default False

greens_function_solver: Literal[“sequential”, “parallel”]

The solution method for the Hamiltonian inversion, by default “parallel”

max_g_per_loop: int, optional

Maximum number of greens function samples per loop, by default 1

apply_spin_model: bool, optional

If it is True, then the exchange and anisotropy tensors are calculated, by default True

spin_model: Literal[“generalised-fit”, “generalised-grogu”, “isotropic-only”, “isotropic-biquadratic-only”]

The solution method for the exchange and anisotropy tensor, by default “generalised-fit”

parallel_mode: Literal[None, “K”], optional

The parallelization mode for the Hamiltonian inversions, by default None

architecture: Literal[“CPU”, “GPU”], optional

The architecture of the machine that grogupy is run on, by default ‘CPU’

SLURM_ID: str

The ID of the SLURM job, if available, else ‘Could not be determined.’

_dh: sisl.physics.Hamiltonian

The sisl Hamiltonian from the instance Hamiltonian

times: grogupy.batch.timing.DefaultTimer

It contains and measures runtime

__init__(ref_xcf_orientations: list[list[float]] | ndarray[Any, dtype[_ScalarType_co]] | list[dict] = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) None[source]

Initialize simulation.

Methods

__init__([ref_xcf_orientations])

Initialize simulation.

a2M(atom[, mode])

Returns the magnetic entities that contains the given atoms.

add_contour(contour)

Adds the energy contour information to the instance.

add_hamiltonian(hamiltonian)

Adds the Hamiltonian and geometrical information to the instance.

add_kspace(kspace)

Adds the k-space information to the instance.

add_magnetic_entities(magnetic_entities)

Adds a MagneticEntity or a list of MagneticEntity to the instance.

add_pairs(pairs)

Adds a Pair or a list of Pair to the instance.

copy()

Returns the deepcopy of the instance.

create_magnetic_entities(magnetic_entities)

Creates a list of MagneticEntity from a list of dictionaries.

create_pairs(pairs)

Creates a list of Pair from a list of dictionaries.

plot_DMI([heatplot, rescale, tags, colors, ...])

Creates a plot of the DM vectors from a list of pairs.

plot_DM_distance([group, normalise, tags, ...])

Plots the magnitude of DM vectors as a function of distance.

plot_Jiso_distance([group, tags, colors, ...])

Plots the isotropic exchange as a function of distance.

plot_magnetic_entities([tags, colors, ...])

Creates a plot from a list of magnetic entities.

plot_onsite_anisotropy([colorscale, ...])

Creates a plot of the on-site anisotropy from a list of magnetic entities.

plot_pairs([group, connect, tags, colors, ...])

Creates a plot from a list of pairs.

setup_from_range(R[, subset])

Generates all the pairs and magnetic entities from atoms in a given radius.

solve([print_memory])

Wrapper for Greens function solver.

Attributes

NO

The number of orbitals in the Hamiltonian.

apply_spin_model

If it is True, then the exchange and anisotropy tensors are calculated.

architecture

The architecture of the machine that grogupy is run on, by default 'CPU'.

cell

Unit cell vectors.

geometry

sisl geometry object.

greens_function_solver

The solution method for the Hamiltonian inversion, by default "parallel".

infile

Input file used to build the Hamiltonian.

low_memory_mode

The memory mode of the calculation.

max_g_per_loop

Maximum number of greens function samples per loop.

parallel_mode

The parallelization mode for the Hamiltonian inversions, by default None.

ref_xcf_orientations

The reference directions and perpendicular rotations.

root_node

scf_xcf_orientation

Exchange field orientation in the DFT calculation.

spin_model

The solver used for the exchange and anisotropy tensor calculation.

version

Version of grogupy.

times

Contains a DefaultTimer instance to measure runtime

kspace

Contains a Kspace instance

contour

Contains a Contour instance

hamiltonian

Contains a Hamiltonian instance

magnetic_entities

The list of magnetic entities

pairs

The list of pairs