ALF_Tutorial.tex 26.8 KB
Newer Older
1
% Copyright (c) 2016-2020 The ALF project.
2 3 4 5 6
% This is the ALF project documentation.
% The ALF project documentation by the ALF contributors is licensed
% under a Creative Commons Attribution-ShareAlike 4.0 International License.
% For the licensing details of the documentation see license.CCBYSA.

Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
7
\documentclass[10pt,modern]{scrartcl}
8
%\documentclass[10pt,modern]{article}
9 10
\usepackage{graphicx}
\usepackage[margin=2.5cm]{geometry}
Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
11
\usepackage[T1]{fontenc}
12 13 14 15 16 17 18 19 20
\usepackage[utf8]{inputenc}
\usepackage{bbm}            
\usepackage[fleqn]{amsmath} 
\usepackage{amssymb}
\usepackage{wasysym}
\usepackage{color}
\usepackage{soul}
\usepackage{xspace}
\usepackage{bm}
21 22 23
%%\usepackage{subfigure} % outdated package
%\usepackage{subcaption}
%\usepackage{caption}
24
\usepackage[breakable]{tcolorbox}
25 26 27 28 29 30 31 32
\usepackage{dsfont}
\usepackage{footnote}
\usepackage{alltt}
\usepackage{xcolor}
\usepackage{lmodern}
\usepackage{listings}
\usepackage{url}
\usepackage{booktabs}
33
\usepackage[breaklinks=true,colorlinks,pdfborder={0 0 0}]{hyperref} 
34
\usepackage{float}
35
%\usepackage{pdfpages,eso-pic,atbegshi,pdflscape} % including tex notebooks instead
36 37
%\usepackage{titlesec} % incompatible with Koma
\usepackage{relsize}
38
\graphicspath{{./Figures/}{./Notebooks/}}
39 40 41 42 43 44 45 46 47 48

\usepackage[framemethod=default]{mdframed}
\usepackage{showexpl}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
            {-2.5ex\@plus -1ex \@minus -.25ex}%
            {1.25ex \@plus .25ex}%
            {\normalfont\normalsize\bfseries}}
\makeatother
49
\renewcommand{\linethickness}{0.05em} % temporary fix for pandoc/markdown issue  https://stackoverflow.com/q/58587918/1264299
50 51 52
\setcounter{secnumdepth}{4} 
\setcounter{tocdepth}{4}
\definecolor{light-gray}{gray}{0.95}
53 54
\definecolor{comment-color}{rgb}{0.8,0.1,0.1}
\definecolor{keyword-color}{rgb}{0.3,0.3,1}
55 56 57

\lstdefinestyle{fortran}{
  language=Fortran,
58
  basicstyle=\ttfamily\small,
59 60
  keywordstyle=\color{keyword-color},
  commentstyle=\color{comment-color},
61 62 63 64 65 66 67 68 69 70 71
  morecomment=[l]{!\ }% Comment only with space after !
  breakatwhitespace=false,
  keepspaces=true,
  showstringspaces=false,
  columns=flexible,
  backgroundcolor=\color{light-gray},
  frame=single
}

\lstdefinestyle{fortran_pseudo_code}{
  language=Fortran,
72
  basicstyle=\ttfamily\small,
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
  keywordstyle=\color{red},
  commentstyle=\normalfont\color{black},
  morecomment=[l]{!\ }% Comment only with space after !
  breakatwhitespace=false,
  keepspaces=true,
  showstringspaces=false,
  columns=flexible,
  backgroundcolor=\color{white},
  frame=single,
  escapeinside={\!*}{*)},
}

\lstdefinestyle{bash}{
  language=bash,
  basicstyle=\ttfamily,
88 89
  keywordstyle=\color{keyword-color},
  commentstyle=\color{comment-color},
90 91 92 93
  morecomment=[l]{\#\ }% Comment only with space after #
  breakatwhitespace=false,
  keepspaces=true,
  showstringspaces=false,
94 95 96
  columns=flexible,
  breaklines=true,
  postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space}
97 98 99 100 101 102 103 104
}

\def\Tr{\mathop{\mathrm{Tr}}}
\def\Trf{\mathop{\mathrm{Tr}_{\mathrm{F}}}}
\makesavenoteenv{tabular}
\makesavenoteenv{table}

