slothpy.core package#
Submodules#
slothpy.core.compound_object module#
- class slothpy.core.compound_object.Compound(*args, **kwargs)[source]#
Bases:
object
The core object constituting the API and access to all the methods.
- delete_group_dataset(first: str, second: str = None) None [source]#
Deletes a group/dataset provided its full name/path from the .slt file.
- Parameters:
first (str) – A name of the gorup or dataset to be deleted.
second (str, optional) – A name of the particular dataset inside the group from the first argument to be deleted.
- Raises:
SltFileError – If the deletion is unsuccessful.
- calculate_g_tensor_and_axes_doublet(group: str, doublets: ndarray[int64], slt: str = None) Tuple[ndarray[float64], ndarray[float64]] [source]#
Calculates pseudo-g-tensor components (for S = 1/2) and main magnetic axes for a given list of doublet states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of g-tensors.
doublets (ndarray[int64]) – ArrayLike structure (can be converted to numpy.NDArray) of integers corresponding to doublet labels (numbers).
slt (str, optional) – If given, the results will be saved using this name to the .slt file with the suffix: _g_tensors_axes, by default None.
- Returns:
The first array (g_tensor_list) contains a list g-tensors in a format [doublet_number, gx, gy, gz], the second one (magnetic_axes_list) contains respective rotation matrices.
- Return type:
Tuple[ndarray[float64], ndarray[float64]]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If doublets are not one-diemsional array.
SltCompError – If the calculation of g-tensors is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Magnetic axes are returned in the form of rotation matrices that diagonalise the Abragam-Bleaney tensor (G = gg.T). Coordinates of the main axes XYZ in the initial xzy frame are columns of such matrices (0-X, 1-Y, 2-Z).
- calculate_mth(group: str, fields: ndarray[float64], grid: int | ndarray[float64], temperatures: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates powder-averaged or directional molar magnetisation M(T,H) for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetisation.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which magnetisation will be computed.
grid (Union[int, ndarray[float64]]) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over hemisphere will be used (see grids_over_hemisphere documentation), otherwise, user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] for powder-averaging. If one wants a calculation for a single, particular direction the list has to contain one entry like this: [[direction_x, direction_y, direction_z, 1.]]. Custom grids will be automatically normalized.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which magnetisation will be computed.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _magnetisation., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting mth_array gives magnetisation in Bohr magnetons and is in the form [temperatures, fields] - the first dimension runs over temperature values, and the second over fields.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If temperatures are not a one-diemsional array.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of magnetisation is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
See also
slothpy.lebedev_laikov_grid
For the description of the prescribed
Lebedev-Laikov
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over the provided field values.
- calculate_mag_3d(group: str, fields: ndarray[float64], spherical_grid: int, temperatures: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates 3D magnetisation over a spherical grid for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the 3D magnetisation.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which 3D magnetisation will be computed.
spherical_grid (int) – Controls the density of the angular grid for the 3D magnetisation calculation. A grid of dimension (spherical_grid*2*spherical_grid) for spherical angles theta [0, pi], and phi [0, 2*pi] will be used.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temperature values (K) at which 3D magnetisation will be computed.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _3d_magnetisation., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting mag_3d_array gives magnetisation in Bohr magnetons and is in the form [coordinates, fields, temperatures, mesh, mesh] - the first dimension runs over coordinates (0-x, 1-y, 2-z), the second over field values, and the third over temperatures. The last two dimensions are in a form of meshgrids over theta and phi, ready for 3D plots as xyz.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If spherical_grid is not a positive integer.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of 3D magnetisation is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over len(fields)*2*shperical_grid**2 tasks. Be aware that the resulting arrays and computations can quickly consume much memory (e.g. for a calculation with 100 field values 1-10 T, 300 temperatures 1-300 K, and spherical_grid = 60, the resulting array will take 3*100*300*2*60*60*8 bytes = 5.184 GB).
- calculate_chitht(group: str, temperatures: ndarray[float64], fields: ndarray[float64], number_of_points: int, delta_h: float = 0.0001, states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, exp: bool = False, T: bool = True, grid: int | ndarray[float64] = None, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates powder-averaged or directional molar magnetic susceptibility chi(T)(H,T) for a given list of field and temperatures values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetisation.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which magnetic susceptibility will be computed.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which magnetic susceptibility will be computed.
number_of_points (int) – Controls the number of points for numerical differentiation over the magnetic field values using the finite difference method with a symmetrical stencil. The total number of used points = (2 * num_of_opints + 1), therefore 1 is a minimum value to obtain the first derivative using 3 points - including the value at the point at which the derivative is taken. In this regard, the value 0 triggers the experimentalist model for susceptibility.
delta_h (float64, optional) – Value of field step used for numerical differentiation using finite difference method. 0.0001 (T) = 1 Oe is recommended as a starting point., by default 0.0001
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
exp (bool, optional) – Turns on the experimentalist model for magnetic susceptibility., by default False
T (bool, optional) – Results are returned as a product with temperature chiT(H,T)., by default True
grid (Union[int, np.ndarray[float64]], optional) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over the hemisphere will be used (see grids_over_hemisphere documentation), otherwise, the user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] for powder-averaging. If one wants a calculation for a single, particular direction the list has to contain one entry like this: [[direction_x, direction_y, direction_z, 1.]]. If not given the average is taken over xyz directions, which is sufficient for a second rank tensor. Custom grids will be automatically normalized., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _susceptibility., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with a higher number of field values and number_of_points) where it becomes a necessity., by default False
- Returns:
The resulting chitht_array gives magnetic susceptibility (or product with temperature) in cm^3 (or * K) and is in the form [fields, temperatures] - the first dimension runs over field values, and the second over temperatures.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If the number of points for finite difference method is not a possitive integer.
SltInputError – If the field step for the finite difference method is not a possitive real number.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of magnetic susceptibility is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over fields.size*(2*number_of_points+1) tasks.
- calculate_chit_tensorht(group: str, temperatures: ndarray[float64], fields: ndarray[float64], number_of_points: int, delta_h: float = 0.0001, states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, exp: bool = False, T: bool = True, rotation: ndarray[float64] = None, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates magnetic susceptibility chi(H,T) (Van Vleck) tensor for a given list of field and temperature values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetisation.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which magnetic susceptibility tensor will be computed.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which magnetic susceptibility tensor will be computed.
number_of_points (int) – Controls the number of points for numerical differentiation over the magnetic field values using the finite difference method with a symmetrical stencil. The total number of used points = (2 * num_of_opints + 1), therefore 1 is a minimum value to obtain the first derivative using 3 points - including the value at the point at which the derivative is taken. In this regard, the value 0 triggers the experimentalist model for susceptibility.
delta_h (float64, optional) – Value of field step used for numerical differentiation using finite difference method. 0.0001 (T) = 1 Oe is recommended as a starting point., by default 0.0001,
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
exp (bool, optional) – Turns on the experimentalist model for magnetic susceptibility., by default False
T (bool, optional) – Results are returned as a product with temperature chiT(H,T)., by default True
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _susceptibility_tensor., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 500 with a higher number of field values and number_of_points) where it becomes a necessity., by default False
- Returns:
The resulting array gives magnetic susceptibility (Van Vleck) tensors (or products with temperature) in cm^3 (or * K) and is in the form [fields, temperatures, 3x3 tensor] - the first dimension runs over field values, the second over temperatures, and the last two accomodate 3x3 tensors.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If the number of points for finite difference method is not a possitive integer
SltInputError – If the field step for the finite difference method is not a possitive real number.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of magnetic susceptibility tensor is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over fields.size*(2*number_of_points+1) tasks.
- calculate_chit_3d(group: str, temperatures: ndarray[float64], fields: ndarray[float64], spherical_grid: int, number_of_points: int, delta_h: float = 0.0001, states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, exp: bool = False, T: bool = True, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates 3D magnetic susceptibility over a spherical grid for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the 3D magnetic susceptibility.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temperature values (K) at which 3D magnetic susceptibility will be computed.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which 3D magnetic susceptibility will be computed.
spherical_grid (int) – Controls the density of the angular grid for the 3D susceptibility calculation. A grid of dimension (spherical_grid*2*spherical_grid) for spherical angles theta [0, pi], and phi [0, 2*pi] will be used.
number_of_points (int) – Controls the number of points for numerical differentiation over the magnetic field values using the finite difference method with a symmetrical stencil. The total number of used points = (2 * num_of_opints + 1), therefore 1 is a minimum value to obtain the first derivative using 3 points - including the value at the point at which the derivative is taken. In this regard, the value 0 triggers the experimentalist model for susceptibility.
delta_h (float64, optional) – Value of field step used for numerical differentiation using finite difference method. 0.0001 (T) = 1 Oe is recommended as a starting point., by default 0.0001
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
exp (bool, optional) – Turns on the experimentalist model for magnetic susceptibility., by default False
T (bool, optional) – Results are returned as a product with temperature chiT(H,T)., by default True
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _3d_magnetisation., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting chi_3d_array gives magnetic susceptibility (or product with temperature) in cm^3 (or * K) and is in the form [coordinates, fields, temperatures, mesh, mesh] - the first dimension runs over coordinates (0-x, 1-y, 2-z), the second over field values, and the third over temperatures. The last two dimensions are in a form of meshgrids over theta and phi, ready for 3D plots as xyz.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If spherical_grid is not a positive integer.
SltInputError – If the number of points for finite difference method is not a possitive integer.
SltInputError – If the field step for the finite difference method is not a possitive real number.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of 3D magnetic susceptibility is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over len(fields)*(2*number_of_points + 1) *2*shperical_grid**2 tasks. Be aware that the resulting arrays and computations can quickly consume much memory (e.g. for calculation with 100 field values 1-10 T, 300 temperatures 1-300 K, number_of_points=3, and spherical_grid = 60, the intermediate array (before numerical differentiation) will take 7*100*300*2*60*60*8 bytes = 12.096 GB).
- calculate_hemholtz_energyth(group: str, fields: ndarray[float64], grid: ndarray[float64], temperatures: ndarray[float64], states_cutoff: int, number_cpu: int, number_threads: int, internal_energy: bool = False, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates powder-averaged or directional Hemholtz (or internal) energy for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the energy.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which energy will be computed.
grid (ndarray[float64]) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over hemisphere will be used (see grids_over_hemisphere documentation), otherwise, user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] for powder-averaging. If one wants a calculation for a single, particular direction the list has to contain one entry like this: [[direction_x, direction_y, direction_z, 1.]]. Custom grids will be automatically normalized.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which energy will be computed
states_cutoff (int) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
internal_energy (bool, optional) – Turns on the calculation of internal energy., by default False
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _hemholtz_energy or _internal_energy., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting eth_array gives energy in cm-1 and is in the form [temperatures, fields] - the first dimension runs over temperature values, and the second over fields.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array
SltInputError – If temperatures are not a one-diemsional array
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of energy is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
See also
slothpy.lebedev_laikov_grid
For the description of the prescribed
Lebedev-Laikov
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over the provided field values.
- calculate_hemholtz_energy_3d(group: str, fields: ndarray[float64], spherical_grid: int, temperatures: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, internal_energy: bool = False, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates 3D Hemholtz (or internal) energy over a spherical grid for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the 3D energy.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which 3D energy will be computed.
spherical_grid (int) – Controls the density of the angular grid for the 3D magnetisation calculation. A grid of dimension (spherical_grid*2*spherical_grid) for spherical angles theta [0, pi], and phi [0, 2*pi] will be used.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temperature values (K) at which 3D energy will be computed.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0,
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
internal_energy (bool, optional) – Turns on the calculation of internal energy., by default False
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _3d_hemholtz_energy or _3d_internal_energy., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting energy_3d_array gives energy in cm-1 and is in the form [coordinates, fields, temperatures, mesh, mesh] - the first dimension runs over coordinates (0-x, 1-y, 2-z), the second over field values, and the third over temperatures. The last two dimensions are in a form of meshgrids over theta and phi, ready for 3D plots as xyz.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If spherical_grid is not a positive integer.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of 3D energy is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over len(fields)*2*shperical_grid**2 tasks. Be aware that the resulting arrays and computations can quickly consume much memory (e.g. for a calculation with 100 field values 1-10 T, 300 temperatures 1-300 K, and spherical_grid = 60, the resulting array will take 3*100*300*2*60*60*8 bytes = 5.184 GB).
- calculate_zeeman_splitting(group: str, number_of_states: int, fields: ndarray[float64], grid: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, average: bool = False, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates directional or powder-averaged Zeeman splitting for a given number of states and list of field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the Zeeman splitting.
number_of_states (int) – Number of states whose energy splitting will be given in the result array.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which Zeeman splitting will be computed.
grid (ndarray[float64]) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over hemisphere will be used (see grids_over_hemisphere documentation) and powder-averaging will be turned on, otherwise, user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] with average = True for powder-averaging. If one wants a calculation for a list of particular directions the list has to follow the format: [[direction_x, direction_y, direction_z],…]. Custom grids will be automatically normalized.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
average (bool, optional) – Turns on powder-averaging using a list of directions and weights in the form of ArrayLike structure: [[direction_x, direction_y, direction_z, weight],…].
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _zeeman_splitting., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default Falsee
- Returns:
The resulting array gives Zeeman splitting of number_of_states energy levels in cm-1 for each direction (or average) in the form [orientations, fields, energies] - the first dimension runs over different orientations, the second over field values, and the last gives energy of number_of_states states.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If number of states is not a positive integer less or equal to the states cutoff.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of Zeeman splitting is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
See also
slothpy.lebedev_laikov_grid
For the description of the prescribed
Lebedev-Laikov
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over the provided field values.
- zeeman_matrix(group: str, states_cutoff: int, fields: ndarray[float64], orientations: ndarray[float64], slt: str = None) ndarray[complex128] [source]#
Calculates Zeeman matrices for a given list of magnetic fields and their orientations.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the Zeeman matrices.
states_cutoff (int) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) for which Zeeman matrices will be computed.
orientations (ndarray[float64]) – List (ArrayLike structure) of particular magnetic field directions for which Zeeman matrices will be constructed. The list has to follow the format: [[direction_x, direction_y, direction_z],…]. The vectors will be automatically normalized.
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _zeeman_matrix., by default None
- Returns:
The resulting array gives Zeeman matrices for each field value and orientation in the form [fields, orientations, matrix, matrix] in atomic units a.u. (Hartree).
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltCompError – If the calculation of Zeeman matrices is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- soc_energies_cm_1(group: str, number_of_states: int = 0, slt: str = None) ndarray[float64] [source]#
Returns energies for the given number of first spin-orbit states in cm-1.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations.
number_of_states (int, optional) – Number of states whose energy will be returned. If set to zero, all available states will be inculded., by default 0
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _soc_energies., by default None
- Returns:
The resulting array is one-dimensional and contains the energy of first number_of_states states in cm-1.
- Return type:
np.ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltReadError – If the program is unable to get SOC energies from the .slt file.
SltFileError – If the program is unable to correctly save results to .slt file.
- states_magnetic_momenta(group: str, states: int | ndarray[int] = 0, rotation: ndarray[float64] = None, slt: str = None) ndarray[float64] [source]#
Calculates magnetic momenta of a given list (or number) of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetic momenta.
states (Union[int, np.ndarray[int]], optional) – ArrayLike structure (can be converted to numpy.NDArray) of states indexes for which magnetic momenta will be calculated. If set to an integer it acts as a states cutoff (first n states will be given). For all available states set it to zero., by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _states_magnetic_momenta., by default None
- Returns:
The resulting array is one-dimensional and contains the magnetic momenta corresponding to the given states indexes in atomic units.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltCompError – If the calculation of magnetic momenta is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- states_total_angular_momenta(group: str, states: int | ndarray[int] = 0, rotation: ndarray[float64] = None, slt: str = None) ndarray[float64] [source]#
Calculates total angular momenta of a given list (or number) of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetic momenta.
states (Union[int, np.ndarray[int]], optional) – ArrayLike structure (can be converted to numpy.NDArray) of states indexes for which total angular momenta will be calculated. If set to an integer it acts as a states cutoff (first n states will be given). For all available states set it to zero. , by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _states_total_angular_momenta., by default None
- Returns:
The resulting array is one-dimensional and contains the total angular momenta corresponding to the given states indexes in atomic units.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltCompError – If the calculation of total angular momenta is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- magnetic_momenta_matrix(group: str, states_cutoff: ndarray = 0, rotation: ndarray[float64] = None, slt: str = None) ndarray[complex128] [source]#
Calculates magnetic momenta matrix for a given number of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetic momenta matrix.
states_cutoff (np.ndarray, optional) – Number of states that will be taken into account for construction of the magnetic momenta matrix. If set to zero, all available states from the file will be included., by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _magnetic_momenta_matrix., by default None
- Returns:
The resulting magnetic_momenta_matrix_array gives magnetic momenta in atomic units and is in the form [coordinates, matrix, matrix] - the first dimension runs over coordinates (0-x, 1-y, 2-z).
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of magetic momenta matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- total_angular_momenta_matrix(group: str, states_cutoff: int = None, rotation: ndarray[float64] = None, slt: str = None) ndarray[complex128] [source]#
Calculates total angular momenta matrix for a given number of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the total angular momenta matrix.
states_cutoff (np.ndarray, optional) – Number of states that will be taken into account for construction of the total angular momenta matrix. If set to zero, all available states from the file will be included., by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _total angular_momenta_matrix., by default None
- Returns:
The resulting total_angular_momenta_matrix_array gives total angular momenta in atomic units and is in the form [coordinates, matrix, matrix] - the first dimension runs over coordinates (0-x, 1-y, 2-z).
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of total angular momenta matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- matrix_decomposition_in_z_pseudo_spin_basis(group: str, matrix: soc | zeeman, pseudo_kind: magnetic | total_angular, start_state: int = 0, stop_state: int = 0, rotation: ndarray[float64] = None, field: float64 = None, orientation: ndarray[float64] = None, slt: str = None) ndarray[float64] [source]#
Calculates decomposition of a given matrix in “z” pseudo-spin basis.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the construction of the matrix.
matrix (Union["soc", "zeeman"]) – Type of a matrix to be decomposed. Two options available: “soc” or “zeeman”.
pseudo_kind (Union["magnetic", "total_angular"]) – Kind of a pseudo-spin basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis.
start_state (int, optional) – Number of the first SOC state to be included., by default 0
stop_state (int, optional) – Number of the last SOC state to be included. If both start and stop are set to zero all available states from the file will be used. , by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
field (float64, optional) – If matrix type = “zeeman” it controls a magnetic field value at which Zeman matrix will be computed., by default None
orientation (ndarray[float64], optional) – If matrix type = “zeeman” it controls the orientation of the magnetic field and has to be in the form [direction_x, direction_y, direction_z] and be an ArrayLike structure (can be converted to numpy.NDArray)., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _magnetic/total_angular_decomposition. , by default None
- Returns:
The resulting array gives decomposition in % where rows are SOC/Zeeman states and columns are associated with pseudo spin basis (from -Sz to Sz).
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the decomposition of the matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- soc_crystal_field_parameters(group: str, start_state: int, stop_state: int, order: int, pseudo_kind: magnetic | total_angular, even_order: bool = True, complex: bool = False, rotation: ndarray[float64] = None, slt: str = None) list [source]#
Calculates ITO decomposition (CFPs) of SOC matrix.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for obtaining the SOC matrix.
start_state (int) – Number of the first SOC state to be included.
stop_state (int) – Number of the last SOC state to be included. If both start and stop are set to zero all available states from the file will be used.
order (int) – Order of the highest ITO (CFP) to be included in the decomposition.
pseudo_kind (Union["magnetic", "total_angular"]) – Kind of a pseudo-spin basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis.
even_order (bool, optional) – If True, only even order ITOs (CFPs) will be included in the decomposition., by default True
complex (bool, optional) – If True, instead of real ITOs (CFPs) complex ones will be given., by default False
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _soc_ito_decomposition., by default None
- Returns:
The resulting list gives CFP - B_k_q (ITO) in the form [k,q,B_k_q].
- Return type:
list
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltReadError – If the program is unable to read SOC matrix from the file.
SltInputError – If the order exceeds 2S pseudo-spin value.
SltCompError – If the ITO decomposition of the matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- zeeman_matrix_ito_decpomosition(group: str, start_state: int, stop_state: int, field: float64, orientation: ndarray[float64], order: int, pseudo_kind: magnetic | total_angular, complex: bool = False, rotation: ndarray[float64] = None, slt: str = None) list [source]#
Calculates ITO decomposition of Zeeman matrix.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for obtaining the Zeeman matrix.
start_state (int) – Number of the first Zeeman state to be included.
stop_state (int) – Number of the last Zeeman state to be included. If both start and stop are set to zero all available states from the file will be used.
field (float64) – Magnetic field value at which Zeman matrix will be computed.
orientation (ndarray[float64]) – Orientation of the magnetic field in the form of an ArrayLike structure (can be converted to numpy.NDArray) [direction_x, direction_y, direction_z].
order (int) – Order of the highest ITO (CFP) to be included in the decomposition.
pseudo_kind (Union["magnetic", "total_angular"]) – Kind of a pseudo-spin basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis.
complex (bool, optional) – If True, instead of real ITOs (CFPs) complex ones will be given., by default False
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _zeeman_ito_decomposition., by default None
- Returns:
The resulting list gives ITOs - B_k_q in the form [k,q,B_k_q]
- Return type:
list
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the program is unable to calculate Zeeman matrix from the file.
SltInputError – If the order exceeds 2S pseudo-spin value
SltCompError – If the ITO decomposition of the matrix is unsuccessful
SltFileError – If the program is unable to correctly save results to .slt file.
- matrix_from_ito(full_group_name: str, complex: bool, dataset_name: str = None, pseudo_spin: float64 = None, slt: str = None) ndarray[complex128] [source]#
Calculates matrix from a given ITO decomposition.
- Parameters:
full_group_name (str) – Full name of a group containing ITO decomposition.
complex (bool) – Determines the type of ITOs in the dataset. If True, instead of real ITOs complex ones will be used., by default False
dataset_name (str, optional) – A custom name for a user-created dataset within the group that contains list of B_k_q parameters in the form [k,q,B_k_q]., by default None
pseudo_spin (float64, optional) – Pseudo spin S value for the user-defined dataset., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _matrix_from_ito., by default None
- Returns:
Matrix reconstructed from a given ITO list.
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of the matrix from ITOs is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- soc_zeem_in_z_angular_magnetic_momentum_basis(group: str, start_state: int, stop_state: int, matrix_type: soc | zeeman, basis_kind: magnetic | total_angular, rotation: ndarray[float64] = None, field: float64 = None, orientation: ndarray[float64] = None, slt: str = None) ndarray[complex128] [source]#
Calculates SOC or Zeeman matrix in “z” magnetic or total angular momentum basis.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for obtaining the SOC or Zeeman matrix.
start_state (int) – Number of the first SOC state to be included.
stop_state (int) – Number of the last SOC state to be included. If both start and stop are set to zero all available states from the file will be used
matrix_type (Union["soc", "zeeman"]) – Type of a matrix to be decomposed. Two options available: “soc” or “zeeman”.
basis_kind (Union["magnetic", "total_angular"]) – Kind of a basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
field (float64, optional) – _description_, by default None
orientation (ndarray[float64], optional) – Orientation of the magnetic field in the form of an ArrayLike structure (can be converted to numpy.NDArray) [direction_x, direction_y, direction_z]., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _{matrix_type}_matrix_in_{basis_kind}_basis., by default None
- Returns:
Matrix in a given kind of basis.
- Return type:
ndarray[complex128]
- Raises:
SltInputError – If an unsuported type of matrix or basis is provided.
SltInputError – If there is no field value or orientation provided for Zeeman matrix.
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of a matrix in “z” basis is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- static colour_map(name)[source]#
Creates matplotlib colour map object.
- Parameters:
name – (str or lst) one of defined names for colour maps: BuPi, rainbow, dark_rainbow, light_rainbow,
light_rainbow_alt –
BuOr –
BuYl –
BuRd –
GnYl –
PrOr –
GnRd –
funmat –
NdCoN322bpdo –
NdCoNO222bpdo –
NdCoI22bpdo –
:param : :param viridis: :param plasma: :param inferno: :param magma: :param cividis or list of colour from which colour map will be created by: :param interpolation of colours between ones on a list; for predefined names modifiers can be applyed: _l loops :param the list in a way that it starts and ends with the same colour: :param _r reverses the list:
Returns:
- static custom_colour_cycler(number_of_colours: int, cmap1: str, cmap2: str)[source]#
Creates colour cycler from two colour maps in alternating pattern, suitable for use in matplotlib plots.
- Parameters:
number_of_colours – (int) number of colour in cycle
cmap1 – (str or lst) colour map name or list of colours (valid input for Compoud.colour_map())
cmap2 – (str or lst) colour map name or list of colours (valid input for Compoud.colour_map())
- Returns:
cycler object created based on two input colourmaps
- plot_mth(group: str, show=True, origin=False, save=False, colour_map_name='rainbow', xlim=(), ylim=(), xticks=1, yticks=0, field='B')[source]#
Function that creates graphs of M(H,T) given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of x major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_chitht(group, show=True, origin=False, save=False, colour_map_name='funmat', xlim=(), ylim=(), xticks=100, yticks=0, field='B')[source]#
Function that creates graphs of chiT(H,T) or chi(H,T) depending on content of HDF5 file, given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name (str): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of x major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_hemholtz_energyth(group: str, internal_energy=False, show=True, origin=False, save=False, colour_map_name='rainbow', xlim=(), ylim=(), xticks=1, yticks=0, field='B')[source]#
Function that creates graphs of M(H,T) given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of x major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_zeeman(group: str, show=True, origin=False, save=False, colour_map_name1='BuPi', colour_map_name2='BuPi_r', single=False, xlim=(), ylim=(), xticks=1, yticks=0, field='B')[source]#
Function that creates graphs of E(H,orientation) given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name1 (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod colour_map_name2 (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod single (bool): determines if graph should be created for each orientation given separately xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of y major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_3d(group: str, data_type: str, field_i: int, temp_i: int, show=True, save=False, colour_map_name='dark_rainbow_r_l', lim_scalar=1.0, ticks=1.0, r_density=0, c_density=0, axis_off=False)[source]#
Function that creates 3d plots of data dependent on field (B[T]) and temperature(T[K])
- Parameters:
group (str) – name of a group from hdf5 file for which plot will be created
data_type (str) – type of data that will be used to create plot, can only be one from 3 types: susceptibility, hemholtz_energy or magnetisation
field_i (int) – index of field from dataset that will be used for plot
temp_i (int) – index of temperature from dataset that will be used for plot
show (bool = True) – determines if plot is shown, currently there is no reason to setting it to False
save (bool = False) – determines if plot is saved, name of the file will be in following format: f’{group}_3d_{data_type}.tiff’
colour_map_name (str or list = 'dark_rainbow_r_l') – input of Compound.colour_map function
lim_scalar (float = 1.) – scalar used to set limits of axes, smaller values magm
ticks (float = 1.) –
r_density (int = 0) – determines rcount of 3D plot
c_density (int = 0) – determines ccount of 3D plot
axis_off (bool = False) – determines if axes are turned off
- animate_3d(group: str, data_type: str, animation_variable: str, filename: str, i_start=0, i_end=30, i_constant=0, colour_map_name='dark_rainbow_r_l', lim_scalar=1, ticks=1, r_density=0, c_density=0, axis_off=False, fps=15, dpi=100, bar=True, bar_scale=False, bar_colour_map_name='dark_rainbow_r', temp_rounding=0, field_rounding=0)[source]#
slothpy.core.creation_functions module#
- slothpy.core.creation_functions.compound_from_orca(slt_filepath: str, slt_filename: str, name: str, orca_filepath: str, orca_filename: str, pt2: bool = False) Compound [source]#
Create a Compound from ORCA output file.
- Parameters:
slt_filepath (str) – Path of existing .slt file or to which the resulting .slt file will be saved.
slt_filename (str) – Name of the .slt file to be created/accessed.
name (str) – Name of a group to which results of relativistic ab initio calculations will be saved.
orca_filepath (str) – Path to the ORCA output file.
orca_filename (str) – Name of the ORCA output file.
pt2 (bool, optional) – If True the results of CASPT2/NEVPT2 second-order perturbative corrections will be loaded to the file., by default False
- Returns:
An instance of Compound class associated with the given .slt file, that serves as an user interface, holding all the available methods.
- Return type:
- Raises:
SltFileError – If the program is unable to create a Compound from given files.
- slothpy.core.creation_functions.compound_from_molcas(slt_filepath: str, slt_filename: str, name: str, molcas_filepath: str, molcas_filename: str) Compound [source]#
Create a Compound from MOLCAS rassi.h5 file.
- Parameters:
slt_filepath (str) – Path of existing .slt file or to which the resulting .slt file will be saved.
slt_filename (str) – Name of the .slt file to be created/accessed.
name (str) – Name of a group to which results of relativistic ab initio calculations will be saved.
molcas_filepath (str) – Path to the MOLCAS .rassi.h5 file.
molcas_filename (str) – Name of the MOLCAS .rassi.h5 file (without the suffix).
- Returns:
An instance of Compound class associated with the given .slt file, that serves as an user interface, holding all the available methods.
- Return type:
- Raises:
SltFileError – If the program is unable to create a Compound from given files.
- slothpy.core.creation_functions.compound_from_slt(slt_filepath: str, slt_filename: str) Compound [source]#
Create a Compound from the existing .slt file.
- Parameters:
slt_filepath (str) – Path to the existing .slt file to be loaded.
slt_filename (str) – Name of an existing .slt file to be loaded.
- Returns:
An instance of Compound class associated with the given .slt file, that serves as an user interface, holding all the available methods.
- Return type:
- Raises:
SltFileError – If the program is unable to create a Compound from a given file.
Module contents#
- slothpy.core.compound_from_slt(slt_filepath: str, slt_filename: str) Compound [source]#
Create a Compound from the existing .slt file.
- Parameters:
slt_filepath (str) – Path to the existing .slt file to be loaded.
slt_filename (str) – Name of an existing .slt file to be loaded.
- Returns:
An instance of Compound class associated with the given .slt file, that serves as an user interface, holding all the available methods.
- Return type:
- Raises:
SltFileError – If the program is unable to create a Compound from a given file.
- slothpy.core.compound_from_molcas(slt_filepath: str, slt_filename: str, name: str, molcas_filepath: str, molcas_filename: str) Compound [source]#
Create a Compound from MOLCAS rassi.h5 file.
- Parameters:
slt_filepath (str) – Path of existing .slt file or to which the resulting .slt file will be saved.
slt_filename (str) – Name of the .slt file to be created/accessed.
name (str) – Name of a group to which results of relativistic ab initio calculations will be saved.
molcas_filepath (str) – Path to the MOLCAS .rassi.h5 file.
molcas_filename (str) – Name of the MOLCAS .rassi.h5 file (without the suffix).
- Returns:
An instance of Compound class associated with the given .slt file, that serves as an user interface, holding all the available methods.
- Return type:
- Raises:
SltFileError – If the program is unable to create a Compound from given files.
- slothpy.core.compound_from_orca(slt_filepath: str, slt_filename: str, name: str, orca_filepath: str, orca_filename: str, pt2: bool = False) Compound [source]#
Create a Compound from ORCA output file.
- Parameters:
slt_filepath (str) – Path of existing .slt file or to which the resulting .slt file will be saved.
slt_filename (str) – Name of the .slt file to be created/accessed.
name (str) – Name of a group to which results of relativistic ab initio calculations will be saved.
orca_filepath (str) – Path to the ORCA output file.
orca_filename (str) – Name of the ORCA output file.
pt2 (bool, optional) – If True the results of CASPT2/NEVPT2 second-order perturbative corrections will be loaded to the file., by default False
- Returns:
An instance of Compound class associated with the given .slt file, that serves as an user interface, holding all the available methods.
- Return type:
- Raises:
SltFileError – If the program is unable to create a Compound from given files.
- class slothpy.core.Compound(*args, **kwargs)[source]#
Bases:
object
The core object constituting the API and access to all the methods.
- delete_group_dataset(first: str, second: str = None) None [source]#
Deletes a group/dataset provided its full name/path from the .slt file.
- Parameters:
first (str) – A name of the gorup or dataset to be deleted.
second (str, optional) – A name of the particular dataset inside the group from the first argument to be deleted.
- Raises:
SltFileError – If the deletion is unsuccessful.
- calculate_g_tensor_and_axes_doublet(group: str, doublets: ndarray[int64], slt: str = None) Tuple[ndarray[float64], ndarray[float64]] [source]#
Calculates pseudo-g-tensor components (for S = 1/2) and main magnetic axes for a given list of doublet states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of g-tensors.
doublets (ndarray[int64]) – ArrayLike structure (can be converted to numpy.NDArray) of integers corresponding to doublet labels (numbers).
slt (str, optional) – If given, the results will be saved using this name to the .slt file with the suffix: _g_tensors_axes, by default None.
- Returns:
The first array (g_tensor_list) contains a list g-tensors in a format [doublet_number, gx, gy, gz], the second one (magnetic_axes_list) contains respective rotation matrices.
- Return type:
Tuple[ndarray[float64], ndarray[float64]]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If doublets are not one-diemsional array.
SltCompError – If the calculation of g-tensors is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Magnetic axes are returned in the form of rotation matrices that diagonalise the Abragam-Bleaney tensor (G = gg.T). Coordinates of the main axes XYZ in the initial xzy frame are columns of such matrices (0-X, 1-Y, 2-Z).
- calculate_mth(group: str, fields: ndarray[float64], grid: int | ndarray[float64], temperatures: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates powder-averaged or directional molar magnetisation M(T,H) for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetisation.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which magnetisation will be computed.
grid (Union[int, ndarray[float64]]) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over hemisphere will be used (see grids_over_hemisphere documentation), otherwise, user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] for powder-averaging. If one wants a calculation for a single, particular direction the list has to contain one entry like this: [[direction_x, direction_y, direction_z, 1.]]. Custom grids will be automatically normalized.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which magnetisation will be computed.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _magnetisation., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting mth_array gives magnetisation in Bohr magnetons and is in the form [temperatures, fields] - the first dimension runs over temperature values, and the second over fields.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If temperatures are not a one-diemsional array.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of magnetisation is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
See also
slothpy.lebedev_laikov_grid
For the description of the prescribed
Lebedev-Laikov
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over the provided field values.
- calculate_mag_3d(group: str, fields: ndarray[float64], spherical_grid: int, temperatures: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates 3D magnetisation over a spherical grid for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the 3D magnetisation.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which 3D magnetisation will be computed.
spherical_grid (int) – Controls the density of the angular grid for the 3D magnetisation calculation. A grid of dimension (spherical_grid*2*spherical_grid) for spherical angles theta [0, pi], and phi [0, 2*pi] will be used.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temperature values (K) at which 3D magnetisation will be computed.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _3d_magnetisation., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting mag_3d_array gives magnetisation in Bohr magnetons and is in the form [coordinates, fields, temperatures, mesh, mesh] - the first dimension runs over coordinates (0-x, 1-y, 2-z), the second over field values, and the third over temperatures. The last two dimensions are in a form of meshgrids over theta and phi, ready for 3D plots as xyz.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If spherical_grid is not a positive integer.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of 3D magnetisation is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over len(fields)*2*shperical_grid**2 tasks. Be aware that the resulting arrays and computations can quickly consume much memory (e.g. for a calculation with 100 field values 1-10 T, 300 temperatures 1-300 K, and spherical_grid = 60, the resulting array will take 3*100*300*2*60*60*8 bytes = 5.184 GB).
- calculate_chitht(group: str, temperatures: ndarray[float64], fields: ndarray[float64], number_of_points: int, delta_h: float = 0.0001, states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, exp: bool = False, T: bool = True, grid: int | ndarray[float64] = None, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates powder-averaged or directional molar magnetic susceptibility chi(T)(H,T) for a given list of field and temperatures values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetisation.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which magnetic susceptibility will be computed.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which magnetic susceptibility will be computed.
number_of_points (int) – Controls the number of points for numerical differentiation over the magnetic field values using the finite difference method with a symmetrical stencil. The total number of used points = (2 * num_of_opints + 1), therefore 1 is a minimum value to obtain the first derivative using 3 points - including the value at the point at which the derivative is taken. In this regard, the value 0 triggers the experimentalist model for susceptibility.
delta_h (float64, optional) – Value of field step used for numerical differentiation using finite difference method. 0.0001 (T) = 1 Oe is recommended as a starting point., by default 0.0001
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
exp (bool, optional) – Turns on the experimentalist model for magnetic susceptibility., by default False
T (bool, optional) – Results are returned as a product with temperature chiT(H,T)., by default True
grid (Union[int, np.ndarray[float64]], optional) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over the hemisphere will be used (see grids_over_hemisphere documentation), otherwise, the user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] for powder-averaging. If one wants a calculation for a single, particular direction the list has to contain one entry like this: [[direction_x, direction_y, direction_z, 1.]]. If not given the average is taken over xyz directions, which is sufficient for a second rank tensor. Custom grids will be automatically normalized., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _susceptibility., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with a higher number of field values and number_of_points) where it becomes a necessity., by default False
- Returns:
The resulting chitht_array gives magnetic susceptibility (or product with temperature) in cm^3 (or * K) and is in the form [fields, temperatures] - the first dimension runs over field values, and the second over temperatures.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If the number of points for finite difference method is not a possitive integer.
SltInputError – If the field step for the finite difference method is not a possitive real number.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of magnetic susceptibility is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over fields.size*(2*number_of_points+1) tasks.
- calculate_chit_tensorht(group: str, temperatures: ndarray[float64], fields: ndarray[float64], number_of_points: int, delta_h: float = 0.0001, states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, exp: bool = False, T: bool = True, rotation: ndarray[float64] = None, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates magnetic susceptibility chi(H,T) (Van Vleck) tensor for a given list of field and temperature values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetisation.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which magnetic susceptibility tensor will be computed.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which magnetic susceptibility tensor will be computed.
number_of_points (int) – Controls the number of points for numerical differentiation over the magnetic field values using the finite difference method with a symmetrical stencil. The total number of used points = (2 * num_of_opints + 1), therefore 1 is a minimum value to obtain the first derivative using 3 points - including the value at the point at which the derivative is taken. In this regard, the value 0 triggers the experimentalist model for susceptibility.
delta_h (float64, optional) – Value of field step used for numerical differentiation using finite difference method. 0.0001 (T) = 1 Oe is recommended as a starting point., by default 0.0001,
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
exp (bool, optional) – Turns on the experimentalist model for magnetic susceptibility., by default False
T (bool, optional) – Results are returned as a product with temperature chiT(H,T)., by default True
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _susceptibility_tensor., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 500 with a higher number of field values and number_of_points) where it becomes a necessity., by default False
- Returns:
The resulting array gives magnetic susceptibility (Van Vleck) tensors (or products with temperature) in cm^3 (or * K) and is in the form [fields, temperatures, 3x3 tensor] - the first dimension runs over field values, the second over temperatures, and the last two accomodate 3x3 tensors.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If the number of points for finite difference method is not a possitive integer
SltInputError – If the field step for the finite difference method is not a possitive real number.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of magnetic susceptibility tensor is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over fields.size*(2*number_of_points+1) tasks.
- calculate_chit_3d(group: str, temperatures: ndarray[float64], fields: ndarray[float64], spherical_grid: int, number_of_points: int, delta_h: float = 0.0001, states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, exp: bool = False, T: bool = True, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates 3D magnetic susceptibility over a spherical grid for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the 3D magnetic susceptibility.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temperature values (K) at which 3D magnetic susceptibility will be computed.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which 3D magnetic susceptibility will be computed.
spherical_grid (int) – Controls the density of the angular grid for the 3D susceptibility calculation. A grid of dimension (spherical_grid*2*spherical_grid) for spherical angles theta [0, pi], and phi [0, 2*pi] will be used.
number_of_points (int) – Controls the number of points for numerical differentiation over the magnetic field values using the finite difference method with a symmetrical stencil. The total number of used points = (2 * num_of_opints + 1), therefore 1 is a minimum value to obtain the first derivative using 3 points - including the value at the point at which the derivative is taken. In this regard, the value 0 triggers the experimentalist model for susceptibility.
delta_h (float64, optional) – Value of field step used for numerical differentiation using finite difference method. 0.0001 (T) = 1 Oe is recommended as a starting point., by default 0.0001
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
exp (bool, optional) – Turns on the experimentalist model for magnetic susceptibility., by default False
T (bool, optional) – Results are returned as a product with temperature chiT(H,T)., by default True
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _3d_magnetisation., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting chi_3d_array gives magnetic susceptibility (or product with temperature) in cm^3 (or * K) and is in the form [coordinates, fields, temperatures, mesh, mesh] - the first dimension runs over coordinates (0-x, 1-y, 2-z), the second over field values, and the third over temperatures. The last two dimensions are in a form of meshgrids over theta and phi, ready for 3D plots as xyz.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If spherical_grid is not a positive integer.
SltInputError – If the number of points for finite difference method is not a possitive integer.
SltInputError – If the field step for the finite difference method is not a possitive real number.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of 3D magnetic susceptibility is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over len(fields)*(2*number_of_points + 1) *2*shperical_grid**2 tasks. Be aware that the resulting arrays and computations can quickly consume much memory (e.g. for calculation with 100 field values 1-10 T, 300 temperatures 1-300 K, number_of_points=3, and spherical_grid = 60, the intermediate array (before numerical differentiation) will take 7*100*300*2*60*60*8 bytes = 12.096 GB).
- calculate_hemholtz_energyth(group: str, fields: ndarray[float64], grid: ndarray[float64], temperatures: ndarray[float64], states_cutoff: int, number_cpu: int, number_threads: int, internal_energy: bool = False, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates powder-averaged or directional Hemholtz (or internal) energy for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the energy.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which energy will be computed.
grid (ndarray[float64]) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over hemisphere will be used (see grids_over_hemisphere documentation), otherwise, user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] for powder-averaging. If one wants a calculation for a single, particular direction the list has to contain one entry like this: [[direction_x, direction_y, direction_z, 1.]]. Custom grids will be automatically normalized.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temeperature values (K) at which energy will be computed
states_cutoff (int) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
internal_energy (bool, optional) – Turns on the calculation of internal energy., by default False
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _hemholtz_energy or _internal_energy., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting eth_array gives energy in cm-1 and is in the form [temperatures, fields] - the first dimension runs over temperature values, and the second over fields.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array
SltInputError – If temperatures are not a one-diemsional array
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of energy is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
See also
slothpy.lebedev_laikov_grid
For the description of the prescribed
Lebedev-Laikov
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over the provided field values.
- calculate_hemholtz_energy_3d(group: str, fields: ndarray[float64], spherical_grid: int, temperatures: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, internal_energy: bool = False, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates 3D Hemholtz (or internal) energy over a spherical grid for a given list of temperature and field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the 3D energy.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which 3D energy will be computed.
spherical_grid (int) – Controls the density of the angular grid for the 3D magnetisation calculation. A grid of dimension (spherical_grid*2*spherical_grid) for spherical angles theta [0, pi], and phi [0, 2*pi] will be used.
temperatures (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of temperature values (K) at which 3D energy will be computed.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0,
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
internal_energy (bool, optional) – Turns on the calculation of internal energy., by default False
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _3d_hemholtz_energy or _3d_internal_energy., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default False
- Returns:
The resulting energy_3d_array gives energy in cm-1 and is in the form [coordinates, fields, temperatures, mesh, mesh] - the first dimension runs over coordinates (0-x, 1-y, 2-z), the second over field values, and the third over temperatures. The last two dimensions are in a form of meshgrids over theta and phi, ready for 3D plots as xyz.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If temperatures are not a one-diemsional array.
SltInputError – If spherical_grid is not a positive integer.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of 3D energy is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over len(fields)*2*shperical_grid**2 tasks. Be aware that the resulting arrays and computations can quickly consume much memory (e.g. for a calculation with 100 field values 1-10 T, 300 temperatures 1-300 K, and spherical_grid = 60, the resulting array will take 3*100*300*2*60*60*8 bytes = 5.184 GB).
- calculate_zeeman_splitting(group: str, number_of_states: int, fields: ndarray[float64], grid: ndarray[float64], states_cutoff: int = 0, number_cpu: int = 0, number_threads: int = 1, average: bool = False, slt: str = None, autotune: bool = False, _autotune_size: int = 2) ndarray[float64] [source]#
Calculates directional or powder-averaged Zeeman splitting for a given number of states and list of field values.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the Zeeman splitting.
number_of_states (int) – Number of states whose energy splitting will be given in the result array.
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) at which Zeeman splitting will be computed.
grid (ndarray[float64]) – If the grid is set to an integer from 0-11 then the prescribed Lebedev-Laikov grids over hemisphere will be used (see grids_over_hemisphere documentation) and powder-averaging will be turned on, otherwise, user can provide an ArrayLike structure (can be converted to numpy.NDArray) with the convention: [[direction_x, direction_y, direction_z, weight],…] with average = True for powder-averaging. If one wants a calculation for a list of particular directions the list has to follow the format: [[direction_x, direction_y, direction_z],…]. Custom grids will be automatically normalized.
states_cutoff (int, optional) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
number_cpu (int, optional) – Number of logical CPUs to be assigned to perform the calculation. If set to zero, all available CPUs will be used., by default 0
number_threads (int, optional) – Number of threads used in a multithreaded implementation of linear algebra libraries used during the calculation. Higher values benefit from the increasing size of matrices (states_cutoff) over the parallelization over CPUs., by default 1
average (bool, optional) – Turns on powder-averaging using a list of directions and weights in the form of ArrayLike structure: [[direction_x, direction_y, direction_z, weight],…].
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _zeeman_splitting., by default None
autotune (bool, optional) – If True the program will automatically try to choose the best number of threads (and therefore parallel processes), for the given number of CPUs, to be used during the calculation. Note that this process can take a significant amount of time, so start to use it with medium-sized calculations (e.g. for states_cutoff > 300 with dense grids or a higher number of field values) where it becomes a necessity., by default Falsee
- Returns:
The resulting array gives Zeeman splitting of number_of_states energy levels in cm-1 for each direction (or average) in the form [orientations, fields, energies] - the first dimension runs over different orientations, the second over field values, and the last gives energy of number_of_states states.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltInputError – If number of states is not a positive integer less or equal to the states cutoff.
SltCompError – If autotuning a number of processes and threads is unsuccessful.
SltCompError – If the calculation of Zeeman splitting is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
See also
slothpy.lebedev_laikov_grid
For the description of the prescribed
Lebedev-Laikov
Notes
Here, (number_cpu // number_threads) parallel processes are used to distribute the workload over the provided field values.
- zeeman_matrix(group: str, states_cutoff: int, fields: ndarray[float64], orientations: ndarray[float64], slt: str = None) ndarray[complex128] [source]#
Calculates Zeeman matrices for a given list of magnetic fields and their orientations.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the Zeeman matrices.
states_cutoff (int) – Number of states that will be taken into account for construction of Zeeman Hamiltonian. If set to zero, all available states from the file will be used., by default 0
fields (ndarray[float64]) – ArrayLike structure (can be converted to numpy.NDArray) of field values (T) for which Zeeman matrices will be computed.
orientations (ndarray[float64]) – List (ArrayLike structure) of particular magnetic field directions for which Zeeman matrices will be constructed. The list has to follow the format: [[direction_x, direction_y, direction_z],…]. The vectors will be automatically normalized.
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _zeeman_matrix., by default None
- Returns:
The resulting array gives Zeeman matrices for each field value and orientation in the form [fields, orientations, matrix, matrix] in atomic units a.u. (Hartree).
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltInputError – If fields are not a one-diemsional array.
SltCompError – If the calculation of Zeeman matrices is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- soc_energies_cm_1(group: str, number_of_states: int = 0, slt: str = None) ndarray[float64] [source]#
Returns energies for the given number of first spin-orbit states in cm-1.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations.
number_of_states (int, optional) – Number of states whose energy will be returned. If set to zero, all available states will be inculded., by default 0
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _soc_energies., by default None
- Returns:
The resulting array is one-dimensional and contains the energy of first number_of_states states in cm-1.
- Return type:
np.ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltReadError – If the program is unable to get SOC energies from the .slt file.
SltFileError – If the program is unable to correctly save results to .slt file.
- states_magnetic_momenta(group: str, states: int | ndarray[int] = 0, rotation: ndarray[float64] = None, slt: str = None) ndarray[float64] [source]#
Calculates magnetic momenta of a given list (or number) of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetic momenta.
states (Union[int, np.ndarray[int]], optional) – ArrayLike structure (can be converted to numpy.NDArray) of states indexes for which magnetic momenta will be calculated. If set to an integer it acts as a states cutoff (first n states will be given). For all available states set it to zero., by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _states_magnetic_momenta., by default None
- Returns:
The resulting array is one-dimensional and contains the magnetic momenta corresponding to the given states indexes in atomic units.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltCompError – If the calculation of magnetic momenta is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- states_total_angular_momenta(group: str, states: int | ndarray[int] = 0, rotation: ndarray[float64] = None, slt: str = None) ndarray[float64] [source]#
Calculates total angular momenta of a given list (or number) of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetic momenta.
states (Union[int, np.ndarray[int]], optional) – ArrayLike structure (can be converted to numpy.NDArray) of states indexes for which total angular momenta will be calculated. If set to an integer it acts as a states cutoff (first n states will be given). For all available states set it to zero. , by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _states_total_angular_momenta., by default None
- Returns:
The resulting array is one-dimensional and contains the total angular momenta corresponding to the given states indexes in atomic units.
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltInputError – If input ArrayLike data cannot be converted to numpy.NDArrays.
SltCompError – If the calculation of total angular momenta is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- magnetic_momenta_matrix(group: str, states_cutoff: ndarray = 0, rotation: ndarray[float64] = None, slt: str = None) ndarray[complex128] [source]#
Calculates magnetic momenta matrix for a given number of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the magnetic momenta matrix.
states_cutoff (np.ndarray, optional) – Number of states that will be taken into account for construction of the magnetic momenta matrix. If set to zero, all available states from the file will be included., by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _magnetic_momenta_matrix., by default None
- Returns:
The resulting magnetic_momenta_matrix_array gives magnetic momenta in atomic units and is in the form [coordinates, matrix, matrix] - the first dimension runs over coordinates (0-x, 1-y, 2-z).
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of magetic momenta matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- total_angular_momenta_matrix(group: str, states_cutoff: int = None, rotation: ndarray[float64] = None, slt: str = None) ndarray[complex128] [source]#
Calculates total angular momenta matrix for a given number of SOC states.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the computation of the total angular momenta matrix.
states_cutoff (np.ndarray, optional) – Number of states that will be taken into account for construction of the total angular momenta matrix. If set to zero, all available states from the file will be included., by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _total angular_momenta_matrix., by default None
- Returns:
The resulting total_angular_momenta_matrix_array gives total angular momenta in atomic units and is in the form [coordinates, matrix, matrix] - the first dimension runs over coordinates (0-x, 1-y, 2-z).
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of total angular momenta matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- matrix_decomposition_in_z_pseudo_spin_basis(group: str, matrix: soc | zeeman, pseudo_kind: magnetic | total_angular, start_state: int = 0, stop_state: int = 0, rotation: ndarray[float64] = None, field: float64 = None, orientation: ndarray[float64] = None, slt: str = None) ndarray[float64] [source]#
Calculates decomposition of a given matrix in “z” pseudo-spin basis.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for the construction of the matrix.
matrix (Union["soc", "zeeman"]) – Type of a matrix to be decomposed. Two options available: “soc” or “zeeman”.
pseudo_kind (Union["magnetic", "total_angular"]) – Kind of a pseudo-spin basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis.
start_state (int, optional) – Number of the first SOC state to be included., by default 0
stop_state (int, optional) – Number of the last SOC state to be included. If both start and stop are set to zero all available states from the file will be used. , by default 0
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
field (float64, optional) – If matrix type = “zeeman” it controls a magnetic field value at which Zeman matrix will be computed., by default None
orientation (ndarray[float64], optional) – If matrix type = “zeeman” it controls the orientation of the magnetic field and has to be in the form [direction_x, direction_y, direction_z] and be an ArrayLike structure (can be converted to numpy.NDArray)., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _magnetic/total_angular_decomposition. , by default None
- Returns:
The resulting array gives decomposition in % where rows are SOC/Zeeman states and columns are associated with pseudo spin basis (from -Sz to Sz).
- Return type:
ndarray[float64]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the decomposition of the matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- soc_crystal_field_parameters(group: str, start_state: int, stop_state: int, order: int, pseudo_kind: magnetic | total_angular, even_order: bool = True, complex: bool = False, rotation: ndarray[float64] = None, slt: str = None) list [source]#
Calculates ITO decomposition (CFPs) of SOC matrix.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for obtaining the SOC matrix.
start_state (int) – Number of the first SOC state to be included.
stop_state (int) – Number of the last SOC state to be included. If both start and stop are set to zero all available states from the file will be used.
order (int) – Order of the highest ITO (CFP) to be included in the decomposition.
pseudo_kind (Union["magnetic", "total_angular"]) – Kind of a pseudo-spin basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis.
even_order (bool, optional) – If True, only even order ITOs (CFPs) will be included in the decomposition., by default True
complex (bool, optional) – If True, instead of real ITOs (CFPs) complex ones will be given., by default False
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _soc_ito_decomposition., by default None
- Returns:
The resulting list gives CFP - B_k_q (ITO) in the form [k,q,B_k_q].
- Return type:
list
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltReadError – If the program is unable to read SOC matrix from the file.
SltInputError – If the order exceeds 2S pseudo-spin value.
SltCompError – If the ITO decomposition of the matrix is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- zeeman_matrix_ito_decpomosition(group: str, start_state: int, stop_state: int, field: float64, orientation: ndarray[float64], order: int, pseudo_kind: magnetic | total_angular, complex: bool = False, rotation: ndarray[float64] = None, slt: str = None) list [source]#
Calculates ITO decomposition of Zeeman matrix.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for obtaining the Zeeman matrix.
start_state (int) – Number of the first Zeeman state to be included.
stop_state (int) – Number of the last Zeeman state to be included. If both start and stop are set to zero all available states from the file will be used.
field (float64) – Magnetic field value at which Zeman matrix will be computed.
orientation (ndarray[float64]) – Orientation of the magnetic field in the form of an ArrayLike structure (can be converted to numpy.NDArray) [direction_x, direction_y, direction_z].
order (int) – Order of the highest ITO (CFP) to be included in the decomposition.
pseudo_kind (Union["magnetic", "total_angular"]) – Kind of a pseudo-spin basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis.
complex (bool, optional) – If True, instead of real ITOs (CFPs) complex ones will be given., by default False
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _zeeman_ito_decomposition., by default None
- Returns:
The resulting list gives ITOs - B_k_q in the form [k,q,B_k_q]
- Return type:
list
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the program is unable to calculate Zeeman matrix from the file.
SltInputError – If the order exceeds 2S pseudo-spin value
SltCompError – If the ITO decomposition of the matrix is unsuccessful
SltFileError – If the program is unable to correctly save results to .slt file.
- matrix_from_ito(full_group_name: str, complex: bool, dataset_name: str = None, pseudo_spin: float64 = None, slt: str = None) ndarray[complex128] [source]#
Calculates matrix from a given ITO decomposition.
- Parameters:
full_group_name (str) – Full name of a group containing ITO decomposition.
complex (bool) – Determines the type of ITOs in the dataset. If True, instead of real ITOs complex ones will be used., by default False
dataset_name (str, optional) – A custom name for a user-created dataset within the group that contains list of B_k_q parameters in the form [k,q,B_k_q]., by default None
pseudo_spin (float64, optional) – Pseudo spin S value for the user-defined dataset., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _matrix_from_ito., by default None
- Returns:
Matrix reconstructed from a given ITO list.
- Return type:
ndarray[complex128]
- Raises:
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of the matrix from ITOs is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- soc_zeem_in_z_angular_magnetic_momentum_basis(group: str, start_state: int, stop_state: int, matrix_type: soc | zeeman, basis_kind: magnetic | total_angular, rotation: ndarray[float64] = None, field: float64 = None, orientation: ndarray[float64] = None, slt: str = None) ndarray[complex128] [source]#
Calculates SOC or Zeeman matrix in “z” magnetic or total angular momentum basis.
- Parameters:
group (str) – Name of a group containing results of relativistic ab initio calculations used for obtaining the SOC or Zeeman matrix.
start_state (int) – Number of the first SOC state to be included.
stop_state (int) – Number of the last SOC state to be included. If both start and stop are set to zero all available states from the file will be used
matrix_type (Union["soc", "zeeman"]) – Type of a matrix to be decomposed. Two options available: “soc” or “zeeman”.
basis_kind (Union["magnetic", "total_angular"]) – Kind of a basis. Two options available: “magnetic” or “total_angular” for the decomposition in a particular basis
rotation (ndarray[float64], optional) – A (3,3) orthogonal rotation matrix used to rotate momenta matrices. Note that the inverse matrix has to be given to rotate the reference frame instead., by default None
field (float64, optional) – _description_, by default None
orientation (ndarray[float64], optional) – Orientation of the magnetic field in the form of an ArrayLike structure (can be converted to numpy.NDArray) [direction_x, direction_y, direction_z]., by default None
slt (str, optional) – If given the results will be saved in a group of this name to .slt file with suffix: _{matrix_type}_matrix_in_{basis_kind}_basis., by default None
- Returns:
Matrix in a given kind of basis.
- Return type:
ndarray[complex128]
- Raises:
SltInputError – If an unsuported type of matrix or basis is provided.
SltInputError – If there is no field value or orientation provided for Zeeman matrix.
SltSaveError – If the name of the group already exists in the .slt file.
SltCompError – If the calculation of a matrix in “z” basis is unsuccessful.
SltFileError – If the program is unable to correctly save results to .slt file.
- static colour_map(name)[source]#
Creates matplotlib colour map object.
- Parameters:
name – (str or lst) one of defined names for colour maps: BuPi, rainbow, dark_rainbow, light_rainbow,
light_rainbow_alt –
BuOr –
BuYl –
BuRd –
GnYl –
PrOr –
GnRd –
funmat –
NdCoN322bpdo –
NdCoNO222bpdo –
NdCoI22bpdo –
:param : :param viridis: :param plasma: :param inferno: :param magma: :param cividis or list of colour from which colour map will be created by: :param interpolation of colours between ones on a list; for predefined names modifiers can be applyed: _l loops :param the list in a way that it starts and ends with the same colour: :param _r reverses the list:
Returns:
- static custom_colour_cycler(number_of_colours: int, cmap1: str, cmap2: str)[source]#
Creates colour cycler from two colour maps in alternating pattern, suitable for use in matplotlib plots.
- Parameters:
number_of_colours – (int) number of colour in cycle
cmap1 – (str or lst) colour map name or list of colours (valid input for Compoud.colour_map())
cmap2 – (str or lst) colour map name or list of colours (valid input for Compoud.colour_map())
- Returns:
cycler object created based on two input colourmaps
- plot_mth(group: str, show=True, origin=False, save=False, colour_map_name='rainbow', xlim=(), ylim=(), xticks=1, yticks=0, field='B')[source]#
Function that creates graphs of M(H,T) given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of x major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_chitht(group, show=True, origin=False, save=False, colour_map_name='funmat', xlim=(), ylim=(), xticks=100, yticks=0, field='B')[source]#
Function that creates graphs of chiT(H,T) or chi(H,T) depending on content of HDF5 file, given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name (str): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of x major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_hemholtz_energyth(group: str, internal_energy=False, show=True, origin=False, save=False, colour_map_name='rainbow', xlim=(), ylim=(), xticks=1, yticks=0, field='B')[source]#
Function that creates graphs of M(H,T) given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of x major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_zeeman(group: str, show=True, origin=False, save=False, colour_map_name1='BuPi', colour_map_name2='BuPi_r', single=False, xlim=(), ylim=(), xticks=1, yticks=0, field='B')[source]#
Function that creates graphs of E(H,orientation) given name of the group in HDF5 file, graphs can be optionally shown, saved, colour palettes can be changed. If origin=True it returns data packed into a dictionary for exporting to Origin.
- Args:
group (str): name of a group in HDF5 file show (bool): determines if matplotlib graph is created and shown if True origin (bool): determines if function should return raw data save (bool): determines if matplotlib graph should be saved, saved graphs are TIFF files colour_map_name1 (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod colour_map_name2 (str) or (list): sets colours used to create graphs, valid options are returned by Compound.colour_map staticmethod single (bool): determines if graph should be created for each orientation given separately xlim (tuple): tuple of two or one numbers that set corresponding axe limits ylim (tuple): tuple of two or one numbers that set corresponding axe limits xticks (int): frequency of x major ticks yticks (int): frequency of y major ticks field (‘B’ or ‘H’): chooses field type and unit: Tesla for B and kOe for H
- Returns:
- if origin=True:
dict[origin_column (str), data (np.array)]: contains data used to create graph in origin
- plot_3d(group: str, data_type: str, field_i: int, temp_i: int, show=True, save=False, colour_map_name='dark_rainbow_r_l', lim_scalar=1.0, ticks=1.0, r_density=0, c_density=0, axis_off=False)[source]#
Function that creates 3d plots of data dependent on field (B[T]) and temperature(T[K])
- Parameters:
group (str) – name of a group from hdf5 file for which plot will be created
data_type (str) – type of data that will be used to create plot, can only be one from 3 types: susceptibility, hemholtz_energy or magnetisation
field_i (int) – index of field from dataset that will be used for plot
temp_i (int) – index of temperature from dataset that will be used for plot
show (bool = True) – determines if plot is shown, currently there is no reason to setting it to False
save (bool = False) – determines if plot is saved, name of the file will be in following format: f’{group}_3d_{data_type}.tiff’
colour_map_name (str or list = 'dark_rainbow_r_l') – input of Compound.colour_map function
lim_scalar (float = 1.) – scalar used to set limits of axes, smaller values magm
ticks (float = 1.) –
r_density (int = 0) – determines rcount of 3D plot
c_density (int = 0) – determines ccount of 3D plot
axis_off (bool = False) – determines if axes are turned off
- animate_3d(group: str, data_type: str, animation_variable: str, filename: str, i_start=0, i_end=30, i_constant=0, colour_map_name='dark_rainbow_r_l', lim_scalar=1, ticks=1, r_density=0, c_density=0, axis_off=False, fps=15, dpi=100, bar=True, bar_scale=False, bar_colour_map_name='dark_rainbow_r', temp_rounding=0, field_rounding=0)[source]#