SystemPair
Class Methods
|
Create a system object for a pair of atoms. |
|
Diagonalize the Hamiltonian and update the basis to the eigenbasis. |
|
|
|
|
|
|
|
|
|
Set the distance between the atoms using the specified distance and angle. |
|
Set the distance vector between the atoms. |
|
Class Attributes and Properties
- class SystemPair[source]
System of a pair of atoms.
Use the given BasisPair object to create the system object. You can set the distance (vector) between the atoms 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).set_electric_field([0.1, 0, 0.1], unit="V/cm").diagonalize() >>> system = pi.SystemAtom(basis).set_magnetic_field([0, 0, 1], unit="G").diagonalize() >>> pair_energy = 2 * system.get_corresponding_energy(ket, unit="GHz") >>> pair_basis = pi.BasisPair( ... [system, system], ... energy=(pair_energy - 3, pair_energy + 3), ... energy_unit="GHz", ... ) >>> pair_system = pi.SystemPair(pair_basis).set_distance(5, unit="micrometer").set_interaction_order(3) >>> print(pair_system) SystemPair(BasisPair(|Rb:59,S_1/2,-1/2; Rb:61,S_1/2,-1/2⟩ ... |Rb:58,F_7/2,7/2; Rb:59,S_1/2,1/2⟩), is_diagonal=False) >>> pair_system = pair_system.diagonalize() >>> eigenenergies = pair_system.get_eigenenergies(unit="GHz") >>> print(f"{eigenenergies[0] - pair_energy:.5f}") -2.18361
- __init__(basis)[source]
Create a system object for a pair of atoms.
- Parameters:
basis (
TypeVar
(BasisType
, bound= BasisPair[Any, Any], covariant=True)) – Thepairinteraction.real.BasisPair
object that describes the basis of the system.- Return type:
None
- set_distance(distance, angle_degree=0, unit=None)[source]
Set the distance between the atoms using the specified distance and angle.
- Parameters:
distance (
Union
[float
,PlainQuantity
[float
]]) – The distance to set between the atoms in the given unit.angle_degree (
float
) – The angle between the distance vector and the z-axis in degrees. 90 degrees corresponds to the x-axis. Defaults to 0, which corresponds to the z-axis.unit (
Optional
[str
]) – The unit of the distance. Default None expects a pint.Quantity.self (Self)
- Return type:
Self
- set_distance_vector(distance, unit=None)[source]
Set the distance vector between the atoms.
- Parameters:
distance (
Union
[PlainQuantity
[ndarray
[tuple
[int
,...
],dtype
[Any
]]],Collection
[Union
[float
,PlainQuantity
[float
]]]]) – The distance vector to set between the atoms in the given unit.unit (
Optional
[str
]) – The unit of the distance. Default None expects a pint.Quantity.self (Self)
- Return type:
Self
- get_distance_vector(unit=None)[source]
- Return type:
Union
[list
[float
],list
[PlainQuantity
[float
]]]- Parameters:
unit (str | None)
- get_distance(unit=None)[source]
- Return type:
Union
[float
,PlainQuantity
[float
]]- Parameters:
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