BasisPair
Class Methods
|
Create a basis for a pair of atoms. |
|
|
Return the coefficients of the basis as a sparse matrix. |
|
|
|
|
|
|
|
|
Class Attributes and Properties
Return a list containing the kets of the basis. |
|
Return the number of kets in the basis. |
|
Return the number of states in the basis. |
|
Return a list containing the states of the basis. |
- class BasisPair[source]
Basis for a pair of atoms.
Add all product states of the eigenstates of two given SystemAtom objects to the basis, which pair energy is within the given energy range. You can also specify which total magnetic quantum number m the pair should have (if it is conserved) and the product of the parities of the two atoms. Due to the possible restrictions of the basis states, the BasisPair coefficients matrix will in general not be square but (n x d), where n is the number of all involved kets (typically basis1.number_of_kets * basis2.number_of_kets) and d is the number of basis states (after applying the restrictions).
Examples
>>> import pairinteraction.real as pi >>> ket = pi.KetAtom("Rb", n=60, l=0, m=0.5) >>> basis = pi.BasisAtom("Rb", n=(58, 63), l=(0, 3)) >>> system = pi.SystemAtom(basis).set_magnetic_field([0, 0, 1], unit="G").diagonalize() >>> pair_energy = 2 * system.get_corresponding_energy(ket, unit="GHz") >>> pair_basis = pi.BasisPair( ... [system, system], ... energy=(pair_energy - 3, pair_energy + 3), ... energy_unit="GHz", ... ) >>> print(pair_basis) BasisPair(|Rb:59,S_1/2,-1/2; Rb:61,S_1/2,-1/2⟩ ... |Rb:58,F_7/2,7/2; Rb:59,S_1/2,1/2⟩)
- __init__(systems, m=None, product_of_parities=None, energy=None, energy_unit=None)[source]
Create a basis for a pair of atoms.
- Parameters:
systems (
Collection
[SystemAtom
[Any
]]) – tuple of two SystemAtom objects, which define the two atoms, from which the BasisPair is build. Both systems have to be diagonalized before creating the BasisPair.m (
Optional
[tuple
[float
,float
]]) – tuple of (min, max) values for the total magnetic quantum number m of the pair state. Default None, i.e. no restriction.product_of_parities (
Optional
[Literal
['even'
,'odd'
,'unknown'
]]) – The product parity of the states to consider. Default None, i.e. add all available states.energy (
Union
[tuple
[float
,float
],tuple
[PlainQuantity
[float
],PlainQuantity
[float
]],None
]) – tuple of (min, max) value for the pair energy. Default None, i.e. add all available states.energy_unit (
Optional
[str
]) – In which unit the energy values are given, e.g. “GHz”. Default None, i.e. energy is provided as pint object.
- Return type:
None
- get_amplitudes(other)[source]
- Return type:
Union
[ndarray
[tuple
[int
,...
],dtype
[Any
]],csr_matrix
]- Parameters:
other (KetPairReal | KetPairComplex | tuple[KetAtom, KetAtom] | Sequence[KetAtom] | BasisPairReal | BasisPairComplex | tuple[BasisAtomReal, BasisAtomReal] | Sequence[BasisAtomReal] | tuple[BasisAtomComplex, BasisAtomComplex] | Sequence[BasisAtomComplex])
- get_overlaps(other)[source]
- Return type:
Union
[ndarray
[tuple
[int
,...
],dtype
[Any
]],csr_matrix
]- Parameters:
other (KetPairReal | KetPairComplex | tuple[KetAtom, KetAtom] | Sequence[KetAtom] | BasisPairReal | BasisPairComplex | tuple[BasisAtomReal, BasisAtomReal] | Sequence[BasisAtomReal] | tuple[BasisAtomComplex, BasisAtomComplex] | Sequence[BasisAtomComplex])
- get_matrix_elements(other, operators, qs, unit=None)[source]
- Return type:
Union
[ndarray
[tuple
[int
,...
],dtype
[Any
]],PlainQuantity
[ndarray
[tuple
[int
,...
],dtype
[Any
]]],csr_matrix
,PlainQuantity
[csr_matrix
]]- Parameters:
other (KetPairReal | KetPairComplex | tuple[KetAtom, KetAtom] | Sequence[KetAtom] | BasisPairReal | BasisPairComplex | tuple[BasisAtomReal, BasisAtomReal] | Sequence[BasisAtomReal] | tuple[BasisAtomComplex, BasisAtomComplex] | Sequence[BasisAtomComplex])
operators (tuple[Literal['zero', 'energy', 'electric_dipole', 'electric_quadrupole', 'electric_quadrupole_zero', 'electric_octupole', 'magnetic_dipole', 'arbitrary'], ~typing.Literal['zero', 'energy', 'electric_dipole', 'electric_quadrupole', 'electric_quadrupole_zero', 'electric_octupole', 'magnetic_dipole', 'arbitrary']])
qs (tuple[int, int])
unit (str | None)
- get_coefficients()
Return the coefficients of the basis as a sparse matrix.
The coefficients are stored in a sparse matrix with shape (number_of_kets, number_of_states), where the first index correspond to the kets and the second index correspond to the states. For example basis.get_coefficients()[i, j] is the i-th coefficient (i.e. the coefficient corresponding to the i-th ket) of the j-th state.
The coefficients are normalized, i.e. the sum of the absolute values of the coefficients in each row is equal to 1.
- Return type:
csr_matrix
- get_corresponding_ket(state)
- Return type:
TypeVar
(KetType
, bound= KetBase, covariant=True)- Parameters:
self (Self)
state (StateBase[Any, Any])
- get_corresponding_ket_index(state)
- Return type:
int
- Parameters:
state (StateBase[Any, Any])
- get_corresponding_state(ket)
- Return type:
TypeVar
(StateType
, bound= StateBase[Any, Any], covariant=True)- Parameters:
ket (KetBase)
- get_corresponding_state_index(ket)
- Return type:
int
- Parameters:
ket (KetBase)
- property kets: list[KetType]
Return a list containing the kets of the basis.
- property number_of_kets: int
Return the number of kets in the basis.
- property number_of_states: int
Return the number of states in the basis.
- property states: list[StateType]
Return a list containing the states of the basis.