Commit f958f52c authored by Johannes Hofmann (Laptop)'s avatar Johannes Hofmann (Laptop)
Browse files

Merge branch 'master' of git.physik.uni-wuerzburg.de:ALF/ALF_Tutorial

parents 6dab1fb7 b2972b47

Too many changes to show.

To preserve performance only 253 of 253+ files are displayed.
......@@ -274,21 +274,39 @@ which opens the ``notebook dashboard'' in your default browser, where you can na
A lot already comes implemented in ALF, but unavoidably, as one proceeds in their own investigations, a new model has to be implemented or a new observable defined -- and for that, one must grapple with the package's Fortran source code.
This second part of the tutorial consists in a set of guided exercises that exemplify how to make basic additions to the code, taking as starting point the template-like, relatively self-contained module \texttt{Hamiltonian\_Hubbard\_Plain\_Vanilla\_mod.F90}, which is also a good display of ALF's internal workings.
These worked-out exercises, together with ALF's modularity provided by its Predefined Structures should make getting your hands dirty less daunting than it may sound.
These worked-out exercises, together with ALF's modularity, boosted by its Predefined Structures, should make getting your hands dirty less daunting than it may sound.
\section*{Downloading the code and tutorial}
\section*{Downloading and using the code and tutorial}
One can use the ALF package downloaded automatically by the Python script in the first part of this tutorial, or manually, by typing
\begin{lstlisting}[style=bash]
git clone git@git.physik.uni-wuerzburg.de:ALF/ALF.git
\end{lstlisting}
in a shell. The necessary environment variables and the directives for compiling the code are set by the script \texttt{configure.sh}: \lstinline[style=bash]|source configure.sh GNU|, followed by the command \lstinline[style=bash,morekeywords={make}]|make|. Details and further options are described in the package's documentation found in its repository.
Similarly, to download the tutorial, including solutions, enter:
in a shell. Similarly, to download the tutorial, including solutions, enter:
\begin{lstlisting}[style=bash]
git clone git@git.physik.uni-wuerzburg.de:ALF/ALF_Tutorial.git
\end{lstlisting}
The necessary environment variables and the directives for compiling the code are set by the script \texttt{configure.sh}: \lstinline[style=bash]|source configure.sh GNU|, followed by the command \lstinline[style=bash,morekeywords={make}]|make|. Details and further options are described in the package's documentation found in its repository.
A workflow you can adopt for solving the exercises -- or indeed using ALF in general -- is the following:
\begin{enumerate}
\item Compile the modified Hamiltonian module, for instance:\\
\lstinline[style=bash,morekeywords={make}]{make Hubbard_Plain_Vanilla}
\item Create a data directory with the content of \texttt{Start}:\\
\lstinline[style=bash,morekeywords={cp}]{cp -r ./Start ./Run && cd ./Run/}
\item Run its executable, e.g., serially:\\
\lstinline[style=bash]{$ALF_DIR/Prog/Hamiltonians/Hubbard_Plain_Vanilla.out} %$
\item Perform default analyses\footnote{The \texttt{analysis.sh} bash script from earlier versions of ALF, run without arguments, is still available in the \texttt{Start} directory.}:\\
\lstinline[style=bash]{$ALF_DIR/Analysis/ana.out *} %$
\end{enumerate}
The structure of the data files and details on the analysis output can be found in ALF's documentation.
%Two common pitfalls are:
%\begin{itemize}
% \item forgetting to run \texttt{configure.sh}, and
% \item not using different \texttt{Run} data directories for independent runs.
%\end{itemize}
\exercise{Dimensional crossover}
......@@ -296,7 +314,7 @@ git clone git@git.physik.uni-wuerzburg.de:ALF/ALF_Tutorial.git
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.
\exerciseitem{Modifying the hopping}
To do so we start from the module \texttt{Hamiltonian\_Hubbard\_Plain\_Vanilla\_mod.F90} found in \texttt{\$ALF\_DIR/Prog/Hamiltonians/}, which we here shorten to ``\texttt{Vanilla}'', and then:
To do so we start from the module \texttt{Hamiltonian\_Hubbard\_Plain\_Vanilla\_mod.F90}, which we here shorten to ``\texttt{Vanilla}'', found in \texttt{\$ALF\_DIR/Prog/Hamiltonians/}, proceeding as follows:
\begin{itemize}
\item Add \texttt{Ham\_Ty} to the \texttt{VAR\_Hubbard\_Plain\_Vanilla} name space in the parameter file \texttt{parameters}.
\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}).
......@@ -321,12 +339,11 @@ Do I = 1,Latt%N
Enddo
\end{lstlisting}
\end{itemize}
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}.
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 get the new simulation parameter written into the file \texttt{info}, also a change in \texttt{Ham\_Set}.
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 simulation).
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}, found in the \texttt{Prog/Hamiltonians} directory. The solution directory also includes the modified and original modules, as well as 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 simulation).
\noindent
As an application of this code, we can once again consider a ladder system (e.g, a 2-leg ladder with \texttt{L1=14} and \texttt{L2=2}), for different values of \texttt{Ham\_Ty}. The results you should obtain are summarized in Fig.~\ref{fig:ladder}.
As an application of this code, we can once again consider a ladder system (e.g, a 2-leg ladder with \texttt{L1=14} and \texttt{L2=2}), for different values of \texttt{Ham\_Ty}. The results you should obtain for the total spin correlation function (file \texttt{SpinT\_eqJR}) are summarized in Fig.~\ref{fig:ladder}.
\begin{figure}[h]
\begin{center}
......@@ -361,7 +378,7 @@ Note that the t-V model is already implemented in ALF in the module \texttt{Hami
\exerciseitem{Define new model}
In the directory \texttt{\$ALF\_DIR/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} found in \texttt{\$ALF\_DIR/Prog/Hamiltonians/}, which we here shorten to ``\texttt{Vanilla}''. The following are the essential steps to be carried out:
In the directory \texttt{\$ALF\_DIR/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}, which we here shorten to ``\texttt{Vanilla}'', found in \texttt{\$ALF\_DIR/Prog/Hamiltonians/}. The following are the essential steps to be carried out:
\begin{itemize}
\item Add the \texttt{VAR\_t\_V} name space in the file \texttt{parameters} and set the necessary variables -- or simply rename the \texttt{VAR\_Hubbard\_Plain\_Vanilla} name space to \texttt{VAR\_t\_V} and, within it, \texttt{Ham\_U} to \texttt{Ham\_Vint}. (Ignore the name space \texttt{VAR\_tV}, which is used by the general implementation mentioned above.)
\item Declare a new variable, \texttt{Ham\_Vint}, in \texttt{Vanilla}'s specification.
......@@ -373,43 +390,77 @@ e^{\Delta \tau \frac{V}{2} \left( \hat{c}^{\dagger}_{i} \hat{c}^{\phantom\dagge
\sum_{l= \pm1, \pm 2} \gamma_l e^{ \sqrt{\Delta \tau \frac{V}{2}} \eta_l \left( \hat{c}^{\dagger}_{i} \hat{c}^{\phantom\dagger}_{i+a} + \hat{c}^{\dagger}_{i+a} \hat{c}^{\phantom\dagger}_{i} \right) } = \sum_{l= \pm1, \pm 2} \gamma_l e^{ g \eta_l \left( \hat{c}^{\dagger}_{i}, \hat{c}^{\dagger}_{i+a} \right) O
\left(\hat{c}^{\phantom\dagger}_{i}, \hat{c}^{\phantom\dagger}_{i+a} \right)^{T} }.
\end{equation}
Here is how this translates in the code.
Here is how this translates in the code (the new integer variable, \texttt{i2}, should be declared):
\begin{lstlisting}[style=fortran]
Allocate(Op_V(Latt%N,N_FL))
Allocate(Op_V(Ndim,N_FL))
do nf = 1,N_FL
do i = 1, N_coord*Ndim
do i = 1, Ndim
call Op_make(Op_V(i,nf),2)
enddo
enddo
Do nc = 1, Latt%N ! Runs over bonds = # of lattice sites in one-dimension.
I1 = nc
I2 = Latt%nnlist(I1,1,0)
Op_V(nc,1)%P(1) = I1
Op_V(nc,1)%P(2) = I2
Op_V(nc,1)%O(1,2) = cmplx(1.d0 ,0.d0, kind(0.D0))
Op_V(nc,1)%O(2,1) = cmplx(1.d0 ,0.d0, kind(0.D0))
Op_V(nc,1)%g = SQRT(CMPLX( DTAU*Ham_Vint/2.d0, 0.D0, kind(0.D0)))
Op_V(nc,1)%alpha = cmplx(0d0,0.d0, kind(0.D0))
Op_V(nc,1)%type =2
Call Op_set( Op_V(nc,1) )
Do i = 1, Ndim ! Runs over bonds = # of lattice sites in one-dimension.
i2 = Latt%nnlist(i,1,0)
Op_V(i,nf)%P(1) = i
Op_V(i,nf)%P(2) = i2
Op_V(i,nf)%O(1,2) = cmplx(1.d0 ,0.d0, kind(0.d0))
Op_V(i,nf)%O(2,1) = cmplx(1.d0 ,0.d0, kind(0.d0))
Op_V(i,nf)%g = sqrt(cmplx(Dtau*Ham_Vint/2.d0, 0.d0, kind(0.d0)))
Op_V(i,nf)%alpha = cmplx(0d0 ,0.d0, kind(0.d0))
Op_V(i,nf)%type = 2
Call Op_set( Op_V(i,nf) )
enddo
\end{lstlisting}
\item Finally, you have to update the \texttt{Obser} and \texttt{ObserT} routines for the calculation of equal- and time-displaced correlations. For the \texttt{t\_V} model you can essentially use the same observables as for the \texttt{Hubbard\_SU(2)} model in 1D -- a step which requires a number of changes with respect to the \texttt{Vanilla} base, such as:
\begin{lstlisting}[style=fortran]
!!!!! Modifications for Exercise 2
!Zpot = Zpot*ham_U ! Vanilla
Zpot = Zpot*Ham_Vint ! t-V
!!!!!
\end{lstlisting}
and
\begin{lstlisting}[style=fortran]
!Zrho = Zrho + Grc(i,i,1) + Grc(i,i,2) ! Vanilla
Zrho = Zrho + Grc(i,i,1) ! t-V
\end{lstlisting}
with the observables being coded in the routine \texttt{Obser} as
\begin{lstlisting}[style=fortran]
Z = cmplx(dble(N_SUN), 0.d0, kind(0.D0))
Do I1 = 1,Ndim
I = I1
no_I = 1
Do J1 = 1,Ndim
J = J1
no_J = 1
imj = latt%imj(I,J)
Obs_eq(1)%Obs_Latt(imj,1,no_I,no_J) = Obs_eq(1)%Obs_Latt(imj,1,no_I,no_J) + &
& Z * GRC(I1,J1,1) * ZP*ZS ! Green
Obs_eq(2)%Obs_Latt(imj,1,no_I,no_J) = Obs_eq(2)%Obs_Latt(imj,1,no_I,no_J) + &
& Z * GRC(I1,J1,1) * GR(I1,J1,1) * ZP*ZS ! SpinZ
Obs_eq(3)%Obs_Latt(imj,1,no_I,no_J) = Obs_eq(3)%Obs_Latt(imj,1,no_I,no_J) + &
& ( GRC(I1,I1,1) * GRC(J1,J1,1) * Z + &
& GRC(I1,J1,1) * GR(I1,J1,1 ) ) * Z * ZP*ZS ! Den
enddo
Obs_eq(3)%Obs_Latt0(no_I) = Obs_eq(3)%Obs_Latt0(no_I) + Z * GRC(I1,I1,1) * ZP * ZS
enddo
\end{lstlisting}
\item Finally you will have to update the \texttt{Obser} and \texttt{ObserT} routines for the calculation of the equal and time displaced correlations. For the \texttt{t\_V} model you can essentially use the same observables as for the \texttt{Hubbard\_SU(2)} model.
among other changes - with similar ones in the \texttt{ObserT} routine.
All necessary changes are implemented and clearly indicated in the solution provided in \texttt{Solutions/Exercise\_2/Hamiltonian\_Hubbard\_Plain\_Vanilla\_mod-Exercise\_2.F90}.
\end{itemize}
In the directory \texttt{Solutions/Exercise\_2} 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/Hamiltonians} 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 simulation).
You can now run the code for various values of $V/t$. A Jordan-Wigner transformation will map the \texttt{t\_V} model onto the XXZ chain:
\begin{equation}
\hat{H} = J_{xx} \sum_{i} \hat{S}^{x}_i \hat{S}^{x}_{i+a} + \hat{S}^{y}_i \hat{S}^{y}_{i+a} + J_{zz} \sum_{i}\hat{S}^{z}_i \hat{S}^{z}_{i +a}
\hat{H} = J_{xx} \sum_{i} \hat{S}^{x}_i \hat{S}^{x}_{i+a} + \hat{S}^{y}_i \hat{S}^{y}_{i+a} + J_{zz} \sum_{i}\hat{S}^{z}_i \hat{S}^{z}_{i +a}\quad,
\end{equation}
with $J_{zz} = V $ and $J_{xx} = 2t$. Hence when $V/t = 2$ we reproduce the Heisenberg model. For $V/t > 2$ the model is in the Ising regime with long-range charge density wave order and is an insulator. In the regime $ -2 < V/t < 2$ the model is metallic and corresponds to a Luttinger liquid. Finally, at $ V/t < - 2$ phase separation between hole rich and electron rich phases occur. Fig.~\ref{tV.fig} shows typical results.
with $J_{zz} = V $ and $J_{xx} = 2t$. Hence, when $V/t = 2$ we reproduce the Heisenberg model. For $V/t > 2$ the model is in the Ising regime with long-range charge density wave order and is an insulator. In the regime $ -2 < V/t < 2$ the model is metallic and corresponds to a Luttinger liquid. Finally, at $ V/t < - 2$ phase separation between hole rich and electron rich phases occur. Fig.~\ref{tV.fig} shows typical results for the density-density correlation function (file \texttt{Den\_eqJR}).
\begin{figure}[htb]
\begin{center}
\includegraphics[scale=.8]{tV.pdf}
\caption{Density-Density correlation functions of the t-V model. In the Luttinger liquid phase, $-2 < V/t < 2$ it is known that the density -density correlations decay as
$ \langle n(r) n(0)\rangle \propto \cos(\pi r) r^{-\left(1+K_\rho \right) } $ with $\left(1+K_\rho \right)^{-1}= \frac{1}{2} + \frac{1}{\pi} \arcsin \left( \frac{V}{2 | t | }\right) $
\includegraphics[width=0.6\columnwidth]{tV.pdf}
\caption{Density-Density correlation functions of the t-V model. In the Luttinger liquid phase, $-2 < V/t < 2$, it is known that the density-density correlations decay as $ \langle n(r) n(0)\rangle \propto \cos(\pi r) r^{-\left(1+K_\rho \right) } $ with $\left(1+K_\rho \right)^{-1}= \frac{1}{2} + \frac{1}{\pi} \arcsin \left( \frac{V}{2 | t | }\right) $
(A. Luther and I. Peschel, Calculation of critical exponents in two dimensions from quantum field theory in one dimension, Phys. Rev. B 12 (1975), 3908.) The interested reader can try to reproduce this result.}
\label{tV.fig}
\end{center}
......
......@@ -3,20 +3,15 @@ set size 0.8,0.8
set title "{L=14 Hubbard Ladder, {/Symbol b}t=10, U/t=4 }"
set out 'ladder.eps'
set fit errorvariables
#tmp='Ener_fit.dat'
#set print tmp
set xlabel "r"
set ylabel "S(r,0)"
f(x) = a + b * x
#print "0.0 ", a, a_err, b, b_err, "\n\n"
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 ""
plot "ladder.dat" i 0 u 1:2:3 w e lc rgb "black" lt 1 pt 7 lw 2 t "t_y=0" , \
'' i 0 u 1:2 w l lc rgb "black" lt 1 lw 2 t "" , \
'' i 1 u 1:2:3 w e lc rgb "red" lt 1 pt 7 lw 2 t "t_1=1" , \
'' i 1 u 1:2 w l lc rgb "red" lt 1 lw 2 t "" , \
'' i 2 u 1:2:3 w e lc rgb "royalblue" lt 1 pt 7 lw 2 t "t_y=2" ,\
'' i 2 u 1:2 w l lc rgb "royalblue" lt 1 lw 2 t ""
!epstopdf ladder.eps
!open ladder.pdf
No preview for this file type
......@@ -24,10 +24,10 @@ e^{ -\Delta \tau \left( \hat{A} + \hat{B} \right) } = e^{ -\Delta \tau \hat{A}
Bellow we go through the steps for performing this extrapolation:
setting the simulation parameters, running it and analysing the data. A
reference plot for this analyses is found in
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF_code/-/blob/master/Documentation/ALF_v1.0.pdf}{ALF
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF/-/blob/master/Documentation/doc.pdf}{ALF
documentation}, Sec. 2.3.2 (Symmetric Trotter decomposition).
\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
\textbf{1.} Import \texttt{Simulation} class from the \texttt{py\_alf}
python module, which provides the interface with ALF, as well as
......@@ -36,10 +36,10 @@ mathematics and plotting packages:
\begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{1}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{k+kn}{from} \PY{n+nn}{py\PYZus{}alf} \PY{k}{import} \PY{n}{Simulation} \PY{c+c1}{\PYZsh{} Interface with ALF}
\PY{k+kn}{from} \PY{n+nn}{py\PYZus{}alf} \PY{k+kn}{import} \PY{n}{Simulation} \PY{c+c1}{\PYZsh{} Interface with ALF}
\PY{c+c1}{\PYZsh{} }
\PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k}{as} \PY{n+nn}{np} \PY{c+c1}{\PYZsh{} Numerical library}
\PY{k+kn}{from} \PY{n+nn}{scipy}\PY{n+nn}{.}\PY{n+nn}{optimize} \PY{k}{import} \PY{n}{curve\PYZus{}fit} \PY{c+c1}{\PYZsh{} Numerical library}
\PY{k+kn}{from} \PY{n+nn}{scipy}\PY{n+nn}{.}\PY{n+nn}{optimize} \PY{k+kn}{import} \PY{n}{curve\PYZus{}fit} \PY{c+c1}{\PYZsh{} Numerical library}
\PY{k+kn}{import} \PY{n+nn}{matplotlib}\PY{n+nn}{.}\PY{n+nn}{pyplot} \PY{k}{as} \PY{n+nn}{plt} \PY{c+c1}{\PYZsh{} Plotting library}
\end{Verbatim}
\end{tcolorbox}
......@@ -224,11 +224,11 @@ For Dtau values [0.05 0.1 0.15] the measured energies are:
\end{tcolorbox}
\begin{center}
\adjustimage{max size={0.6\linewidth}{0.9\paperheight}}{trotter_error-output_12_2.png}
\adjustimage{max size={0.6\linewidth}{0.6\paperheight}}{trotter_error-output_12_2.png}
\end{center}
{ \hspace*{\fill} \\}
\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
\hypertarget{exercises}{%
\subsection{Exercises}\label{exercises}}
......@@ -241,7 +241,7 @@ For Dtau values [0.05 0.1 0.15] the measured energies are:
\texttt{Symm} settings in order to observe their effect on the output
and run time. Reference: Sec. 2.3.2 - Symmetric Trotter decomposition
- of the
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF_code/-/blob/master/Documentation/ALF_v1.0.pdf}{ALF
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF/-/blob/master/Documentation/doc.pdf}{ALF
documentation}, especially Fig. 2.
\end{enumerate}
......
......@@ -392,10 +392,10 @@ e^{ -\Delta \tau \left( \hat{A} + \hat{B} \right) } = e^{ -\Delta \tau \hat{A}
Bellow we go through the steps for performing this extrapolation:
setting the simulation parameters, running it and analysing the data. A
reference plot for this analyses is found in
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF_code/-/blob/master/Documentation/ALF_v1.0.pdf}{ALF
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF/-/blob/master/Documentation/doc.pdf}{ALF
documentation}, Sec. 2.3.2 (Symmetric Trotter decomposition).
\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
\textbf{1.} Import \texttt{Simulation} class from the \texttt{py\_alf}
python module, which provides the interface with ALF, as well as
......@@ -404,10 +404,10 @@ mathematics and plotting packages:
\begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{1}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{k+kn}{from} \PY{n+nn}{py\PYZus{}alf} \PY{k}{import} \PY{n}{Simulation} \PY{c+c1}{\PYZsh{} Interface with ALF}
\PY{k+kn}{from} \PY{n+nn}{py\PYZus{}alf} \PY{k+kn}{import} \PY{n}{Simulation} \PY{c+c1}{\PYZsh{} Interface with ALF}
\PY{c+c1}{\PYZsh{} }
\PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k}{as} \PY{n+nn}{np} \PY{c+c1}{\PYZsh{} Numerical library}
\PY{k+kn}{from} \PY{n+nn}{scipy}\PY{n+nn}{.}\PY{n+nn}{optimize} \PY{k}{import} \PY{n}{curve\PYZus{}fit} \PY{c+c1}{\PYZsh{} Numerical library}
\PY{k+kn}{from} \PY{n+nn}{scipy}\PY{n+nn}{.}\PY{n+nn}{optimize} \PY{k+kn}{import} \PY{n}{curve\PYZus{}fit} \PY{c+c1}{\PYZsh{} Numerical library}
\PY{k+kn}{import} \PY{n+nn}{matplotlib}\PY{n+nn}{.}\PY{n+nn}{pyplot} \PY{k}{as} \PY{n+nn}{plt} \PY{c+c1}{\PYZsh{} Plotting library}
\end{Verbatim}
\end{tcolorbox}
......@@ -596,7 +596,7 @@ For Dtau values [0.05 0.1 0.15] the measured energies are:
\end{center}
{ \hspace*{\fill} \\}
\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
\hypertarget{exercises}{%
\subsection{Exercises}\label{exercises}}
......@@ -609,7 +609,7 @@ For Dtau values [0.05 0.1 0.15] the measured energies are:
\texttt{Symm} settings in order to observe their effect on the output
and run time. Reference: Sec. 2.3.2 - Symmetric Trotter decomposition
- of the
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF_code/-/blob/master/Documentation/ALF_v1.0.pdf}{ALF
\href{https://git.physik.uni-wuerzburg.de/ALF/ALF/-/blob/master/Documentation/doc.pdf}{ALF
documentation}, especially Fig. 2.
\end{enumerate}
......
! 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
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 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 http://www.gnu.org/licenses/.
!
! 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
! http://alf.physik.uni-wuerzburg.de
!
! - 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 http://alf.physik.uni-wuerzburg.de .
!
! - 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_U, Ham_chem
!!!!!!! Modifications for Exercise 1a
real (Kind=Kind(0.d0)), private :: Ham_Ty
!!!!!!!
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
contains
!--------------------------------------------------------------------
!> @author
!> ALF Collaboration
!>
!> @brief
!> Sets the Hamiltonian
!--------------------------------------------------------------------
Subroutine Ham_Set
#if defined (MPI) || defined(TEMPERING)
Use mpi
#endif
Implicit none
integer :: ierr, nf
Character (len=64) :: file_info, file_para
NAMELIST /VAR_Lattice/ L1, L2, Lattice_type, Model
!!!!!!! Modifications for Exercise 1a
!NAMELIST /VAR_Hubbard_Plain_Vanilla/ Ham_T, ham_chem, ham_U, Dtau, Beta, Projector, Theta, Symm, N_part
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
Integer :: STATUS(MPI_STATUS_SIZE)
#endif
! Global "Default" values.
#ifdef MPI
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,ISIZE,IERR)
CALL MPI_COMM_RANK(MPI_COMM_WORLD,IRANK,IERR)
call MPI_Comm_rank(Group_Comm, irank_g, ierr)
call MPI_Comm_size(Group_Comm, isize_g, ierr)
igroup = irank/isize_g
#endif
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"
#endif
#ifdef MPI
If (Irank_g == 0 ) then
#endif
OPEN(UNIT=5,FILE=file_para,STATUS='old',ACTION='read',IOSTAT=ierr)
IF (ierr /= 0) THEN
WRITE(*,*) 'unable to open <parameters>',ierr
STOP
END IF
READ(5,NML=VAR_lattice)
N_part = L1*L2/2
If (L1 == 1) then
Write(6,*) 'For one-dimensional lattices set L2=1'