API Reference

Models

OpenSpinDynamics.SpinModels.SpinModelType
SpinModel(N; Jxy=1.0, Jz=1.0, hx=zeros(N), hz=zeros(N), Jmn=zeros(N, N))

Construct a quantum spin model.

Arguments

  • N: Number of spins.

Keywords

  • Jxy: XY coupling strength.
  • Jz: Ising coupling strength.
  • hx: Local x-fields.
  • hz: Local z-fields.
  • Jmn: Coupling matrix.

Returns

A SpinModel containing the Hamiltonian and model parameters.

source
OpenSpinDynamics.SpinModels.update_model!Function
update_model!(model::SpinModel, Jxy::Float64, Jz::Float64; kwargs...)

Updates the Hamiltonian of an existing SpinModel object with new parameters.

Arguments:

  • model: The SpinModel instance to update.
  • Jxy: XY coupling constant.
  • Jz: Z coupling constant.

Keyword arguments:

  • hx: New magnetic field in the x-direction.
  • hz: New magnetic field in the z-direction.
  • Jmn: New coupling matrix.

Returns: Nothing. Modifies the SpinModel in place.

source

Initial states

OpenSpinDynamics.QuantumState.neel_stateFunction
neel_state(N; direction=:z)

Construct a normalized Néel product state for N spins.

The first spin points along the positive direction, followed by alternating spins. direction may be :z or :x.

source

Time evolution

OpenSpinDynamics.evolveFunction
evolve(model, ψ0, time_points, observables; kwargs...)

Evolve a pure state under a SpinModel.

Supported methods:

  • :krylov
  • :arnoldi
  • :trajectories
source
evolve(model, ρ0, time_points, observables; lindblad_ops, method=:expm)

Evolve a density matrix under Lindblad dynamics.

Supported methods:

  • :expm
  • :ode
source

Spin operators

OpenSpinDynamics.Operators.SpinOperatorsType
SpinOperators

Collection of single-site spin operators for an N-spin Hilbert space.

The fields contain sparse operators acting on the full Hilbert space:

  • x[i]: Pauli $σ_x$ operator acting on site i.
  • z[i]: Pauli $σ_z$ operator acting on site i.
  • plus[i]: raising operator $σ_+$ acting on site i.
  • minus[i]: lowering operator $σ_-$ acting on site i.
source
OpenSpinDynamics.Operators.spin_operatorsFunction
spin_operators(N::Int)

Construct single-site spin operators for an N-spin system.

Returns a SpinOperators object containing the $σ_x$, $σ_z$, $σ_+$, and $σ_-$ operators for every site, represented as sparse matrices on the full $2^N$-dimensional Hilbert space.

Arguments

  • N: Number of spins. Must be positive.

Example

ops = spin_operators(4)

ops.z[1]
ops.plus[2]
source

Couplings

OpenSpinDynamics.Coupling.LongRangeCouplingDisorderType
LongRangeCouplingDisorder

Random long-range power-law coupling between N spins distributed over a lattice of size L.

Couplings decay with distance as

\[J_{ij} = \frac{1}{|r_i-r_j|^\alpha}.\]

The generated coupling matrix is symmetric with zero diagonal.

Fields

  • matrix: Coupling matrix.
  • α: Power-law exponent.
  • L: Lattice size.
  • N: Number of spins.
  • reordered: Whether sampled sites are reordered.
source