ALPS 2 Tutorials:ED-02 Gaps

From ALPS
Jump to: navigation, search


Spin gaps of 1D quantum spin systems

In this tutorial we will learn how to use the sparse diagonalization program using the Lanczos algorithm.

Spin gap of a spin-1 chain

Using the command line

The parameter file parm2a sets up exact diagonalization of the quantum mechanical S=1 chain with 4 to 10 sites in the singlet and triplet sector

MODEL="spin"
LATTICE="chain lattice"
CONSERVED_QUANTUMNUMBERS="Sz"
local_S=1
J=1
Sz_total=0
{L=4}
{L=6}
{L=8}
{L=10}
Sz_total=1
{L=4}
{L=6}
{L=8}
{L=10}

The parameter Sz_total restricts the conserved quantum number Sz to the given value. See the model library documentation for more details on how to set up models and conserved quantum numbers.

Using the standard sequence of commands you can first convert the input parameters to XML and then run the application sparsediag:

 parameter2xml parm2a
 sparsediag --write-xml parm2a.in.xml

Evaluation of the gaps can now be done manually by looking at the output files, or we can use Python or Vistrails to automate the whole workflow.

Using Python

To set up and run the simulation in Python we use the script tutorial2a.py. The first parts of this script imports the required modules, prepares the input files as a list of Python dictionaries, writes the input files and runs the application

import pyalps
import numpy as np
import matplotlib.pyplot as plt
import pyalps.pyplot
parms = []
for l in [4, 6, 8, 10]:
  for sz in [0, 1]:
     parms.append(
       { 
         'LATTICE'                   : "chain lattice", 
         'MODEL'                     : "spin",
         'local_S'                   : 1,
         'J'                         : 1,
         'L'                         : l,
         'CONSERVED_QUANTUMNUMBERS'  : 'Sz',
         'Sz_total'                  : sz
       }
     )
input_file = pyalps.writeInputFiles('parm2a',parms)
res = pyalps.runApplication('sparsediag',input_file)

To run this, launch your python interpreter using the convenience scripts alpspython or vispython. We now have the same output files as in the command line version.

We next load the spectra for each of the systems sizes and spin sectors:

data = pyalps.loadSpectra(pyalps.getResultFiles(prefix='parm2a'))

To extract the gaps we need to write a few lines of Python, to set up a list of lengths and a Python dictionaries of the minimum energy in each (L,Sz) sector:

lengths = []
min_energies = {}
for sim in data:
  l = int(sim[0].props['L'])
  if l not in lengths: lengths.append(l)
  sz = int(sim[0].props['Sz_total'])
  all_energies = []
  for sec in sim:
    all_energies += list(sec.y)
  min_energies[(l,sz)]= np.min(all_energies)
 

And finally we make a plot of the gap as a function of 1/L and then show the plot

gapplot = pyalps.DataSet()
gapplot.x = 1./np.sort(lengths)
gapplot.y = [min_energies[(l,1)] -min_energies[(l,0)] for l in np.sort(lengths)]  
gapplot.props['xlabel']='$1/L$'
gapplot.props['ylabel']='Triplet gap $\Delta/J$'
gapplot.props['label']='S=1'
plt.figure()
pyalps.pyplot.plot(gapplot)
plt.legend()
plt.xlim(0,0.25)
plt.ylim(0,1.0)
plt.show()


Using Vistrails

To run the simulation in Vistrails open the file ed-02-gaps.vt and select the workflow "S=1 chain"

Spin gap of a spin-1/2 chain

Compare the extrapolated gap of the spin-1 chain to that of a spin-1/2 chain. To do so, just change the local spin local_S=1 to local_S=0.5 and run the simulations (but give them the name parm2b). The parameter file is parm2a, the Python script tutorial2b.py and the Vistrails workflow in the file ed-02-gaps.vt is called "S=1/2 chain".

Both systems in one plot

To show both gaps in one plot run the Python script tutorial2c.py after running the first two tutorials or run the Vistrails workflow "combined" in the file ed-02-gaps.vt

Questions

  • What is the extrapolated value of the gap for an infinite system?
  • Why do the S=1/2 and S=1 chains show different behavior?