Skip to content

Installation

If you still want to try it out, you can install it from the Julia REPL by running:

julia
julia> import Pkg; Pkg.add("https://github.com/cevenkadir/NeuralQuantumStates.jl")

Basics

You can start to use the package by runnung:

julia
using NeuralQuantumStates: Lattices, Hilberts, Operators

As an example, let's construct the Hamiltonian of a transverse-field Ising chain. For that, first initialize a chain lattice of length 8:

julia
lat = Lattices.build(
    :Hypercube, [8], 1.0;
    periodic=[true]
)
NeuralQuantumStates.Lattices.Lattice{Int64, Float64, 1, 1}
  metagraph: MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, Tuple{Int64}, StaticArraysCore.SVector{1, Float64}, Int64, Nothing, MetaGraphsNext.var"#11#13", Float64}
  shape: StaticArraysCore.SVector{1, Int64}
  basis: NeuralQuantumStates.Lattices.LatticeBasis{Float64, 1, 1}
  periodic: StaticArraysCore.SVector{1, Bool}

Then, choose a spin-1/2 as the basis for the Hilbert space:

julia
hil = Hilberts.build(
    :Spin, 1 // 2, Lattices.nv(lat)
)
NeuralQuantumStates.Hilberts.FiniteUniformHilbert{Rational{Int64}, Array, 8, 2}
  lDoF: StaticArraysCore.SVector{2, Rational{Int64}}
  constraint: NeuralQuantumStates.Hilberts.NoDiscreteHilbertConstraint NeuralQuantumStates.Hilberts.NoDiscreteHilbertConstraint()
  type: Symbol Spin

With these two, construct the Hamiltonian operator of the model:

julia
ham = Operators.build(
    :TransverseFieldIsing, hil, lat;
    J=1.0, h_x=1.0, h_z=1.0
)
NeuralQuantumStates.Operators.TransverseFieldIsingOperator{Float64, Rational{Int64}, Array, Int64, Float64, Float64, 8, 2, 1, 1}
  hilbert: NeuralQuantumStates.Hilberts.FiniteUniformHilbert{Rational{Int64}, Array, 8, 2}
  lattice: NeuralQuantumStates.Lattices.Lattice{Int64, Float64, 1, 1}
  J: Float64 1.0
  h_x: Float64 1.0
  h_z: Float64 1.0

To test it, let's find out the connected basis configurations, s_prime, to the Hamiltonian for the following 2 basis configurations with their matrix elements, mels:

julia
s_prime, mels = Operators.connected_basis_configs(
    ham,
    [
        1//2 1//2 -1//2 1//2 -1//2 -1//2 1//2 -1//2;
        -1//2 1//2 1//2 1//2 1//2 -1//2 -1//2 -1//2;
    ]
);
julia
s_prime
9×2×8 Array{Union{Missing, Rational{Int64}}, 3}:
[:, :, 1] =
  1//2  -1//2
 -1//2   1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2

[:, :, 2] =
  1//2   1//2
  1//2   1//2
 -1//2  -1//2
  1//2   1//2
  1//2   1//2
  1//2   1//2
  1//2   1//2
  1//2   1//2
  1//2   1//2

[:, :, 3] =
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2
  1//2  -1//2
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2

[:, :, 4] =
  1//2   1//2
  1//2   1//2
  1//2   1//2
  1//2   1//2
 -1//2  -1//2
  1//2   1//2
  1//2   1//2
  1//2   1//2
  1//2   1//2

[:, :, 5] =
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2
  1//2  -1//2
 -1//2   1//2
 -1//2   1//2
 -1//2   1//2

[:, :, 6] =
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
  1//2   1//2
 -1//2  -1//2
 -1//2  -1//2

[:, :, 7] =
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
  1//2  -1//2
 -1//2   1//2
  1//2  -1//2

[:, :, 8] =
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
 -1//2  -1//2
  1//2   1//2
julia
mels
9×2 Matrix{Union{Missing, Float64}}:
 -4.0  4.0
  1.0  1.0
  1.0  1.0
  1.0  1.0
  1.0  1.0
  1.0  1.0
  1.0  1.0
  1.0  1.0
  1.0  1.0