hqs_quantum_solver.spin_util

hqs_quantum_solver.spin_util#

Utility functions for working with spin systems.

Functions

pure_spin_state(spins[, Sz, mod_Sz, dtype])

Create a representation of a pure spin state for a system of spin-½ particles.

class SpinState#

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., σi{,} for i=0,,n1, this function returns a representation of the state

|σ0σ1σn1=|σ0|σ1|σn1.

Warning

The values of Sz and mod_Sz need to be the same as in the construction of the operator that this state vector should be used with.

Warning

This class is deprecated. Use the hqs_quantum_solver.spins.VectorSpace.fock_state() instead.

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