SystemAtom

Class Methods

__init__(basis)

Create a system object for a single atom.

diagonalize([diagonalizer, float_type, ...])

Diagonalize the Hamiltonian and update the basis to the eigenbasis.

get_corresponding_energy(ket[, unit])

get_eigenbasis()

get_eigenenergies([unit])

get_hamiltonian([unit])

set_diamagnetism_enabled([enable])

Enable or disable diamagnetism for the system.

set_distance_to_ion(distance[, ...])

set_electric_field(electric_field[, unit])

Set the electric field for the system.

set_ion_charge(charge[, unit])

set_ion_distance_vector(distance[, unit])

set_ion_interaction_order(order)

set_magnetic_field(magnetic_field[, unit])

Set the magnetic field for the system.

Class Attributes and Properties

basis

is_diagonal

matrix

class SystemAtom[source]

System of a single atom.

Use the given BasisAtom object to create the system object. You can set the electric and magnetic fields and enable diamagnetism afterwards via the corresponding methods.

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)
>>> system = system.set_magnetic_field([0, 0, 1], unit="gauss")
>>> system = system.set_electric_field([0.1, 0, 0.1], unit="V/cm")
>>> system = system.set_diamagnetism_enabled(True)
>>> print(system)
SystemAtom(BasisAtom(n=(58, 63), l=(0, 3)), is_diagonal=False)
>>> system = system.diagonalize()
>>> eigenenergies = system.get_eigenenergies(unit="GHz")
>>> print(f"{eigenenergies[0] - ket.get_energy(unit='GHz'):.5f}")
-75.51823
__init__(basis)[source]

Create a system object for a single atom.

Parameters:

basis (TypeVar(BasisType, bound= BasisAtom[Any], covariant=True)) – The pairinteraction.real.BasisAtom object that describes the basis of the system.

Return type:

None

set_electric_field(electric_field, unit=None)[source]

Set the electric field for the system.

Parameters:
  • electric_field (Union[PlainQuantity[ndarray[tuple[Any, ...], dtype[Any]]], Collection[Union[float, PlainQuantity[float]]], ndarray[tuple[Any, ...], dtype[Any]], Collection[float]]) – The electric field to set for the system.

  • unit (Optional[str]) – The unit of the electric field, e.g. “V/cm”. Default None expects a pint.Quantity.

  • self (Self)

Return type:

Self

set_magnetic_field(magnetic_field, unit=None)[source]

Set the magnetic field for the system.

Parameters:
  • magnetic_field (Union[PlainQuantity[ndarray[tuple[Any, ...], dtype[Any]]], Collection[Union[float, PlainQuantity[float]]], ndarray[tuple[Any, ...], dtype[Any]], Collection[float]]) – The magnetic field to set for the system.

  • unit (Optional[str]) – The unit of the magnetic field, e.g. “gauss”. Default None expects a pint.Quantity.

  • self (Self)

Return type:

Self

set_diamagnetism_enabled(enable=True)[source]

Enable or disable diamagnetism for the system.

Parameters:
  • enable (bool) – Whether to enable or disable diamagnetism.

  • self (Self)

Return type:

Self

set_distance_to_ion(distance, angle_degree=0, unit=None)[source]
Return type:

Self

Parameters:
  • self (Self)

  • distance (float | PlainQuantity[float])

  • angle_degree (float)

  • unit (str | None)

set_ion_distance_vector(distance, unit=None)[source]
Return type:

Self

Parameters:
  • self (Self)

  • distance (PlainQuantity[ndarray[tuple[Any, ...], dtype[Any]]] | Collection[float | PlainQuantity[float]] | ndarray[tuple[Any, ...], dtype[Any]] | Collection[float])

  • unit (str | None)

set_ion_charge(charge, unit=None)[source]
Return type:

Self

Parameters:
  • self (Self)

  • charge (float | PlainQuantity[float])

  • unit (str | None)

set_ion_interaction_order(order)[source]
Return type:

Self

Parameters:
  • self (Self)

  • order (int)

get_corresponding_energy(ket, unit=None)[source]
Return type:

Union[float, PlainQuantity[float]]

Parameters:
  • self (Self)

  • ket (KetAtom)

  • unit (str | None)

property basis: BasisType
diagonalize(diagonalizer='eigen', float_type='float64', rtol=1e-06, sort_by_energy=True, energy_range=(None, None), energy_unit=None, m0=None)

Diagonalize the Hamiltonian and update the basis to the eigenbasis.

This method diagonalizes the Hamiltonian of the system and updates the basis of the system accordingly.

Parameters:
  • systems – A list of SystemAtom or SystemPair objects.

  • diagonalizer (Literal['eigen', 'lapacke_evd', 'lapacke_evr', 'feast']) – The diagonalizer method to use. Defaults to “eigen”.

  • float_type (Literal['float32', 'float64']) – The floating point precision to use for the diagonalization. Defaults to “float64”.

  • rtol (float) – The relative tolerance allowed for eigenenergies. The error in eigenenergies is bounded by rtol * ||H||, where ||H|| is the norm of the Hamiltonian matrix. Defaults to 1e-6.

  • sort_by_energy (bool) – Whether to sort the resulting basis by energy. Defaults to True.

  • energy_range (tuple[Optional[TypeVar(Quantity, float, PintFloat)], Optional[TypeVar(Quantity, float, PintFloat)]]) – A tuple specifying an energy range, in which the eigenenergies should be calculated. Specifying a range can speed up the diagonalization process (depending on the diagonalizer method). The accuracy of the eigenenergies is not affected by this, but not all eigenenergies will be calculated. Defaults to (None, None), i.e. calculate all eigenenergies.

  • energy_unit (Optional[str]) – The unit in which the energy_range is given. Defaults to None assumes pint objects.

  • m0 (Optional[int]) – The search subspace size for the FEAST diagonalizer. Defaults to None.

Returns:

The updated instance of the system.

Return type:

Self

get_eigenbasis()
Return type:

TypeVar(BasisType, bound= BasisBase[Any, Any], covariant=True)

get_eigenenergies(unit=None)
Return type:

Union[ndarray[tuple[Any, ...], dtype[Any]], PlainQuantity[ndarray[tuple[Any, ...], dtype[Any]]]]

Parameters:

unit (str | None)

get_hamiltonian(unit=None)
Return type:

Union[csr_matrix, PlainQuantity[csr_matrix]]

Parameters:

unit (str | None)

property is_diagonal: bool
property matrix: csr_matrix