Difference between revisions of "ALPS 2 Tutorials:ED-06 FullDiagonalization"
(→Using Python) |
|||
Line 1: | Line 1: | ||
+ | {{Languages|ALPS_2_Tutorials:ED-06_FullDiagonalization}} | ||
+ | |||
+ | |||
'''Full Diagonalization of a Quantum Hamiltonian''' | '''Full Diagonalization of a Quantum Hamiltonian''' | ||
Revision as of 08:10, 12 March 2012
Languages: |
English • 日本語 (ja) • 繁體中文 (zh-tw) • 简体中文 (zh) |
Full Diagonalization of a Quantum Hamiltonian
In this tutorial we will use the fulldiag application to calculate the full spectrum of quantum chains and from it thermodynamic quantities.
Contents
Thermodynamics for one-dimensional spin models
The spin-1 Heisenberg chain
Our first simulation will be for a spin-1 Heisenberg quantum antiferromagnetic chain.
Using the command line
The parameter file parm6a sets up a full diagonalization for a spin-1 Heisenberg quantum antiferromagnet on a one-dimensional chain with 8 sites.
LATTICE="chain lattice" MODEL="spin" local_S = 1 J = 1 CONSERVED_QUANTUMNUMBERS="Sz" {L = 8}
The CONSERVED_QUANTUMNUMBERS parameter helps fulldiag split the Hilbert space into invariant subspaces and diagonalize them separately.
Using the standard sequence of commands you can first convert the input parameters to XML and then compute the full spectrum of this quantum Hamiltonian using fulldiag:
parameter2xml parm1 fulldiag --write-xml parm1.in.xml
The output file now contains all the eigenvectors and you can produce XML plot files for the thermodynamic and magnetic observables using fulldiag_evaluate:
Now you can produce XML plot files for the thermodynamic and magnetic observables using fulldiag_evaluate:
fulldiag_evaluate --T_MIN 0.1 --T_MAX 10 --DELTA_T 0.1 parm6a.task1.out.xml
This will generate the following XML plot files:
parm6a.task1.plot.energy.xml parm6a.task1.plot.free_energy.xml parm6a.task1.plot.entropy.xml parm6a.task1.plot.specific_heat.xml parm6a.task1.plot.uniform_susceptibility.xml parm6a.task1.plot.magnetization.xml
To extract the calculated results from the XML plot files generated by qwl_evaluate, you can use the plot2text tool, and then view this data with your favorite plotting tool. For example, to extact the data of the energy density vs. temperature, use
plot2text parm1.task1.plot.energy.xml
In a similar way, you can extract the data from the other XML plot files.
When Grace is your favorite plotting tool, you can also directly generate a Grace project file from the XML plot file using the plot2xmgr tool. For example, to generate a Grace project file of the energy vs. temperature, use
plot2xmgr parm1.task1.plot.energy.xml > energy.agr
Similarly the tool plot2gp produces Gnuplot scripts and plot2text converts the file to plain text. However, the preferred method for data evaluation and plotting is using Python.
Using Python
To set up and run the simulation in Python we use the script tutorial6a.py. The first parts of this script imports the required modules and then prepares the input files as a list of Python dictionaries, and then runs the simulation
import pyalps import matplotlib.pyplot as plt import pyalps.pyplot import numpy as np
parms = [{ 'LATTICE' : "chain lattice", 'MODEL' : "spin", 'CONSERVED_QUANTUMNUMBERS' : 'Sz', 'local_S' : 1, 'J' : 1, 'L' : 8 }]
input_file = pyalps.writeInputFiles('parm6a',parms) res = pyalps.runApplication('fulldiag',input_file)
We next run the evaluation program on all output files
data = pyalps.evaluateFulldiagVersusT(pyalps.getResultFiles(prefix='parm6a'),DELTA_T=0.1, T_MIN=0.1, T_MAX=10.0)
and finally show all the plots:
for s in pyalps.flatten(data): plt.figure() plt.title("Antiferromagnetic Heisenberg chain") pyalps.pyplot.plot(s) plt.show()
Using Vistrails
To run the simulation in Vistrails open the file ed-06-fulldiag.vr and look at the workflow labeled "antiferromagnetic chain". Click on "Execute" to prepare the input file, run the simulation and create the output figure.
Exercises
- Repeat the computation of the susceptibility, but for L=9 (this will take a few minutes, use L=7 if you are impatient), and compare the result with the one for L=8 ! Recall that all steps starting with parameter2xml ... must be repeated.
- Give a rough estimate of the temperature range in which one may use the finite-size result for an infinite chain.
The spin-1/2 Heisenberg ladder
We now change the model to a ladder of length L=6, setting the parameter LATTICE to "ladder" and the couplings J0 and J1 to 1. The parameters are in parm6b, the Python script in tutorial6b.py and the Vistrails workflow is in ed-06-fulldiag.vt.
Exercises
- Discuss the position of the maximum of the specific heat (hint: the infinite ladder has a gap of approximately J/2) !
- Repeat this computation for 7 rungs (or 5 rungs, if you are impatient).
- What can you infer from the comparison about the temperature range where the finite-size results are a good approximation to the infinite system ?
Remarks: If you are familiar with Quantum Monte Carlo (QMC) simulations, you will know that larger systems can be treated and hence better approximations to the thermodynamic limit obtained. (Try it ! You may find that it is in fact not so easy to do better with QMC than with full diagonalization for the above examples.)
Exact diagonalization definitely remains the method of choice under certain conditions. Firstly, if the system is intrinsically finite (and possibly small), full diagonalization yields the exact result at once. Secondly, exact diagonalization does not suffer from the sign problem such that it can also be used for fermionic or frustrated models without any additional constraint. Both conditions are simultaneously satisfied in the models for magnetic molecules which will be discussed in the second part.
Thermodynamics of magnetic molecules
We will now use fulldiag to simulate the exact thermodynamics of small spin clusters, by calculating their complete spectrum.
Two coupled dimers
Setting up a custom lattice/graph and model
Consider the following system of two coupled dimers:
First, we need a graph to represent this problem. This is defined by the following entry in the file dd-graph.xml:
<GRAPH name="double dimer" vertices="4"> <VERTEX id="1" type="0"></VERTEX> <VERTEX id="2" type="0"></VERTEX> <VERTEX id="3" type="1"></VERTEX> <VERTEX id="4" type="1"></VERTEX> <EDGE type="0" source="1" target="2"/> <EDGE type="0" source="3" target="4"/> <EDGE type="1" source="1" target="3"/> <EDGE type="1" source="1" target="4"/> <EDGE type="1" source="2" target="3"/> <EDGE type="1" source="2" target="4"/> </GRAPH>
Then we also want to assign different Heisenberg exchanges J0 and J1 to the edges of type 0 and 1, respectively. This is achieved by the following entry in the file model-dspin.xml:
<HAMILTONIAN name="dimerized spin"> <PARAMETER name="J" default="1"/> <PARAMETER name="h" default="0"/> <BASIS ref="spin"/> <SITETERM site="i"> <PARAMETER name="h#" default="h"/> -h#*Sz(i) </SITETERM> <BONDTERM source="i" target="j"> <PARAMETER name="J#" default="J"/> J#*Sz(i)*Sz(j)+J#/2*(Splus(i)*Sminus(j)+Sminus(i)*Splus(j)) </BONDTERM> </HAMILTONIAN>
Note that we do not really need this definition since the ,,spin" Hamiltonian in the default models.xml file already contains suitable definitions. Nevertheless, the above example illustrates how to automatically assign exchange constants Jn to a bond of type n, using the hash symbol (#).
In passing we have also assigned different types to vertices 1,2 and 3,4. Therefore, we are able to assign different local spins to the upper and lower dimer by specifying the corresponding values via local_S0 and local_S1, respectively.
We will now compute the magnetization curve for local spins S_{0}=1 (upper dimer) and S_{1}=1/2 (lower dimer), J_{0}=1, J_{1}=0.4 at a temperature T=0.02.
Using the command line
The parameter file parm6c sets up the simulation:
LATTICE="double dimer" MODEL="dimerized spin" LATTICE_LIBRARY="dd-graph.xml" MODEL_LIBRARY="model-dspin.xml" local_S0=1 local_S1=1/2 J0 = 1 J1 = 0.4 h = 0 CONSERVED_QUANTUMNUMBERS="Sz" {T = 0.02}
Note the new parameters LATTICE_LIBRARY and MODEL_LIBRARY that point to the files containing our custom lattice and model.
The computation is performed with the following sequence of commands:
parameter2xml parm3 fulldiag parm3.in.xml fulldiag_evaluate --H_MIN 0 --H_MAX 4 --DELTA_H 0.025 --versus h parm3.task1.out.xml
Note that here we have used fulldiag_evaluate with commandline arguments to specify a magnetic field range. In particular the commandline argument --versus h puts the magnetic field on the x-axis rather than temperature, as in the previous examples.
Using Python or Vistrails
In both Python and Vistrails we need to prepare the same lattice and model file, and the rest is as usual. The Python script is tutorialcb.py and the Vistrails workflow is in ed-06-fulldiag.vt.
Note that in Vistrails we have two different versions. In one version we create a lattice and model file locally through a Vistrails module. In the other one we download the files from the web.
Question
- Plot and interpret the result!
Hint: The spectrum of of two coupled S_{0}=1 and S_{1}=1/2 dimers can be found analytically. The energies are (with some degeneracies):
- -11J_{0}/4, -3J_{0}/4-2J_{1} for total spin S_{total}=0;
- -7J_{0}/4, -3J_{0}/4-J_{1}, 5J_{0}/4-3J_{1} for S_{total}=1;
- -3J_{0}/4+J_{1}, J_{0}/4, 5J_{0}/4-J_{1} for S_{total}=2;
- 5J_{0}/4+2J_{1} for S_{total}=3.
The molecular complex V_{15}
The final example is a simplified model for the molecular complex V_{15} which consists of 15 spins 1/2 coupled in the following manner:
The associated graph is defined in v15-graph.xml.
For the simulations we will make the simplifying assumption of equal Heisenberg exchange J along all edges. Running the simulations now proceeds as above. The parameters are in parm6d, the Python script in tutorial6d.py and the Vistrails workflow is in ed-06-fulldiag.vt.
Question
- How do you explain the low-temperature behavior of the magnetic susceptibility?
Note that this computation is already a bit challenging and will take a while. So, it may be a good idea to have a break before you come back and look at the result.
Additional Exercises
Hubbard model on a square lattice
- Set up a parameter file for the Hubbard model on a square lattice.
- Find the lattice that you would like to use. You could use either a square lattice or a chain. Pay attention to the boundary conditions!
- Find the Hubbard model in the model library. Make sure you understand its terms.
- Switch on the symmetries: conserved are momenta (in x and y direction) and particles.
- Pick trial parameters that you can check (e.g. t=0, or U=0), and run the simulation.
- How would you introduce a t'?
© 2004-2010 by Andreas Honecker, Emanuel Gull, and Matthias Troyer