\documentstyle[a4wide,12pt]{article}

\begin{document}
\section*{Introduction to numerical projects}

Here follows a brief recipe and recommendation on how to write a report for each
project.
\begin{itemize}
\item Give a short description of the nature of the problem and the eventual 
numerical methods you have used.
\item Describe the algorithm you have used and/or developed. Here you may find it convenient
to use pseudocoding. In many cases you can describe the algorithm
in the program itself.

\item Include the source code of your program. Comment your program properly.
\item If possible, try to find analytic solutions, or known limits
in order to test your program when developing the code.
\item Include your results either in figure form or in a table. Remember to
       label your results. All tables and figures should have relevant captions
       and labels on the axes.
\item Try to evaluate the reliabilty and numerical stability/precision
of your results. If possible, include a qualitative and/or quantitative
discussion of the numerical stability, eventual loss of precision etc. 

\item Try to give an interpretation of you results in your answers to 
the problems.
\item Critique: if possible include your comments and reflections about the 
exercise, whether you felt you learnt something, ideas for improvements and 
other thoughts you've made when solving the exercise.
We wish to keep this course at the interactive level and your comments can help
us improve it.
\item Try to establish a practice where you log your work at the 
computerlab. You may find such a logbook very handy at later stages
in your work, especially when you don't properly remember 
what a previous test version 
of your program did. Here you could also record 
the time spent on solving the exercise, various algorithms you may have tested
or other topics which you feel worthy of mentioning.
\end{itemize}



\section*{Format for electronic delivery of report and programs}
%
The preferred format for the report is a PDF file. You can also
use DOC or postscript formats. 
As programming language we prefer that you choose between C/C++ and Fortran90/95.
You could also use Java or Python as programming languages. 
Matlab/Maple/Mathematica/IDL are not allowed as programming
languages for the handins, but you can use them to check your results where possible.
The following prescription should be followed when preparing the report:
\begin{itemize}
\item Use Classfronter to hand in your projects, log in  at 
blyant.uio.no and choose 'fellesrom fys3150 og fys4150'.
Thereafter you will see an icon to the left with 'hand in' or 'innlevering'.
Click on that icon and go to the given project. 
There you can load up the files within the deadline.
\item Upload {\bf only} the report file and the source code file(s) you have developed.
The report file should include all of your discussions and a list of the codes you have developed. 
Do not include library files which are available at the course homepage, unless you have
made specific changes to them.
\item Comments  from us on your projects, approval or not, corrections to be made 
etc can be found under
your Classfronter domain and are only visible to you and the teachers of the course.

\end{itemize}
Finally, 
we do prefer that you work two and two together. Optimal working groups consist of 
2-3 students. You can then hand in a common report. 

\section*{Project 4, Ising model in two dimensions, deadline  6 november  12am (midnight)}
For this project you can build upon program programs/chapter10/ising\_2dim.cpp (or the f90 version).

The projects deals with the Ising model in two dimensions, without an external magnetic 
field. In its simplest form
the energy is expressed as
\begin{equation}
  E=-J\sum_{<kl>}^{N}s_ks_l
\end{equation}
with  $s_k=\pm 1$, $N$ is the total number of spins, 
$J$ is a coupling constant expressing the strength of the interaction
between neighboring spins and 
$B$ is an external magnetic field interacting with the magnetic
moment set up by the spins.
The symbol $<kl>$ indicates that we sum over nearest
neighbors only. We will assume that we have a ferromagnetic ordering, viz $J> 0$.
We will use periodic boundary conditions and the Metropolis algorithm only. 
\begin{enumerate}
\item[a)] We want first to perform a study of the time (here it corresponds to the number 
of Monte Carlo cycles) one needs before one reaches an equilibrium situation 
and can start computing various expectations values. The first attempt is a plain graphical
one, where we plot various expectations values as functions of the number of Monte Carlo cycles.

We choose a square lattice with $L=40$ spins in the $x$ and $y$ directions.
Choose first a temperature of $T=1.5$ (in units of $kT/J$) and study the 
mean energy and magnetisation (absolute value) as functions of the number of Monte Carlo cycles.
Use both an ordered (all spins pointing in one direction) and a random
spin orientation as starting configuration. 
How many Monte Carlo cycles do you need before you reach an equilibrium situation?
Repeat this analysis for $T=2.5$. Try also different seeds for the random
number generators. 


