SystemAtom
Class Methods
|
Create a system object for a single atom. |
|
Diagonalize the Hamiltonian and update the basis to the eigenbasis. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Class Attributes and Properties
- 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(|Rb:58,S_1/2,-1/2⟩ ... |Rb:63,F_5/2,5/2⟩), 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)) – Thepairinteraction.real.BasisAtom
object that describes the basis of the system.- Return type:
None
- set_electric_field(electric_field, unit=None)[source]
- Return type:
Self
- Parameters:
self (Self)
electric_field (PlainQuantity[ndarray[tuple[int, ...], dtype[Any]]] | Collection[float | PlainQuantity[float]])
unit (str | None)
- set_magnetic_field(magnetic_field, unit=None)[source]
- Return type:
Self
- Parameters:
self (Self)
magnetic_field (PlainQuantity[ndarray[tuple[int, ...], dtype[Any]]] | Collection[float | PlainQuantity[float]])
unit (str | None)
- set_diamagnetism_enabled(enable=True)[source]
- Return type:
Self
- Parameters:
self (Self)
enable (bool)
- 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[int, ...], dtype[Any]]] | Collection[float | PlainQuantity[float]])
unit (str | None)
- set_ion_charge(charge, unit=None)[source]
- Return type:
Self
- Parameters:
self (Self)
charge (float | PlainQuantity[float])
unit (str | None)
- 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
[int
,...
],dtype
[Any
]],PlainQuantity
[ndarray
[tuple
[int
,...
],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