GreenTensor
Class Methods
|
Initialize a new Green tensor object. |
|
Get the Green tensor in spherical coordinates for the given indices kappa1 and kappa2. |
|
Set the entries of the Green tensor. |
- 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, omega_unit=None)[source]
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 (
Union
[ndarray
[tuple
[int
,...
],dtype
[Any
]],Sequence
[ndarray
[tuple
[int
,...
],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 (
Optional
[str
]) – The unit of the tensor. Default None, which means that the tensor must be given as pint object.omegas (
Optional
[Sequence
[float
]]) – Only needed if a list of tensors is given. The frequencies of the tensors.omega_unit (
Optional
[str
]) – 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]
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 (
Optional
[float
]) – The frequency at which to evaluate the Green tensor. Only needed if the Green tensor is frequency dependent.omega_unit (
Optional
[str
]) – The unit of the frequency. Default None, which means that the frequency must be given as pint object.unit (
Optional
[str
]) – The unit to which to convert the result. Default None, which means that the result is returned as pint object.
- Return type:
Union
[PlainQuantity
[ndarray
[tuple
[int
,...
],dtype
[Any
]]],ndarray
[tuple
[int
,...
],dtype
[Any
]]]- Returns:
The Green tensor as a 2D array.