% % only for the scrartcl class:
105 106
\setkomafont{author}{\large}
\setkomafont{date}{\normalsize}
107 108 109 110 111 112 113 114 115
%% \RedeclareSectionCommand[style=section,indent=0pt]{part}
%% \renewcommand*\partformat{\thepart\autodot\enskip}
\RedeclareSectionCommand[style=section,indent=0pt,font=\huge,beforeskip=4ex,afterskip=4ex]{part}
\renewcommand*\partformat{{\partname~\thepart\autodot\enskip}}
\DeclareNewSectionCommand[style=section,level=1,font=\sffamily\Large\bfseries,afterskip=2.3ex plus .2ex,beforeskip=-3.5ex plus -1ex minus -.2ex,tocindent=3.38em,tocnumwidth=2.3em]{exercise}
\renewcommand*\exerciseformat{{Exercise \theexercise~--~}}
\DeclareNewSectionCommand[style=section,level=2,font=\sffamily\large\bfseries,afterskip=1.5ex plus .2ex,beforeskip=-3.25ex plus -1ex minus -.2ex,tocindent=3.8em,tocnumwidth=3.2em]{exerciseitem}
\renewcommand*\exerciseitemformat{{\theexercise{\hspace{.2ex}}\alph{exerciseitem})~}}
\numberwithin{exerciseitem}{exercise} % reset counter ; depends on the amsmath package
116

Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
117
\newcommand{\red}[1]{{\color{red} #1}}
118 119 120
\newcommand{\mycomment}[1]{{\color{red} #1}}
\newcommand{\FAcomment}[1]{{\color{red} #1}}

121 122
%%%%%%%%%%%%%%%  -- uses package titlesec --  %%%%%%%%%%%%%%%

123
%%% tweaking the form of Part
124 125 126 127
%\titleclass{\part}{straight}                % "straght": no new page; "top" is another option
%\titleformat{\part}[block]                  % "block": no new line between "Part #."  and "<part_title>"
%{\sffamily\huge\bfseries}{\partname~\thepart.}{0.5em}{}
%\titlespacing*{\part} {0pt}{20pt}{20pt}     % {}{vertical spacing before}{vertical spacing after}
Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
128

129
%%% define section-like "exercise"
130 131 132 133 134 135 136
%\titleclass{\exercise}{straight}[\subsection]
%\newcounter{exercise}
%\titleformat{\exercise}
%%{\sffamily\Large\bfseries}{}{0em}{Exercise \Roman{part}.\theexercise~--~}
%{\sffamily\Large\bfseries}{}{0em}{Exercise \theexercise~--~}
%\titlespacing*{\exercise}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
%%\numberwithin{exercise}{part}  % reset exercise number and apend Part counter to it; depends on the amsmath package
Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
137

138
%%% define subsection-like "exerciseitem"
139 140 141 142 143 144 145 146 147 148
%\titleclass{\exerciseitem}{straight}[\subsection]
%\newcounter{exerciseitem}
%\titleformat{\exerciseitem}
%%{\sffamily\large\bfseries}{}{0em}{\Roman{part}.\theexercise.\alph{exerciseitem})~}
%{\sffamily\large\bfseries}{}{0em}{ \theexercise{\hspace{.2ex}}\alph{exerciseitem})~}
%\titlespacing*{\exerciseitem}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
%\numberwithin{exerciseitem}{exercise} % reset counter ; depends on the amsmath package

%%%%%%%%%%%%%%%  -- END of "uses package titlesec" --  %%%%%

Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
149

150
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151
\input{Notebooks/notebooks_preamble.tex}
152 153 154

\fvset{fontsize=\footnotesize}                       % To change code cells font size, from:
\RecustomVerbatimEnvironment{verbatim}{Verbatim}{}   % https://tex.stackexchange.com/a/133449/105662
155
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
156

157 158 159
\makeindex
\begin{document}
%---------------------------------------------------------------------------------------------------------
160 161 162
%\title{ ALF Tutorial \\  \smaller\smaller The \emph{ALF} (\emph{A}lgorithms for \emph{L}attice \emph{F}ermions) project release 2.0 tutorial}
\title{ ALF Tutorial }
\subtitle{The \emph{ALF} (\emph{A}lgorithms for \emph{L}attice \emph{F}ermions) project release 2.0 tutorial} % only for the scrartcl class
163 164 165 166 167
\author{Florian Goth,  Johannes S. Hofmann,  Jonas Schwab,\\  Jefferson S. E. Portela,  Fakher F. Assaad }
%---------------------------------------------------------------------------------------------------------
\maketitle


168
%\section*{Introduction}
169

170
The ALF package provides a general code for auxiliary-field Quantum Monte Carlo simulations and default analysis. In this tutorial we show how users from beginners to specialists can profit from ALF. This document is divided in two parts:
171
\begin{description}
172
\item[Part I.] The first, introductory part of the tutorial is based on ALF's python interface -- \texttt{pyALF} -- which greatly simplifies using the code, making it ideal for: \emph{obtaining benchmark} results for established models; \emph{getting started} with QMC and ALF; or just \emph{quickly running} a simulation.
173 174 175
\item[Part II.] The second part is independent of the first and aimed at more advanced users who want to simulate their own systems. It guides the user on how to modify the package's Fortran source code and presents the resources implemented to facilitate this task.
\end{description}

176
This document is intended to be self-contained, but the interested reader should check \href{https://git.physik.uni-wuerzburg.de/ALF/ALF/-/blob/master/Documentation/doc.pdf}{ALF's documentation}, which contains a thorough, systematic description of the package.
177

178 179

% Old link: \href{https://git.physik.uni-wuerzburg.de/ALF/ALF_code/blob/master/Documentation/ALF_v1.0.pdf}{ALF's documentation}
Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
180

181

182 183
%%%%%%%%%%%%%%%%%%%%
\part{Just run it}
184

185
What follows is a collection of self-explanatory Jupyter notebooks written in Python, each centered on a detailed example followed by a few simple exercises. The notebooks printed bellow can be found, together with the necessary files and an increasing number of additional notebooks exploring ALF's capabilities, in the \href{https://git.physik.uni-wuerzburg.de/ALF/pyALF}{pyALF repository}.
186 187


188
\section*{Requirements}
189

190
You can download pyALF from its repository linked above or, from the command line:
191 192 193 194 195
\begin{lstlisting}[style=bash]
git clone git@git.physik.uni-wuerzburg.de:ALF/pyALF.git
\end{lstlisting}
To run the notebooks you need the following installed in your machine:
\begin{itemize}
196
	\item Python and packages SciPy, NumPy and matplotlib
197 198 199 200
	\item Jupyter
	\item the libraries Lapack and Blas
	\item a Fortran compiler, such as \texttt{gfortran} or \texttt{ifort},
\end{itemize}
201 202 203 204 205 206
where the last two are required by the main package \href{https://git.physik.uni-wuerzburg.de:ALF}{ALF}. %, which is automatically handled by pyALF.
Also, add pyALF's path to your environment variable \texttt{PYTHONPATH}. In Linux, this can be achieved, e.g., by adding the following line to \texttt{.bashrc}:
\begin{lstlisting}[style=bash]
export PYTHONPATH="/local/path/to/pyALF:$PYTHONPATH"
\end{lstlisting}

207 208 209 210
Python and its packages can be easily installed on a variety of platforms using the Anaconda distribution -- check its \href{https://docs.anaconda.com/anaconda/install/}{installation instructions} for your system. Then, from Anaconda, you can issue the command
\begin{lstlisting}[style=bash]
conda install -c anaconda  ipython jupyterlab scipy numpy matplotlib
\end{lstlisting}
211
Anaconda is recommended due to its convenience, but the system's package management (e.g., apt-get) or Python's own package management, pip3, can be used instead if preferred -- see, for instance, SciPy \href{https://www.scipy.org/install.html}{installation instructions}.
212

213 214 215 216 217
A Fortran compiler and the libraries needed for ALF can be installed in a Debian-based Linux via
\begin{lstlisting}[style=bash]
sudo apt-get install  gfortran liblapack-dev make
\end{lstlisting}
In MacOS, gfortran can be found at \url{https://gcc.gnu.org/wiki/GFortranBinaries#MacOS}, where detailed instructions \href{https://gcc.gnu.org/wiki/GFortranBinariesMacOS}{are available}. You will need to have Xcode as well as the Apple developer tools installed.
218

219
For Windows and other Linuxes and Unixes, please check the Tutorials' repository \href{https://git.physik.uni-wuerzburg.de/ALF/ALF_Tutorial/-/blob/23fa561262cd3f6ccd99757fd8699862da635d47/README.md}{README}.
220

221
\section*{Starting}
222

223
Jupyter notebooks \href{https://jupyter.readthedocs.io/en/latest/running.html}{are run} through a Jupyter server\footnote{Note that pyALF can also be used to start a simulation from the command line, without starting a Jupyter server or using a notebook. For instance: \texttt{python3.7 Run.py -R  --alfdir /home/debian/ALF-1.2/ --config "Intel"  --executable\_R Hubbard --mpi True} starts a parallel run of the Hubbard model, using ALF compiled with \texttt{ifort}.  Notice that \texttt{Run.py} requires a configuration file  \texttt{Sims}, which defines the simulation parameters. An entry of \texttt{Sims} might read as: \texttt{ {"Model": "Hubbard", "Lattice\_type": "Square", "L1": 4, "L2": 4, "NBin": 5, "ham\_T": 0.0, "Nsweep" : 2000, "Beta": 1.0, "ham\_chem": -1.0} } } started, e.g., from the command line:
224 225 226
\begin{lstlisting}[style=bash]
jupyter notebook
\end{lstlisting}
227
(or, depending on the installation, \texttt{jupyter-notebook})
228 229 230
%\begin{lstlisting}[style=bash]
%jupyter-notebook
%\end{lstlisting}
231
which opens the ``notebook dashboard'' in your default browser, where you can navigate through your file structure to the pyALF directory. There you will find the interface's core module, \texttt{py\_alf.py}, some auxiliary files, and notebooks such as the ones included bellow. Have fun. 
232

233 234 235 236 237 238 239 240 241 242
%We note that pyALF can also be used to start a simulation from the command line, without starting a Jupyter server. For instance:
%\begin{lstlisting}[style=bash]
%python3.7 Run.py -R  --alfdir /home/debian/ALF-1.2/ --config "Intel"  --executable_R Hubbard --mpi True  &
%\end{lstlisting}
%starts a parallel run of the Hubbard model, using ALF compiled with \texttt{ifort}. 
%Notice that \texttt{Run.py} requires a configuration file  \texttt{Sims}, which defines the simulation parameters. An entry of \texttt{Sims} might read as:
%\begin{lstlisting}[style=bash]
%{ "Model": "Hubbard", "Lattice_type": "Square", "L1": 4, "L2": 4, "NBin": 5, "ham_T": 0.0, "Nsweep" : 2000, "Beta": 1.0, "ham_chem": -1.0 }
%\end{lstlisting}

243

244
\section*{Notebooks}
245

246
%\includepdf[pages=1-,pagecommand={},width=1.2\textwidth]{Notebooks/minimal_ALF_run.pdf}
247
\input{Notebooks/minimal_ALF_run-content.tex}
248

249 250 251 252 253 254
%\begin{figure}[h]
%        \begin{center}
%                \includegraphics[scale=.9]{Figures/Ener_B2.pdf}
%        \end{center}
%        \caption{ $\Delta \tau t $ extrapolation for the 4-site Hubbard ring. }
%\end{figure}
255

256 257 258 259 260 261
%\includepdf[pages=-,pagecommand={},width=1.2\textwidth]{Notebooks/trotter_error.pdf}
\input{Notebooks/trotter_error-content.tex}

% ? Include Dtau figure ?

%\includepdf[pages=1-,pagecommand={},width=1.2\textwidth]{Notebooks/testing_against_ED.pdf}
262
\input{Notebooks/testing_against_ED-content.tex}
263

264 265
%\includepdf[pages=1-,pagecommand={},width=1.2\textwidth]{Notebooks/projective_algorithm.pdf}
\input{Notebooks/projective_algorithm-content.tex}
266 267


268
\newpage
269

270
%%%%%%%%%%%%%%%%%%%%
271
\part{Getting your hands dirty - writing new code}
272 273
%\setcounter{exercise}{0}

274 275
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.
276

277
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.
Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
278

279

Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
280
\section*{Downloading the code and tutorial}
281 282
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]
283
git clone  git@git.physik.uni-wuerzburg.de:ALF/ALF.git
284
\end{lstlisting}
285 286 287
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:
288
\begin{lstlisting}[style=bash]
289
git clone  git@git.physik.uni-wuerzburg.de:ALF/ALF_Tutorial.git
290 291 292
\end{lstlisting}


Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
293 294 295 296 297

\exercise{Dimensional crossover}


\exerciseitem{Modifying the hopping}
298
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: 
299
\begin{itemize}
300
	\item Add \texttt{Ham\_Ty} to the \texttt{VAR\_Hubbard\_Plain\_Vanilla} name space in the parameter file \texttt{parameters}.
301 302
	\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}.
303
	\item Modify the hopping matrix in the subroutine \texttt{Ham\_Hop} in \texttt{Vanilla}:
304
\begin{lstlisting}[style=fortran]
305 306 307 308 309 310
Do I = 1,Latt%N
   Ix = Latt%nnlist(I,1,0)
   Op_T(1,nf)%O(I,  Ix) = cmplx(-Ham_T,    0.d0, kind(0.D0))
   Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T,    0.d0, kind(0.D0))
   If ( L2 > 1 ) then
      Iy = Latt%nnlist(I,0,1)
311
!!!!!!! Modifications for Exercise 1a
312 313 314 315 316 317 318 319 320
      !Op_T(1,nf)%O(I,  Iy) = cmplx(-Ham_T,    0.d0, kind(0.D0))
      !Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T,    0.d0, kind(0.D0))
      Op_T(1,nf)%O(I,  Iy) = cmplx(-Ham_Ty,    0.d0, kind(0.D0))
      Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_Ty,    0.d0, kind(0.D0))
!!!!!!!
   endif
   Op_T(1,nf)%O(I,  I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0))
   Op_T(1,nf)%P(i) = i 
Enddo
321 322
\end{lstlisting} 
\end{itemize}
323
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}.
324

325
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).
326 327

\noindent
328 329 330 331 332 333 334 335 336
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}.

\begin{figure}[h]
	\begin{center}
		\includegraphics[width=0.6\columnwidth]{Figures/ladder.pdf}
	\end{center}
	\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.}
	\label{fig:ladder}
\end{figure}
337

338

339

340
\exerciseitem{The SU(2) Hubbard-Stratonovich transformation} 
341 342

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.  
343 344 345 346 347



\exercise{Adding a new observable}

348
\red{[Stub]}
349

350 351 352 353 354
Here the task if to define a new observable, the kinetic energy correlation, given by
\begin{align}
&\left\langle \hat{O}_{i,\delta} \hat{O}_{j,\delta'} \right\rangle  -  \left\langle \hat{O}_{i,\delta} \right\rangle \left\langle \hat{O}_{j,\delta'} \right\rangle  =  S_O\big(i-j,\delta,\delta'\big)
\end{align}
where
355
\begin{align}
356
&\hat{O}_{i,x} = \sum_{\sigma}\left( \hat{c}^\dagger_{i,\sigma}\hat{c}^{\phantom\dagger}_{i+ax,\sigma} +H.c. \right).
357 358
\end{align}

359 360
[...]\\

361 362 363 364 365
In the 1-D Hubbard we have emergent $SO(4)$ symmetry:
\begin{align}
\left\langle \bar{S}(r)S(0) \right\rangle  &\sim  \frac{(-1)^r}{r}\ln^d(r)\\
\left\langle \hat{O}_{r,x} \hat{O}_{0,x} \right\rangle  -  \left\langle \hat{O}_{r,x} \right\rangle \left\langle \hat{O}_{0,x} \right\rangle  &\sim   \frac{(-1)^r}{r}\ln^\beta(r)
\end{align}
366
where $d=??$ and $\beta=??$ \cite{references}.
367 368 369

[It should be added to the Predefined Structures.]\\

370

371

372
\exercise{Defining a new model: The one-dimensional t-V model}
Jefferson Stafusa E. Portela's avatar
Jefferson Stafusa E. Portela committed
373 374 375


\exerciseitem{Define new model}
376 377 378

In this section, one  we will show  what modifications have to be carried out for computing the physics of the  one dimensional t-V model of spinless fermions.  
\begin{equation}
379
\hat{H} =  -t \sum_{i} \left( \hat{c}^{\dagger}_{i}  \hat{c}^{\phantom\dagger}_{i+a}      + \hat{c}^{\dagger}_{i+a}  \hat{c}^{\phantom\dagger}_{i} \right) - \frac{V}{2} \sum_{i}  \left( \hat{c}^{\dagger}_{i}  \hat{c}^{\phantom\dagger}_{i+a}      + \hat{c}^{\dagger}_{i+a}  \hat{c}^{\phantom\dagger}_{i} \right)^2 
380 381 382
\end{equation}
The above form is  readily included in the ALF since  the interaction is written in terms of a perfect square. Expanding the square  yields (up to a constant)  the desired model: 
\begin{equation}
383
\hat{H} =  -t \sum_{i} \left( \hat{c}^{\dagger}_{i}  \hat{c}^{\phantom\dagger}_{i+a}      + \hat{c}^{\dagger}_{i+a}  \hat{c}^{\phantom\dagger}_{i} \right)  + V  \sum_{i}  \left( \hat{n}_{i} - 1/2 \right)  \left( \hat{n}_{i+a} - 1/2 \right)  
384
\end{equation}
385 386 387 388 389

\red{[Mention tV Jupyter notebook.]}

\red{[To be updated:]}\\

390
In the directory  \texttt{Solutions/Exercise\_3} we have  duplicated the ALF and commented  the changes that have to be carried out to the file 
391
\texttt{Hamiltonian\_Examples.f90 }  in the \texttt{Prog}  directory so as to include the \texttt{t\_V} model. 
392 393
Here are the steps to be carried out. 
\begin{itemize}
394
\item  Add   the t-V  name space in the parameter file so as to read in the appropriate  variables.
395 396 397 398 399 400
\item  Declare new variables  in the \texttt{Hamiltonian\_Examples.f90 }   file. 
\item  In the  \texttt{Ham\_set} subroutine of the   file \texttt{Hamiltonian\_Examples.f90} set and read in the parameters for the new model, 
\texttt{t\_V}.  For  this model \texttt{NF=1} and \texttt{N\_SUN=1} since we are working with spinless fermions
\item  In the \texttt{Ham\_V}  subroutine you will have to add the new interaction.  
For a given bond at a given time-slice, we need to decouple the interaction: 
\begin{equation}
401 402 403
e^{\Delta \tau \frac{V}{2} \left( \hat{c}^{\dagger}_{i}  \hat{c}^{\phantom\dagger}_{i+a}      + \hat{c}^{\dagger}_{i+a}  \hat{c}^{\phantom\dagger}_{i} \right)^2} = 
\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} }
404 405
\end{equation}
 Here is  how this translates in the code. 
