StateAtom

Class Methods

__init__(ket, basis)

Initialize a state object representing a ket in a given basis.

get_amplitude(other)

Calculate the amplitude of the state with respect to another state or ket.

get_coefficients()

Return the coefficients of the state as a 1d-array.

get_corresponding_ket()

Return the ket corresponding to the state (i.e. the ket with the maximal overlap).

get_corresponding_ket_index()

Return the index of the ket corresponding to the state (i.e. the ket with the maximal overlap).

get_label([max_kets])

Label representing the state.

get_matrix_element(other, operator, q[, unit])

Calculate the matrix element of the operator with respect to the state and another state or ket.

get_overlap(other)

Calculate the overlap of the state with respect to another state or ket.

is_normalized([tol])

Check if the state is normalized within a given tolerance.

normalize()

Normalize the coefficients of the state.

Class Attributes and Properties

database

The database used for this object.

is_canonical

kets

Return a list containing the kets of the basis.

norm

Return the norm of the state.

number_of_kets

Return the number of kets in the basis.

species

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.real 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⟩)
__init__(ket, basis)[source]

Initialize a state object representing a ket in a given basis.

Parameters:
  • ket (KetAtom) – The ket to represent in the state.

  • basis (TypeVar(BasisType, bound= BasisAtom[Any], covariant=True)) – The basis to which the state belongs.

Return type:

None

normalize()[source]

Normalize the coefficients of the state.

Return type:

Self

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 database: Database

The database used for this object.

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:

Union[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:

Union[float, complex]

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 (Optional[str]) – 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, covariant=True)

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.

Return type:

str

Returns:

The label of the ket in the given format.

Parameters:

max_kets (int)

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.