magnopy.get_equivalent_parameters#

magnopy.get_equivalent_parameters(nus, alphas, parameter=None)[source]#

Computes equivalent parameters as described in supplementary information of paper about Magnopy (eqs. S.21-S.27).

The returned list of parameters is sorted in descending order by the indices (nus and alphas).

Parameters:
nuslist of tuples

List of n-1 unit cell indices associated with the parameter. Each unit cell index is a tuple of three integers.

alphaslist of tuples

List of n atom indices associated with the parameter. Each atom index is an integer.

parameter(3, ..., 3) array-like, optional

Value of the parameter. The shape of the array should be (3, ..., 3) with n dimensions. If not provided, then the returned parameters will have None as the value.

Returns:
parameterslist of tuples

List of equivalent parameters. Each parameter is a tuple of the form (nus, alphas, parameter) where nus and alphas are the unit cell and atom indices of the parameter, respectively, and parameter is the value of the parameter (or None if not provided).

Notes

See Equivalent parameters for more details.

Examples

>>> import magnopy
>>> eq_params = magnopy.get_equivalent_parameters(
...     nus=[(1, 0, 0)],
...     alphas=[(0,), (1,)],
...     parameter=[[0, -1, 0], [0.5, 0.3, 0], [0, 0, 0]],
... )
>>> for nus, alphas, parameter in eq_params:
...     print(nus, alphas)
...     print(parameter)
((1, 0, 0),) ((0,), (1,))
[[ 0.  -1.   0. ]
 [ 0.5  0.3  0. ]
 [ 0.   0.   0. ]]
((-1, 0, 0),) ((1,), (0,))
[[ 0.   0.5  0. ]
 [-1.   0.3  0. ]
 [ 0.   0.   0. ]]
>>> import magnopy
>>> eq_params = magnopy.get_equivalent_parameters(
...     nus=[(1, 0, 0), (0, 1, 0)], alphas=[(0,), (1,), (2,)], parameter=None
... )
>>> for nus, alphas, parameter in eq_params:
...     print(nus, alphas)
((1, 0, 0), (0, 1, 0)) ((0,), (1,), (2,))
((1, -1, 0), (0, -1, 0)) ((2,), (1,), (0,))
((0, 1, 0), (1, 0, 0)) ((0,), (2,), (1,))
((0, -1, 0), (1, -1, 0)) ((2,), (0,), (1,))
((-1, 1, 0), (-1, 0, 0)) ((1,), (2,), (0,))
((-1, 0, 0), (-1, 1, 0)) ((1,), (0,), (2,))