Commit 1a691aa7 authored by Jefferson Stafusa E. Portela's avatar Jefferson Stafusa E. Portela
Browse files

Add Exercise 1 of Part II. Some cleanup.

parent 83e5406c
%!PS-Adobe-2.0 EPSF-2.0
%%Title: Ladder.eps
%%Creator: gnuplot 5.2 patchlevel 6
%%CreationDate: Tue Aug 20 18:43:37 2019
%%Creator: gnuplot 5.2 patchlevel 8
%%CreationDate: Fri Sep 18 05:10:16 2020
%%DocumentFonts: (atend)
%%BoundingBox: 50 50 338 251
......@@ -478,10 +478,10 @@ systemdict /pdfmark known not {
SDict begin [
/Title (Ladder.eps)
/Subject (gnuplot plot)
/Creator (gnuplot 5.2 patchlevel 6)
/Creator (gnuplot 5.2 patchlevel 8)
% /Producer (gnuplot)
% /Keywords ()
/CreationDate (Tue Aug 20 18:43:37 2019)
/CreationDate (Fri Sep 18 05:10:16 2020)
/DOCINFO pdfmark
} ifelse
......@@ -745,7 +745,7 @@ Z stroke
LCb setrgbcolor
LCb setrgbcolor
162 2033 M
171 2033 M
currentpoint gsave translate -270 rotate 0 0 moveto
[ [(Times-Roman) 180.0 0.0 true true 0 (S\(r,0\))]
] -60.0 MCshow
......@@ -765,6 +765,7 @@ LCb setrgbcolor
[(Times-Roman) 180.0 0.0 true true 0 (t=10, U/t=4 )]
] -60.0 MCshow
/Times-Roman findfont 180 scalefont setfont
% Begin plot #1
1.000 UP
1.000 UL
......@@ -297,9 +297,9 @@ git clone
\exerciseitem{Modifying the hopping}
Here we will modify the code so as to allow for different hopping matrix elements along the $x$ and $y$ directions of a square lattice. To do so we start from the module \texttt{Hamiltonian\_Hubbard\_Plain\_Vanilla\_mod.F90} found in \texttt{<ALF\_DIR>/Prog/Hamiltonians/}, which we will simply call ``\texttt{Vanilla}'', and then:
\item Declare a new variable, \texttt{Ham\_Ty}, in the module's specification (just search for the declaration of \texttt{Ham\_T} in \texttt{Vanilla}).
\item Add \texttt{Ham\_Ty} to the \texttt{VAR\_Hubbard\_Plain\_Vanilla} name space in the parameter file \texttt{parameters}.
\item Add this variable also to the name space (\texttt{namelist}) declaration at the \texttt{Ham\_Set} subroutine of \texttt{Vanilla}.
\item Declare a new variable, \texttt{Ham\_Ty}, in the module's specification (just search for the declaration of \texttt{Ham\_T} in \texttt{Vanilla}).
\item Add \texttt{Ham\_Ty} to the \texttt{VAR\_Hubbard\_Plain\_Vanilla} name space (\texttt{namelist}) declaration at the \texttt{Ham\_Set} subroutine of \texttt{Vanilla}.
\item Modify the hopping matrix in the subroutine \texttt{Ham\_Hop} in \texttt{Vanilla}:
Do I = 1,Latt%N
......@@ -320,18 +320,26 @@ Do I = 1,Latt%N
Note: If you'd like to run the simulation using MPI, you should also add the broadcasting call for \texttt{Ham\_Ty} to \texttt{Ham\_Set}.
Note: If you'd like to run the simulation using MPI, you should also add the broadcasting call for \texttt{Ham\_Ty} to \texttt{Ham\_Set}. It is a good idea as well to include the new variable to the simulation parameters written into the file \texttt{info}, also in \texttt{Ham\_Set}.
\red{[NOT yet done.]} In the directory \texttt{Solutions/Exercise\_2} we have duplicated the ALF and commented the changes that have to be carried out to the file \texttt{Hamiltonian\_Hubbard\_Plain\_Vanilla\_mod.F90} in the \texttt{Prog} directory.
In the directory \texttt{Solutions/Exercise\_1} we have duplicated ALF's code and commented the changes that have to be carried out to the file \texttt{Hamiltonian\_Hubbard\_Plain\_Vanilla\_mod.F90} in the \texttt{Prog} directory. The solution directory also includes reference data and the necessary \texttt{Start} directory (remember to copy its contents to every new \texttt{Run} directory, and to have a different \texttt{Run} directory for each simulationi).
As an application of this code, one can consider a 2-leg ladder system defined, e.g., with \texttt{L1=14}, \texttt{L2=2}, \texttt{Lattice\_type="Square"}, \texttt{Model="Hubbard\_Plain\_Vanilla"} and \texttt{Ham\_Ty=2.0D0}.
As an application of this code, we can consider a 2-leg ladder system defined, e.g., with \texttt{L1=14}, \texttt{L2=2}, \texttt{Lattice\_type="Square"}, \texttt{Model="Hubbard\_Plain\_Vanilla"} and different values of \texttt{Ham\_Ty}. The results you should obtain are summarized in Fig.~\ref{fig:ladder}.
\caption{Spin correlation functions along one leg for the Hubbard ladder. As $t_y$ grows the spin gap becomes large enough so as to detect the exponential decal of the spin correlation function on this small lattice size. The underlying physics of odd-even ladder systems is introduced in the article: Elbio Dagotto and T. M. Rice, Surprises on the way from one- to two-dimensional quantum magnets: The ladder materials, Science 271 (1996), no. 5249, 618--623.}
% [Excluding the introduction to the exercise item: improved estimator \langle \vec{S}_{i} \cdot \vec{S}_{j} \rangle]
\exerciseitem{The SU(2) Hubbard-Stratonovich transformation}
\red{[Introduce modifications to \texttt{Hamiltonian\_Hubbard\_mod.F90}]} The SU(2) Hubbard-Stratonovich decomposition, conserves spin rotational symmetry. Run the ladder code with the SU(2) flag in the parameter file switched on (i.e. \texttt{Model = Hubbard\_SU2}) and compare results.
The SU(2) Hubbard-Stratonovich decomposition conserves spin rotational symmetry. Introduce into \texttt{Hamiltonian\_Hubbard\_mod.F90} the same changes done to the \texttt{Vanilla} module, described in the previous item, and compare results.
set terminal postscript eps enhanced solid color 'Times-Roman' 18
set size 0.8,0.8
set title "{L=14 Hubbard Ladder, {/Symbol b}t=10, U/t=4 }"
set out 'Ladder.eps'
set out 'ladder.eps'
set fit errorvariables
#set print tmp
......@@ -11,12 +11,12 @@ f(x) = a + b * x
#print "0.0 ", a, a_err, b, b_err, "\n\n"
plot "Spin.dat" i 0 u 1:2:3 w e lt 2 t "t_y=0" ,\
"Spin.dat" i 1 u 1:2:3 w e lt 3 t "t_y=1" ,\
"Spin.dat" i 2 u 1:2:3 w e lt 4 t "t_y=2" ,\
"Spin.dat" i 0 u 1:2 w l lt 2 t "" ,\
"Spin.dat" i 1 u 1:2 w l lt 3 t "" ,\
"Spin.dat" i 2 u 1:2 w l lt 4 t ""
plot "ladder.dat" i 0 u 1:2:3 w e lt 2 t "t_y=0" ,\
"ladder.dat" i 1 u 1:2:3 w e lt 3 t "t_y=1" ,\
"ladder.dat" i 2 u 1:2:3 w e lt 4 t "t_y=2" ,\
"ladder.dat" i 0 u 1:2 w l lt 2 t "" ,\
"ladder.dat" i 1 u 1:2 w l lt 3 t "" ,\
"ladder.dat" i 2 u 1:2 w l lt 4 t ""
!epstopdf Ladder.eps
!open Ladder.pdf
!epstopdf ladder.eps
!open ladder.pdf
! Copyright (C) 2016 - 2020 The ALF project
! The ALF project is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
! The ALF project is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! GNU General Public License for more details.
! You should have received a copy of the GNU General Public License
! along with ALF. If not, see
! Under Section 7 of GPL version 3 we require you to fulfill the following additional terms:
! - It is our hope that this program makes a contribution to the scientific community. Being
! part of that community we feel that it is reasonable to require you to give an attribution
! back to the original authors if you have benefitted from this program.
! Guidelines for a proper citation can be found on the project's homepage
! - We require the preservation of the above copyright notice and this license in all original files.
! - We prohibit the misrepresentation of the origin of the original source files. To obtain
! the original source files please visit the homepage .
! - If you make substantial changes to the program we require you to either consider contributing
! to the ALF project or to mark your material in a reasonable way as different from the original version
!> @author
!> ALF-project
!> @brief
!> This module defines the Hamiltonian and observables. Here, we have included a
!> set of predefined Hamiltonians. They include the Hubbard and SU(N) tV models
!> on honeycomb, pi-flux and square lattices.
!> @details
!> The public variables of this module are the following
!> @param [public] OP_V
!> \verbatim
!> Type (Operator), dimension(:,:), allocatable
!> List of operators of type=1,2 and 3 describing the sequence of interactions on a time slice.
!> The first index runs over this sequence. The second corresponds to the flavor index. \endverbatim
!> @param [public] OP_T
!> \verbatim
!> Type (Operator), dimension(:,:), allocatable
!> Sequence of operators accounting for the hopping on a time slice. This can include various
!> checkerboard decompositions. The first index runs over this sequence. The second corresponds to
!> the flavor index. \endverbatim
!> * The progagation reads:
!> \f$ \prod_{\tau} \; \; \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n} \f$. That is
!> first the hopping and then the potential energy.
!>@param [public] WF_L
!> \verbatim Type (WaveFunction), dimension(:), allocatable
!> Left trial wave function. \endverbatim
!> @param [public] WF_R
!> \verbatim Type (WaveFunction), dimension(:), allocatable
!> Right trial wave function. For both wave functions the index runs over the flavor index. \endverbatim
!> @param [public] nsigma
!> \verbatim Type(Fields)
!> Contains all auxiliary fields in the variable f(:,:). The first index runs through the operator
!> sequence. The second through the time slices. \endverbatim
!> @param [public] Ndim
!> \verbatim Integer
!> Total number of orbitals. e.g. # unit cells * # orbitals per unit cell. \endverbatim
!> @param [public] N_FL
!> \verbatim Integer
!> # of flavors. Propagation is block diagonal in flavors. \endverbatim
!> @param [public] N_SUN
!> \verbatim Integer
!> # of colors. Propagation is color independent. \endverbatim
!> @param [public] Ltrot
!> \verbatim Integer
!> Available measurment interval in units of Delta Tau. \endverbatim
!> @param [public] Thtrot
!> \verbatim Integer
!> Effective projection parameter in units of Delta Tau. (Only relevant if projective option is turned on) \endverbatim
!> @param [public] Projector
!> \verbatim Logical
!> Flag for projector. If true then the total number of time slices will correspond to Ltrot + 2*Thtrot \endverbatim
!> @param [public] Group_Comm
!> \verbatim Integer
!> Defines MPI communicator \endverbatim
!> @param [public] Symm
!> \verbatim Logical \endverbatim
!> If set to true then the green functions will be symmetrized
!> before being sent to the Obser, ObserT subroutines.
!> In particular, the transformation, \f$ \tilde{G} = e^{-\Delta \tau T /2 } G e^{\Delta \tau T /2 } \f$
!> will be carried out and \f$ \tilde{G} \f$ will be sent to the Obser and ObserT subroutines. Note that
!> if you want to use this feature, then you have to be sure the hopping and interaction terms are decomposed
!> symmetrically. If Symm is true, the propagation reads:
!> \f$ \prod_{\tau} \; \; \prod_{n=N_T}^{1}e^{T_n/2} \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n/2} \f$
!> You still have to add some docu for the other private variables in this module.
Module Hamiltonian
Use Operator_mod
Use WaveFunction_mod
Use Lattices_v3
Use MyMats
Use Random_Wrap
Use Files_mod
Use Matrix
Use Observables
Use Fields_mod
Use Predefined_Hoppings
Use LRC_Mod
Implicit none
Type (Operator), dimension(:,:), allocatable :: Op_V
Type (Operator), dimension(:,:), allocatable :: Op_T
Type (WaveFunction), dimension(:), allocatable :: WF_L
Type (WaveFunction), dimension(:), allocatable :: WF_R
Type (Fields) :: nsigma
Integer :: Ndim
Integer :: N_FL
Integer :: N_SUN
Integer :: Ltrot
Integer :: Thtrot
Logical :: Projector
Integer :: Group_Comm
Logical :: Symm
Type (Lattice), private :: Latt
Type (Unit_cell), private :: Latt_unit
Integer, private :: L1, L2
real (Kind=Kind(0.d0)), private :: Ham_T , Ham_Ty , Ham_U, Ham_chem
real (Kind=Kind(0.d0)), private :: Dtau, Beta, Theta
Integer , private :: N_part
Character (len=64), private :: Model, Lattice_type
!> Privat Observables
Type (Obser_Vec ), private, dimension(:), allocatable :: Obs_scal
Type (Obser_Latt), private, dimension(:), allocatable :: Obs_eq
Type (Obser_Latt), private, dimension(:), allocatable :: Obs_tau
!> @author
!> ALF Collaboration
!> @brief
!> Sets the Hamiltonian
Subroutine Ham_Set
#if defined (MPI) || defined(TEMPERING)
Use mpi
Implicit none
integer :: ierr, nf
Character (len=64) :: file_info, file_para
NAMELIST /VAR_Lattice/ L1, L2, Lattice_type, Model
NAMELIST /VAR_Hubbard_Plain_Vanilla/ Ham_T, Ham_Ty, ham_chem, ham_U, Dtau, Beta, Projector, Theta, Symm, N_part
#ifdef MPI
Integer :: Isize, Irank, irank_g, isize_g, igroup
! Global "Default" values.
#ifdef MPI
call MPI_Comm_rank(Group_Comm, irank_g, ierr)
call MPI_Comm_size(Group_Comm, isize_g, ierr)
igroup = irank/isize_g
File_Para = "parameters"
File_info = "info"
#if defined(TEMPERING)
write(File_para,'(A,I0,A)') "Temp_",igroup,"/parameters"
write(File_info,'(A,I0,A)') "Temp_",igroup,"/info"
#ifdef MPI
If (Irank_g == 0 ) then
IF (ierr /= 0) THEN
WRITE(*,*) 'unable to open <parameters>',ierr
N_part = L1*L2/2
If (L1 == 1) then
Write(6,*) 'For one-dimensional lattices set L2=1'
Ltrot = nint(beta/dtau)
if (Projector) Thtrot = nint(theta/dtau)
Ltrot = Ltrot+2*Thtrot
N_SUN = 1
N_FL = 2
#ifdef MPI
CALL MPI_BCAST(L1 ,1 ,MPI_INTEGER, 0,Group_Comm,ierr)
CALL MPI_BCAST(L2 ,1 ,MPI_INTEGER, 0,Group_Comm,ierr)
CALL MPI_BCAST(N_SUN ,1 ,MPI_INTEGER, 0,Group_Comm,ierr)
CALL MPI_BCAST(N_FL ,1 ,MPI_INTEGER, 0,Group_Comm,ierr)
CALL MPI_BCAST(Lattice_type,64 ,MPI_CHARACTER, 0,Group_Comm,IERR)
CALL MPI_BCAST(Ltrot ,1, MPI_INTEGER , 0,Group_Comm,ierr)
CALL MPI_BCAST(N_part ,1, MPI_INTEGER , 0,Group_Comm,ierr)
CALL MPI_BCAST(Thtrot ,1, MPI_INTEGER , 0,Group_Comm,ierr)
CALL MPI_BCAST(Projector ,1, MPI_LOGICAL , 0,Group_Comm,ierr)
CALL MPI_BCAST(Dtau ,1, MPI_REAL8 , 0,Group_Comm,ierr)
CALL MPI_BCAST(Beta ,1, MPI_REAL8 , 0,Group_Comm,ierr)
CALL MPI_BCAST(Ham_T ,1, MPI_REAL8 , 0,Group_Comm,ierr)
CALL MPI_BCAST(ham_chem ,1, MPI_REAL8 , 0,Group_Comm,ierr)
CALL MPI_BCAST(ham_U ,1, MPI_REAL8 , 0,Group_Comm,ierr)
! Setup the Bravais lattice
Call Ham_Latt
! Setup the hopping / single-particle part
Call Ham_Hop
! Setup the interaction.
call Ham_V
#ifdef MPI
If (Irank_g == 0) then
OPEN(Unit = 50,file=file_info,status="unknown",position="append")
Write(50,*) '====================================='
Write(50,*) 'Model is : ', Model
Write(50,*) 'Lattice is : ', Lattice_type
Write(50,*) 'L1 : ', L1
Write(50,*) 'L2 : ', L2
Write(50,*) '# of orbitals : ', Ndim
Write(50,*) 'Symm. decomp : ', Symm
if (Projector) then
Write(50,*) 'Projective version'
Write(50,*) 'Theta : ', Theta
Write(50,*) 'Tau_max : ', beta
Write(50,*) '# of particles: ', N_part
Write(50,*) 'Finite temperture version'
Write(50,*) 'Beta : ', Beta
Write(50,*) 'dtau,Ltrot_eff: ', dtau,Ltrot
Write(50,*) 't : ', Ham_T
!!!!!!! Modifications for Exercise 1a
Write(50,*) 'ty : ', Ham_Ty
Write(50,*) 'Ham_U : ', Ham_U
Write(50,*) 'Ham_chem : ', Ham_chem
#ifdef MPI
! Setup the trival wave function, in case of a projector approach
if (Projector) Call Ham_Trial(File_info)
end Subroutine Ham_Set
!> @author
!> ALF Collaboration
!> @brief
!> Sets the Lattice
Subroutine Ham_Latt
Implicit none
Real (Kind=Kind(0.d0)) :: a1_p(2), a2_p(2), L1_p(2), L2_p(2)
If (Lattice_Type /= "Square") then
Write(6,*) 'The plain vanilla Hubbard model is only defined for the square lattice'
a1_p(1) = 1.0 ; a1_p(2) = 0.d0
a2_p(1) = 0.0 ; a2_p(2) = 1.d0
L1_p = dble(L1)*a1_p
L2_p = dble(L2)*a2_p
Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt )
Ndim = Latt%N
end Subroutine Ham_Latt
!> @author
!> ALF Collaboration
!> @brief
!> Sets the Hopping
Subroutine Ham_Hop
Implicit none