406
\begin{lstlisting}[style=fortran]
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
  
 Allocate(Op_V(Latt%N,N_FL))
 do nf = 1,N_FL
    do i  =  1, N_coord*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) )
 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.  
\end{itemize}

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}
432
\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}  
433 434
\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. 
435 436 437 438
\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 
439
    $    \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)  $
440 441 442
   (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}
443 444 445
\end{figure}


446
%\exerciseitem{Challenge}  How would you use the code to carry out simulations at $V/t < 0 $?
447 448 449


\end{document}
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488



Exercise item excluded from exercise "Dimensional crossover":

\hrule


\noindent
When running the code for the above ladder system  and analyzing the spin correlation functions, \texttt{SpinZ\_eqJR}  and \texttt{SpinXY\_eqJR}  one will notice that  it is hard restore the SU(2) spin symmetry and that very long runs are required to  obtain the desired equality
\begin{equation}
\langle S^{z}_{i} S^{z}_{j}  \rangle  = \langle S^{y}_{i} S^{y}_{j}  \rangle  = \langle S^{x}_{i} S^{x}_{j}  \rangle. 
\end{equation}
The structure of the output files \texttt{SpinZ\_eqJR}  and \texttt{SpinXY\_eqJR}  is described in the doucmentation.  For the Mz Hubbard-Stratonovitch transformation it  is hence better to consider the improved estimator 
\begin{equation}
\langle \vec{S}_{i}  \cdot \vec{S}_{j}  \rangle
\end{equation}
to compute the spin-spin correlations. 


