hqs_quantum_solver.spin_util#
Utility functions for working with spin systems.
Functions
|
Create a representation of a pure spin state for a system of spin-½ particles. |
Classes
|
The two states of a spin-½ particle. |
- class SpinState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
The two states of a spin-½ particle.
- DOWN = 1#
‘Down’ spin state.
- UP = 2#
‘Up’ spin state.
- pure_spin_state(spins: list[SpinState], Sz: int | None = None, mod_Sz: int = 2, dtype: type = np.complex128) ndarray #
Create a representation of a pure spin state for a system of spin-½ particles.
Given a list of single-spin states, i.e., \(\sigma_i \in \{ \downarrow, \uparrow \}\) for \(i = 0, \dots, n-1\), this function returns a representation of the state
\[\ket{\sigma_0 \, \sigma_1 \cdots \sigma_{n-1}} = \ket{\sigma_0} \otimes \ket{\sigma_1} \otimes \cdots \otimes \ket{\sigma_{n-1}} \,.\]Warning
The values of
Sz
andmod_Sz
need to be the same as in the construction of the operator that this state vector should be used with.- Parameters:
spins (list[SpinState]) – The list of single-particle spin states.
Sz (Optional[int]) – The total spin polarization in the z-axis, Sz, in units of ħ/2.
abs(Sz)
must be less than or equal to the number of sites.mod_Sz (int) – Integer representing the extent of Sz violations allowed (in modular arithmetic).
dtype (type) – The datatype of the state vector to be returned.
- Returns:
The state vector.
- Return type:
ndarray