StateAtom
Class Methods
| 
 | Initialize a state object representing a ket in a given basis. | 
| 
 | Calculate the amplitude of the state with respect to another state or ket. | 
| Return the coefficients of the state as a 1d-array. | |
| Return the ket corresponding to the state (i.e. the ket with the maximal overlap). | |
| Return the index of the ket corresponding to the state (i.e. the ket with the maximal overlap). | |
| 
 | Label representing the state. | 
| 
 | Calculate the matrix element of the operator with respect to the state and another state or ket. | 
| 
 | Calculate the overlap of the state with respect to another state or ket. | 
| 
 | Check if the state is normalized within a given tolerance. | 
| Normalize the coefficients of the state. | 
Class Attributes and Properties
| The database used for this object. | |
| Return a list containing the kets of the basis. | |
| Return the norm of the state. | |
| Return the number of kets in the basis. | |
| The atomic species. | 
- class StateAtom[source]
- State of a single atom. - A coefficient vector and a list of kets are used to represent an arbitrary single-atom state. - Examples - >>> import pairinteraction as pi >>> ket = pi.KetAtom("Rb", n=60, l=0, m=0.5) >>> basis = pi.BasisAtom("Rb", n=(57, 63), l=(0, 3)) >>> state = basis.get_corresponding_state(ket) >>> print(state) StateAtom(1.00 |Rb:60,S_1/2,1/2⟩) >>> ket2 = pi.KetAtom("Rb", n=60, l=1, j=0.5, m=0.5) >>> state2 = pi.StateAtom(ket2, basis) >>> print((2 * state2 - state).normalize()) StateAtom(0.89 |Rb:60,P_1/2,1/2⟩ + -0.45 |Rb:60,S_1/2,1/2⟩) - is_normalized(tol=1e-10)[source]
- Check if the state is normalized within a given tolerance. - Parameters:
- tol ( - float) – The tolerance for the normalization check. Default is 1e-10.
- Return type:
- bool
- Returns:
- True if the state is normalized within the given tolerance, False otherwise. 
 
 - property species: str
- The atomic species. 
 - property is_canonical: bool
 - get_amplitude(other)[source]
- Calculate the amplitude of the state with respect to another state or ket. - This means the inner product <self|other>. - Parameters:
- other ( - Union[- Self,- KetAtom]) – Either a state or a ket for which the amplitude should be calculated.
- Return type:
- float|- complex
- Returns:
- The amplitude between self and other. 
 
 - get_overlap(other)[source]
- Calculate the overlap of the state with respect to another state or ket. - This means calculate \(|\langle \mathrm{self} | \mathrm{other} \rangle|^2\). - Parameters:
- other ( - Union[- Self,- KetAtom]) – Either a state or a ket for which the overlap should be calculated.
- Return type:
- float
- Returns:
- The overlap between self and other. 
 
 - get_matrix_element(other, operator, q, unit=None)[source]
- Calculate the matrix element of the operator with respect to the state and another state or ket. - This means the inner product <self|operator|other>. - Parameters:
- other ( - Union[- KetAtom,- Self]) – Either a state or a ket for which the matrix element should be calculated.
- operator ( - Literal[- 'zero',- 'energy',- 'electric_dipole',- 'electric_quadrupole',- 'electric_quadrupole_zero',- 'electric_octupole',- 'magnetic_dipole',- 'arbitrary']) – The operator for which the matrix element should be calculated.
- q ( - int) – The projection quantum number of the operator.
- unit ( - str|- None) – The unit in which the result should be returned. Default None will return a pint.Quantity.
 
- Return type:
- Union[- PlainQuantity[- float],- PlainQuantity[- complex],- float,- complex]
- Returns:
- The matrix element between self and other. 
 
 - get_coefficients()
- Return the coefficients of the state as a 1d-array. - The coefficients are stored in a numpy.array with shape (number_of_kets,). - The coefficients are normalized, i.e. the sum of the absolute values of the coefficients is equal to 1. - Return type:
- ndarray[- tuple[- Any,- ...],- dtype[- Any]]
 
 - get_corresponding_ket()
- Return the ket corresponding to the state (i.e. the ket with the maximal overlap). - Return type:
- TypeVar(- KetType, bound= KetBase)
 
 - get_corresponding_ket_index()
- Return the index of the ket corresponding to the state (i.e. the ket with the maximal overlap). - Return type:
- int
 
 - get_label(max_kets=3)
- Label representing the state. - Parameters:
- max_kets ( - int) – Maximum number of kets to include in the label.
- Return type:
- str
- Returns:
- The label of the ket in the given format. 
 
 - property kets: list[KetType]
- Return a list containing the kets of the basis. 
 - property norm: floating
- Return the norm of the state. 
 - property number_of_kets: int
- Return the number of kets in the basis.