Quantum-Many-Body / ExactDiagonalization.jl

Julia package for the exact diagonalization method in condensed matter physics.
https://quantum-many-body.github.io/ExactDiagonalization.jl/latest/
Other
35 stars 6 forks source link

More examples and documentation needed #6

Open jaredjeya opened 1 year ago

jaredjeya commented 1 year ago

I'm trying to do perhaps the simplest thing possible (diagonalisation of the spin-1/2 transverse field Ising model with a longitudinal field). I've successfully constructed the Hamiltonian using QuantumLattices. But a very simple substitution of the example code throws up an error.

Here is my code:

using QuantumLattices
using ExactDiagonalization
using LinearAlgebra: eigen

spin = Lattice([0.0]; name=:spin, vectors=[[1.0]])
spin_chain = Lattice(spin, (10,))
spin_space = Hilbert(site=>Spin{1//2}() for site=1:length(spin_chain))

J = 1
h = 1
G = 1

J_coupling = Coupling((1, 2), SID, ('x', 'x'))
J_term = SpinTerm(:J, J, 1, J_coupling)

h_coupling = Coupling((1,), SID, ('x',))
h_term = SpinTerm(:h, h, 0, h_coupling)

G_coupling = Coupling((1,), SID, ('z',))
G_term = SpinTerm(:Γ, G, 0, G_coupling)

operators = expand(OperatorGenerator((J_term, h_term, G_term), bonds(spin_chain, 1), spin_space))

spin_base = BinaryBases(10)
ed = ED(spin_chain, spin_space, (J_term, h_term, G_term), TargetSpace(spin_base))

# find the ground state and its energy
eigensystem = eigen(matrix(ed); nev=1)

print(eigensystem.values)

and I get the error "type SID has no field nambu". I have no idea what I'm doing wrong here because there's essentially no documentation for this library. Can you please help me?

andrewkhardy commented 1 year ago

I will second that in order for this library to be useful, some more examples are necessary. Here is an alternative package for tight-binding fermions I plan on using in the mean-time which might serve as an example of useful examples when constructing yours for spin-systems.