\documentclass[../ising_model.tex]{subfiles} \begin{document} \section{Methods}\label{sec:methods} \subsection{The Ising model}\label{sec:ising_model} % Add definitions The Ising model correspond to a lattice with a number of spin sites, where each spin has the possible state up $\uparrow$ or down $\downarrow$. We will study the two-dimensional Ising model for ferromagnets, however, the model is not resticted to this dimentionality~\cite[p. 3]{obermeyer:2020:ising}. We will assume a square lattice, where the length $L$ of the lattice give the number of spin sites $N = L^{2}$. When we consider the entire 2D lattice we can study the system spin configuration, or the microstate, given by $\mathbf{s} = (s_{1}, s_{2}, \dots, s_{N})$. The value of each spin $s_{i}$, where $i \in [1, N]$, is given by the direction of the spin $\uparrow = +1$ and $\downarrow = -1$. We find the total energy of the system using \begin{equation}\label{eq:energy} E(\mathbf{s}) = -J \sum_{\langle k l \rangle}^{N} s_{k} s_{l} \end{equation} where $\langle k l \rangle$ denotes the neighboring spins. The total magnetization of the system is given by \begin{equation}\label{eq:magnetization} M(\mathbf{s}) = \sum_{i}^{N} s_{i}, \end{equation} with degeneracy denoting how many states have the same values. We will consider a 2D lattice with $L = 2$, with periodic boundary conditions, following the counting pattern shown in figure~\ref{fig:tikz_counting}. The resulting values for the $2 \times 2$ lattice can be found in table \ref{tab:lattice_config}. \begin{table}[H] \centering \begin{tabular}{cccc} % @{\extracolsep{\fill}} \hline Spins up & $E(\mathbf{s})$ & $M(\mathbf{s})$ & Degeneracy \\ \hline 4 & -8J & 4 & 1 \\ 3 & 0 & 2 & 4 \\ \multirow{2}*{2} & 0 & 0 & 4 \\ & 8J & 0 & 2 \\ 1 & 0 & -2 & 4 \\ 0 & -8J & -4 & 1 \\ \hline \end{tabular} \caption{Values} \label{tab:lattice_config} \end{table} Probability stuff, for a system with a given temperature $T$. We use the Boltzmann distribution in the analytical expression, to compare with our results. This is a probability distribution from the family of exponential \begin{equation}\label{eq:boltzmann_distribution} p(\mathbf{s} \ | \ T) = \frac{1}{Z} \exp^{-\beta E(\mathbf{s})}, \end{equation} where $Z$ is the partition function $\beta$ is the related to the inverse of the temperature as \begin{equation}\label{eq:beta} \beta = \frac{1}{k_{\text{B}} T}. \end{equation} We derive an analytical expression for $Z$ in appendix \ref{sec:analytical_expressions} We will assume a $2 \times 2$ lattice to study the possible system states, and to find analytical expressions necessary in the Markov Chain Monte Carlo method. These results are used to test our code during implementation. We study the 2D lattice and find the total energy and the total magnetization of of the system, in addition to the degeneracy. In addition, we want to work with unitless spins. To obtain this, we introduce the base unit for energy $J$, and with the Boltzmann constant we derive other units necessary. The resulting units can be found in table \ref{tab:units}. % Problem 1 \begin{equation}\label{eq:partition_function} Z = 4 \cosh (8 \beta J) + 12, \end{equation} % \begin{equation}\label{eq:energy_spin_first} \langle \epsilon \rangle = \frac{-2J \sinh(8 \beta J)}{ \cosh(8 \beta J) + 3} \end{equation} % \begin{equation}\label{eq:energy_spin_second} \langle \epsilon^{2} \rangle = \frac{4 J^{2} \cosh(8 \beta J)}{\cosh(8 \beta J) + 3} \end{equation} % \begin{equation}\label{eq:magnetization_spin_first} \langle |m| \rangle = \frac{e^{8 \beta J} + 1}{2( \cosh(8 \beta J) + 3)} \end{equation} % \begin{equation}\label{eq:magnetization_spin_second} \langle |m|^{2} \rangle = \frac{e^{8 \beta J} + 1}{2( \cosh(8 \beta J) + 3)} \end{equation} % \begin{equation}\label{eq:energy_total_first} \langle E \rangle = -\frac{8J \sinh(8 \beta J)}{\cosh(8 \beta J) + 3} \end{equation} % \begin{equation}\label{eq:energy_total_first_squared} \langle E \rangle^{2} = \frac{64J^{2} \sinh^{2}(8 \beta J)}{(\cosh(8 \beta J) + 3)^{2}} \end{equation} % \begin{equation}\label{eq:energy_total_second} \langle E^{2} \rangle = \frac{64J^{2} \cosh(8 \beta J)}{\cosh(8 \beta J) + 3} \end{equation} % \begin{equation}\label{eq:magnetization_total_first} \langle |M| \rangle = \frac{2(e^{8 \beta J} + 2)}{\cosh(8 \beta J) + 3} \end{equation} % \begin{equation}\label{eq:magnetization_total_first_squared} \langle |M| \rangle^{2} = \frac{4(e^{8 \beta J} + 2)^{2}}{(\cosh(8 \beta J) + 3)^{2}} \end{equation} % \begin{equation}\label{eq:magnetization_total_second} \langle M^{2} \rangle = \frac{8(e^{8 \beta J} + 1)}{\cosh(8 \beta J) + 3} \end{equation} % \begin{equation}\label{eq:specific_heat_capacity} C_{V} = \frac{64J^{2} }{N k_{\text{B}} T^{2}} \frac{(3\cosh(8 \beta J) + 1)}{(\cosh(8 \beta J) + 3)^{2}} \end{equation} % \begin{equation}\label{eq:sesceptibility} \chi = \frac{4}{N k_{\text{B}} T} \frac{(3e^{8 \beta J} + e^{-8 \beta J} + 3)}{(\cosh(8 \beta J) + 3)^{2}} \end{equation} The derivation of analytical expressions can be found in appendix \ref{sec:analytical_expressions}. \subsection{Markov Chain Monte Carlo methods}\label{sec:mcmc_methods} \subsection{Algorithm and implementation}\label{sec:algo_implementation} \subsection{Tools}\label{sec:tools} The Ising model and MCMC methods are implemented in C++, and parallelized using \verb|OpenMP| \cite{openmp:2018}. We used the Python library \verb|matplotlib| \cite{hunter:2007:matplotlib} to produce all the plots, and \verb|seaborn| \cite{waskom:2021:seaborn} to set the theme in the figures. \subsection{Draft} Def: Correlation length $\xi$ of phase transition, and is related to the spin-correlation function which defines the magnetic susceptibility. The spin-correlation function is the covariance of the magnetization, expressing the degree of correlation between spins. $\xi$ is normally finite at critical points. Proportional to the lattice size at the critical point, can be used to relate behavior for infinitly large lattice $T_{C}(L) - T_{C}(L = \infty) = \propto \alpha T^{-1}$ Implementation: The metropolis algo only consider ratio, not necessary to calculate partition function. Metropolis algo: \begin{algorithm}[H] \caption{Metropolis algorithm p. 435 in lecture notes} \label{algo:metropolis_algo} \begin{algorithmic} \Procedure{Metropolis algorithm}{$args$} \State $E_{\text{before}} \leftarrow \text{Set initial random state}$ \State $ \text{Flip spin}$ \State $E_{\text{after}} \text{Calculate energy}$ \State $\Delta E \leftarrow E_{\text{after}} - E_{\text{before}}$ \If{$\Delta E \leq 0$} Accept new config if \State $\text{Update expectation values}$ \ElsIf{$\Delta E > 0$} \State $\text{Calculate}$ \EndIf \EndProcedure \end{algorithmic} \end{algorithm} Probability: Using the expectation value require a stochastic random variable X (stoch being that it is tied to an event), a function from the "utfallsrommet" to the real numbers. Understanding a systems properties close to a critical point. For the 2D ising model, where L is large, we can observe discontinuity in $C_{V}$ and $\chi$. They diverge at the critical point in the thermosynamic limit, meaning the variance in energy and magnetization diverge. For lattice of finite size the variance scale as $1 / \sqrt{M}$ where $M = 2^{N}$ is the number of microstates. \begin{align*} e^{-\beta \Delta E} &= \frac{p_{after}}{p_{before}} = \frac{e^{-\beta E_{after}}}{e^{-\beta E_{before}}} \end{align*} \end{document}