GreenTensor
Class Methods
|
Initialize a new Green tensor object. |
|
|
|
- class GreenTensor[source]
Green tensor for the multipole pair interactions.
This class allows to define custom constant or frequency-dependent Green tensors, which can then be used for the interaction of a
SystemPair(seeSystemPair.set_green_tensor()).Examples
>>> import pairinteraction.real as pi >>> gt = GreenTensorReal() >>> distance_mum = 5 >>> tensor = np.array([[1, 0, 0], [0, 1, 0], [0, 0, -2]]) / distance_mum**3 >>> tensor_unit = "hartree / (e^2 micrometer^3)" >>> gt.set_from_cartesian(1, 1, tensor, tensor_unit) >>> print(gt.get_spherical(1, 1, unit=tensor_unit).diagonal()) [ 0.008 -0.016 0.008]
- __init__()[source]
Initialize a new Green tensor object.
The actual tensor can be set afterwards via the
set_from_cartesian()method.- Return type:
None
- set_from_cartesian(kappa1, kappa2, tensor, tensor_unit=None, omegas=None, omegas_unit=None)[source]
- Overloads:
self, kappa1 (int), kappa2 (int), tensor (NDArray), tensor_unit (Optional[str]) → None
self, kappa1 (int), kappa2 (int), tensor (Sequence[‘NDArray’]), tensor_unit (Optional[str]), omegas (Sequence[float]), omegas_unit (Optional[str]) → None
self, kappa1 (int), kappa2 (int), tensor (Sequence[‘NDArray’]), omegas (Sequence[float]), omegas_unit (Optional[str]) → None
- Parameters:
kappa1 (int)
kappa2 (int)
tensor (ndarray[tuple[Any, ...], dtype[Any]] | Sequence[ndarray[tuple[Any, ...], dtype[Any]]])
tensor_unit (str | None)
omegas (Sequence[float] | None)
omegas_unit (str | None)
- Return type:
None
Set the entries of the Green tensor.
- Parameters:
kappa1 (
int) – The rank of the first multipole operator.kappa2 (
int) – The rank of the second multipole operator.tensor (
ndarray[tuple[Any,...],dtype[Any]] |Sequence[ndarray[tuple[Any,...],dtype[Any]]]) – The green tensor in cartesian coordinates. Either a single tensor to set a constant green tensor or a list of tensors to set a frequency-dependent green tensor.tensor_unit (
str|None) – The unit of the tensor. Default None, which means that the tensor must be given as pint object.omegas (
Sequence[float] |None) – Only needed if a list of tensors is given. The frequencies of the tensors.omegas_unit (
str|None) – The unit of the frequencies. Default None, which means that the frequencies must be given as pint object.
- Return type:
None
- get_spherical(kappa1, kappa2, omega=None, omega_unit=None, unit=None)[source]
- Overloads:
self, kappa1 (int), kappa2 (int), omega (Optional[float]), omega_unit (Optional[str]), unit (None) → PintArray
self, kappa1 (int), kappa2 (int), omega (Optional[float]), omega_unit (Optional[str]), unit (str) → NDArray
- Parameters:
kappa1 (int)
kappa2 (int)
omega (float | None)
omega_unit (str | None)
unit (str | None)
- Return type:
PlainQuantity[ndarray[tuple[Any, …], dtype[Any]]] | ndarray[tuple[Any, …], dtype[Any]]
Get the Green tensor in spherical coordinates for the given indices kappa1 and kappa2.
For kappa == 1 the spherical basis is [p_{1,-1}, p_{1,0}, p_{1,1}]. For kappa == 2 the spherical basis is [p_{2,-2}, p_{2,-1}, p_{2,0}, p_{2,1}, p_{2,2}, p_{0,0}].
- Parameters:
kappa1 (
int) – The rank of the first multipole operator.kappa2 (
int) – The rank of the second multipole operator.omega (
float|None) – The frequency at which to evaluate the Green tensor. Only needed if the Green tensor is frequency dependent.omega_unit (
str|None) – The unit of the frequency. Default None, which means that the frequency must be given as pint object.unit (
str|None) – The unit to which to convert the result. Default None, which means that the result is returned as pint object.
- Returns:
The Green tensor as a 2D array.
- Return type:
PlainQuantity[ndarray[tuple[Any, …], dtype[Any]]] | ndarray[tuple[Any, …], dtype[Any]]