BasisAtom
Class Methods
|
Create a basis for a single atom. |
|
|
Return the coefficients of the basis as a sparse matrix. |
|
|
|
|
|
|
|
|
Class Attributes and Properties
The database used for this object. |
|
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 BasisAtom[source]
Basis for a single atom.
Add all KetAtom objects that match the given quantum numbers to the basis. The initial coefficients matrix is a unit matrix, i.e. the first basis state is the first ket, etc. The BasisAtom coefficients matrix will always be square, i.e. the number of kets is equal to the number of states.
Examples
>>> import pairinteraction.real as pi >>> ket = pi.KetAtom("Rb", n=60, l=0, m=0.5) >>> energy_min, energy_max = ket.get_energy(unit="GHz") - 100, ket.get_energy(unit="GHz") + 100 >>> basis = pi.BasisAtom("Rb", n=(57, 63), l=(0, 3), energy=(energy_min, energy_max), energy_unit="GHz") >>> print(basis) BasisAtom(n=(57, 63), l=(0, 3), energy=(1008911.9216, 1009111.9216), energy_unit=GHz)
- __init__(species, n=None, nu=None, l=None, s=None, j=None, f=None, m=None, energy=None, energy_unit=None, parity=None, database=None, additional_kets=None)[source]
Create a basis for a single atom.
- Parameters:
species (
str
) – The species of the atom.n (
Optional
[tuple
[int
,int
]]) – tuple of (min, max) values for this quantum number. Default None, i.e. add all available states.nu (
Optional
[tuple
[float
,float
]]) – tuple of (min, max) values for this quantum number. Default None, i.e. add all available states.l (
Optional
[tuple
[float
,float
]]) – tuple of (min, max) values for this quantum number. Default None, i.e. add all available states.s (
Optional
[tuple
[float
,float
]]) – tuple of (min, max) values for this quantum number. Default None, i.e. add all available states.j (
Optional
[tuple
[float
,float
]]) – tuple of (min, max) values for this quantum number. Default None, i.e. add all available states.f (
Optional
[tuple
[float
,float
]]) – tuple of (min, max) values for this quantum number. Default None, i.e. add all available states.m (
Optional
[tuple
[float
,float
]]) – tuple of (min, max) values for this quantum number. 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 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.parity (
Optional
[Literal
['even'
,'odd'
,'unknown'
]]) – The parity of the states to consider. Default None, i.e. add all available states.database (
Optional
[Database
]) – Which database to use. Default None, i.e. use the global database instance.additional_kets (
Optional
[list
[KetAtom
]]) – List of additional kets to add to the basis. Default None.
- Return type:
None
- get_amplitudes(other)[source]
- Return type:
Union
[ndarray
[tuple
[int
,...
],dtype
[Any
]],csr_matrix
]- Parameters:
other (KetAtom | StateAtom[Any] | Self)
- get_overlaps(other)[source]
- Return type:
Union
[ndarray
[tuple
[int
,...
],dtype
[Any
]],csr_matrix
]- Parameters:
other (KetAtom | StateAtom[Any] | Self)
- get_matrix_elements(other, operator, q, unit=None)[source]
- Return type:
Union
[ndarray
[tuple
[int
,...
],dtype
[Any
]],PlainQuantity
[ndarray
[tuple
[int
,...
],dtype
[Any
]]],csr_matrix
,PlainQuantity
[csr_matrix
]]- Parameters:
other (KetAtom | StateAtom[Any] | Self)
operator (Literal['zero', 'energy', 'electric_dipole', 'electric_quadrupole', 'electric_quadrupole_zero', 'electric_octupole', 'magnetic_dipole', 'arbitrary'])
q (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.