Here the aim is to include  the new observable equal time observable  $\langle \vec{S}_{i}  \cdot \vec{S}_{j}  \rangle$ in the  \texttt{Hubbard\_Mz} code. 
To achieve this, you will have to carry  out the following steps. 
\begin{itemize}
	\item In the  subroutine \texttt{Alloc\_obs}  in the \texttt{Hamiltonian\_example.f90}  file you will have to add  a new equal time observable with a call to 
	\texttt{Call Obser\_Latt\_make(Obs\_eq(I),Ns,Nt,No,Filename)}  with \texttt{Ns = Latt\%N;  No = Norb;  Filename ="SpinT", Nt=1, I=5}
	\item  In the subroutine \texttt{Obser}  you will have to add the Wick decomposition of this observable.  
\end{itemize}
In the program \texttt{Hamiltonian\_Examples.f90 }  to be found in the directory  \texttt{Solutions/Exercise\_2/Prog/}   we have commented the changes that have to be carried out to add this   observable.  The new variable takes the name SpinT and the results you should obtain are summarized in  Fig.~\ref{Ladder.fig}.

\begin{figure}[h]
	\begin{center}
		\includegraphics[scale=.8]{Ladder.pdf}
		\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.}
		\label{Ladder.fig}
	\end{center}
\end{figure}