\item[b)] This part is optional: The previous analysis is rather rough and obviously user dependent, in the sense that it is
very much up to the user to define when an equilibrium situation has been reached.
To improve upon this, compute the so-called time autocorrelation function defined here as
\[
\phi(t)  = \frac{1}{t_{\mathrm{max}}-t}\sum_{t'=0}^{t_{\mathrm{max}}-t}{\cal M}(t'){\cal M}(t'+t)
-\frac{1}{t_{\mathrm{max}}-t}\sum_{t'=0}^{t_{\mathrm{max}}-t}{\cal M}(t')\times
\frac{1}{t_{\mathrm{max}}-t}\sum_{t'=0}^{t_{\mathrm{max}}-t}{\cal M}(t'+t)
\]
for the mean magnetisation ${\cal M}(t)$ (absolute value) and plot it for the two temperatures
in [a) as function of the number of Monte Carlo steps per site. 
Time $t$ corresponds to a given number of Monte Carlo cycles.
Discuss your results.
Can you extract an equilibration measure?
\newline\newline
Near $T_C$ we can characterize the behavior of many physical quantities
by a power law behavior.
As an example the mean magnetization is given by
\begin{equation}
  \langle {\cal M}(T) \rangle \sim \left(T-T_C\right)^{\beta},
\end{equation}
where $\beta=1/8$ is a so-called critical exponent. A similar relation
applies to the heat capacity 
\begin{equation}
  C_V(T) \sim \left|T_C-T\right|^{\alpha},
\end{equation}
and the susceptibility
\begin{equation}
  \chi(T) \sim \left|T_C-T\right|^{\gamma},
\end{equation}
with $\alpha = 0$ and $\gamma = 7/4$.
Another important quantity is the correlation length, which is expected
to be of the order of the lattice spacing for $T>> T_C$. Because the spins
become more and more correlated as $T$ approaches $T_C$, the correlation
length increases as we get closer to the critical temperature. The divergent
behavior of $\xi$ near $T_C$ 
is
\begin{equation}
  \xi(T) \sim \left|T_C-T\right|^{-\nu}.
  \label{eq:xi}
\end{equation}
A second-order phase transition is characterized by a
correlation length which spans the whole system.
Since we are always limited to a finite lattice, $\xi$ will
be proportional with the size of the lattice. 
Through so-called finite size scaling relations
it is possible to relate the behavior at finite lattices with the 
results for an infinitely large lattice.
The critical temperature scales then as
\begin{equation}
 T_C(L)-T_C(L=\infty) \sim aL^{-1/\nu},
 \label{eq:tc}
\end{equation}
with  $a$ a constant and  $\nu$ defined in Eq.~(\ref{eq:xi}).
We set $T=T_C$ and obtain a mean magnetisation
\begin{equation}
  \langle {\cal M}(T) \rangle \sim \left(T-T_C\right)^{\beta}
  \rightarrow L^{-\beta/\nu},
  \label{eq:scale1}
\end{equation}
a heat capacity
\begin{equation}
  C_V(T) \sim \left|T_C-T\right|^{-\gamma} \rightarrow L^{\alpha/\nu},
  \label{eq:scale2}
\end{equation}
and susceptibility
\begin{equation}
  \chi(T) \sim \left|T_C-T\right|^{-\alpha} \rightarrow L^{\gamma/\nu}.
  \label{eq:scale3}
\end{equation}


\item [c)]  We wish to study the behavior of the Ising model in two dimensions close to the 
critical temperature as a function of the lattice size $L\times L$.
Calculate the expectation values 
for $\langle E\rangle$ and $|\langle {\cal M}\rangle|$,
the specific heat $C_V$ and the susceptibility $\chi$
as functions  of $T$ for $L=20$, $L=40$, $L=60$ and $L=80$ for $T\in [2.0,2.4]$
with a step in temperature $\Delta T=0.05$. 
Plot  $\langle E\rangle$, $\langle {\cal M}\rangle$, $C_V$ and $\chi$ 
as functions of $T$. Can you see an indication of a phase transition?
\item[d)]  Use Eq.~(\ref{eq:tc}) and the exact result
$\nu=1$ in order to estimate $T_C$ in the thermodynamic limit $L\rightarrow \infty$
using your simulations with $L=20$, $L=40$, $L=60$ and $L=80$
\item[e)]  In the remaining part we will use the exact result 
$kT_C/J=2/ln(1+\sqrt{2})\approx 2.269$ and $\nu=1$.
Determine the numerical values of
$C_V$, $\chi$ and ${\cal M}$ at the exact value $T=T_C$
for  $L=20$, $L=40$, $L=60$ and $L=80$.
Plot $log_{10}$ ${\cal M}$
and $\chi$ as function of $log_{10}$  $L$
and use the scaling relations of 
Eqs.~(\ref{eq:scale1}) and (\ref{eq:scale3}) in order to determine the constants
$\beta$ and $\gamma$. 
Are your log-log plots close to straight lines?
The exact values are $\beta=1/8$ and $\gamma=7/4$.
\item[e)]    Make a log-log plot using results for 
$C_V$ as function of  $L$. 
In this case you should not get a straight line since the specific heat exhibits a logarithmic divergence
with  $\alpha=0$.
The specific heats behaves as
\[
C_V \approx -\frac{2}{k_B\pi}\left(\frac{J}{T_C}\right)^2ln\left|1-\frac{T}{T_C}\right|+\mathrm{const}.
\]
Do your results agree with this behavior?


\end{enumerate}


\end{document}














