Jekyll2021-05-06T07:43:18-07:00https://shiling42.github.io/feed.xmlShiling Liang PhD student in Physics@LBS, EPFLShiling Liang 梁师翎shiling.liang@epfl.chNotes on Fluctuation Theorems2018-11-14T00:00:00-08:002018-11-14T00:00:00-08:00https://shiling42.github.io/posts/2018/11/Notes-on-Fluctuation-Theorems<p><a href="/files/Fluctuation_Theorems.pdf">Get the PDF</a></p>
<h2 id="abstract">Abstract</h2>
<p>These notes are based on the review article by E.M Sevick et al[1]. on the fluctuation theorem. I also refer to the original papers of Jarzynski[2-4] and adopt notation from a book written by Evans et al.[5]. I discuss the motivation for proposing the fluctuation theorem and provide a detailed derivation of the Evans-Searles Fluctuation Theorem, which shows how macroscopic irreversibility emerged from the time-symmetrical equation of motion and addresses the importance of the initial condition of the system. I also recap the derivation the Crooks Fluctuation Theorem to relate work and free energy of a non-quasistatic process between two states of equilibrium, and I then take the Jarzynski equality as a consequence of the Crooks Fluctuation Theorem. In the section of examples, it is shown that a simple physical example with an analytical solution can be used to verify these relations.</p>
<h2 id="introduction">Introduction</h2>
<p>Fluctuation theorems present an analytical description of violations of the second law of thermodynamics; however, they also provide rigorous proof to this law from a statistical perspective. Classical thermodynamics can only deal with equilibrium systems and quasistatic processes. The behaviours of non-equilibrium systems are unclear within this scheme. Moreover, reversible equations of motion conflict with the monotonically increasing entropy predicted by the second law. Boltzmann’s statistical thermodynamics provides the groundwork for solving this problem by using the second law as a statistical law. However, he was not able to determine a quantitive relation. The most recent progress toward this end was the development of the fluctuation theorem in the 1990s.</p>
<p>In 1994, Evans and Searles proposed the fluctuation theorem[6], which calculates the probability of negative and positive entropy production. It is valid for systems of any size and with arbitrary distances from equilibrium. It illustrates how irreversible macroscopic phenomena emerge from time-reversible equations of motion. In 1997, Jarzynski developed a more practical relation[2], the Jarzynski equality, which allows us to establish the relationships between work and free energy changes for a non-quasistatic process between two states of equilibrium. This relation reveals more information than do classical thermodynamics, which only reveals discrepancies between work and free energy differences.
The next year, Crooks developed a more general form of the Jarzynski equality: the Crooks Fluctuation Theorem[7]. This theorem calculates the relative probability of given forward and backward trajectories.</p>
<p>In this report, I recap the derivations of these relations based on a deterministic Hamiltonian system. I include a short introduction to phase spaces at the beginning and then follow the logical order rather than the chronological order of theorem development (which regards the Jarzynski equality as a consequence of the Crooks Fluctuation Theorem). It is also demonstrated how to view the second law of thermodynamics is a consequence of the fluctuation theorem.</p>
<h2 id="derivation-of-fluctuation-theorems">Derivation of Fluctuation Theorems</h2>
<h3 id="phase-space-and-liouvilles-equation">Phase space and Liouville’s Equation</h3>
<p>In Hamiltonian mechanics, all possible states of a system expanded a phase space. A typical system in our scale has more than $\sim 10^{23}$ particles. Thus, it is not possible to know their exact configurations, so we use a probability distribution function to characterise such systems. By denoting the probability distribution function as $f(\Gamma,t)$, the probability of finding the system in an infinitesimal phase space volume $\mathrm{d}\Gamma$ is</p>
\[P(\mathrm{d}\Gamma_t,t)\equiv
f(\Gamma_t,t)\mathrm{d}\Gamma_t.\]
<p>For a Hamiltonian system, the total time derivative of $f$ is</p>
\[\begin{equation}
\begin{aligned}
\frac{\mathrm{d}f}{\mathrm{d}t}
=\frac{\partial f}{\partial t}+\frac{\partial f}{\partial p}\dot{p}+\frac{\partial f}{\partial q}\dot{q}\\
=\frac{\partial f}{\partial t}+\frac{\partial f}{\partial \Gamma}\cdot \dot\Gamma.
\end{aligned}
\end{equation}\]
<p>The continuity equation must hold for the probability flow in the phase space</p>
\[\frac{\partial (f\dot{\Gamma})}{\partial \Gamma}+\frac{\partial f}{\partial t}=0.\]
<p>Using these two equations to eliminate the partial derivative of $t$, one obtains</p>
\[\frac{\mathrm{d} f}{\mathrm{d} t}=-f\frac{\partial \dot{\Gamma}}{\partial \Gamma}.\]
<p>We now denote $\Lambda \equiv\frac{\partial \dot\Gamma}{\partial \Gamma}$, and integrate from the initial time $t=0$ to $t=\tau$</p>
\[f(\Gamma_\tau,\tau)=f\left(\Gamma_0,0\right)\exp\left(-\int_0^\tau \Lambda\mathrm{d}t\right).\]
<p>As the probability of a specific phase space volume must be conserved, we can use the equation of probability evolution and Liouville equation to obtain the compression factor for the infinitesimal phase space volume:
\(\frac{\mathrm{d}\Gamma_\tau}{\mathrm{d}\Gamma_0}=\exp\left(\int_0^\tau\Lambda\mathrm{d}s\right).\)</p>
<h3 id="the-evans-searles-fluctuation-theorem-1994">The Evans-Searles Fluctuation Theorem (1994)</h3>
<p>The Evans-Searles fluctuation theorem is the most general one, and it can be applied to a system of any size and any distance from equilibrium.</p>
<p>Using time evolution operator $S^t$ to denote the evolution of a phase space point for a period $t$ and time-reversal mapping operator $M^T$ to reverse the trajectory. For a Hamiltonian system, the reverse mapping is noting but reversing the momentum $p\to -p$. Since the dynamics are deterministic, a trajectory can be determined by its initial state. For a trajectory origin at phase point $\Gamma_0$, the corresponding anti-trajectory can be easily represented by its initial phase point $\Gamma^*_0 \equiv M^T\Gamma_t=M^T S^\tau\Gamma_0$. Note that the time-reversal mapping does not change the size of phase space volume. With equation (3), we can obtain</p>
\[\mathrm{d}\Gamma_0^*=\mathrm{d}\Gamma_\tau=\mathrm{d}\Gamma_0\exp\left(\int_0^\tau \Lambda\mathrm{d}t\right).\]
<p>Alongside the trajectory of a single-phase space point, we also consider the evolution of an infinitesimal phase space volume $d\Gamma_0$; that is, a bundle of trajectories. The probability of observing this volume is</p>
\[P(\mathrm{d}\Gamma_0,0)\equiv \mathrm{d}\Gamma_0 f(\Gamma_0,0) .\]
<p>Macroscopic reversible systems indicate that the probability of observing the forward bundle of trajectories and the corresponding anti-trajectories should be the same:</p>
\[\mathrm{d}\Gamma_0 f(\Gamma_0,0) =\mathrm{d}\Gamma^*_0 f(\Gamma^*_0,0).\]
<p>For more general cases, we define a dissipation function to characterize the reversibility of the bundle of trajectories</p>
\[\begin{aligned}
\Omega_\tau(\Gamma_0)
\equiv \ln\left(\frac{P(\mathrm{d}\Gamma_0,0)}{P(\mathrm{d}\Gamma_0^*,0)}\right)\\
=\ln\left(\frac{f(\mathrm{d}\Gamma_0,0)}{f(\mathrm{d}\Gamma_0^*,0)}\right)-\int_0^\tau \Lambda\mathrm{d}t.
\end{aligned}\]
<p>The positive dissipation function means the anti-trajectories are less probable, and the negative dissipation function gives the opposite case. It takes the value $0$ only in the state of equilibrium, where no macroscopic time evolution can be observed. Moreover, the dissipation function has odd parity</p>
\[\Omega_\tau(\Gamma_0)=-\Omega_\tau(\Gamma_0^*).\]
<p>Now it is important to calculate the probability of an anti-trajectory occurring within the entire phase space. We can do the following integral to calculate the relative probability of the dissipation function taking the opposite value.</p>
\[\begin{aligned}
\frac{p(\Omega_\tau= A)}{p(\Omega_\tau= -A)}\\
=\frac{\int\mathrm{d}\Gamma_0\delta(\Omega_\tau(\Gamma_0)-A)f(\Gamma_0,0)}{\int\mathrm{d}\Gamma_0^*\delta(\Omega_\tau(\Gamma_0^*)+A)f(\Gamma_0^*,0)}\\
=\frac{\int\mathrm{d}\Gamma_0\delta(\Omega_\tau(\Gamma_0)-A)f(\Gamma_0,0)}{\int\mathrm{d}\Gamma_0^*\delta(-\Omega_\tau(\Gamma_0)+A)f(\Gamma_0^*
,0)}\\
=\frac{\int\mathrm{d}\Gamma_0\delta(\Omega_\tau(\Gamma_0)-A)f(\Gamma_0,0)}{\int\mathrm{d}\Gamma_0\delta(-\Omega_\tau(\Gamma_0)+A)f(\Gamma_0,0)\exp(-{\Omega}_\tau(\Gamma_0))}\\
=\exp(A),
\end{aligned}\]
<p>where we used the fact that $\Gamma_0$ is a dummy variable for the integral over the whole phase space. Then we used the fact that the dissipation function is odd. To calculate the third equality, we used the equation phase compression factor with the definition of the dissipation function. The result,</p>
\[\frac{p(\Omega_\tau=A)}{p(\Omega_\tau=-A)}=\exp(A),\]
<p>implies that for all trajectories in the phase space, irreversible cases are exponentially more probable than are reversible cases. We can further calculate the average of the dissipation function over the whole phase space:</p>
\[\begin{aligned}
\langle \exp(-{\Omega}_\tau) \rangle
=\int_{-\infty}^\infty \mathrm{d}A\ \exp(-A)p({\Omega}_\tau=A)\\
=\int_{-\infty}^\infty \mathrm{d}A\ \exp(A)p(-{\Omega}_\tau)\exp(A)\\
=\int_{-\infty}^\infty \mathrm{d}A\ p({\Omega}_\tau=-A)\\
=1.
\end{aligned}\]
<p>Note that $\exp(-\Omega_\tau)$ is a convex function, which leads to the Jensen’s inequality</p>
\[\langle \Omega_\tau\rangle \geq 0.\]
<p>This is exactly what we expect – the second law inequality.</p>
<h3 id="crooks-fluctuation-theorem-1998">Crooks Fluctuation Theorem (1998)</h3>
<p>Crooks Fluctuations Theorem and the Jarzynski equality address the non-equilibrium processes between two equilibriums (unlike classical thermodynamics, which can only describe quasistatic work relations). Jarzynski equality directly presents the work relation regarding actions performed at any rate. The Crooks Fluctuation Theorem even measures the probability distribution of trajectories. These relations allow us to describe certain microscopic operations, such as the stretching of a polymer.</p>
<p>The Crooks Fluctuation Theorem was developed later than the Jarzynski equality. However, as it is a more general formula, we view the Jarzynski equality as a direct consequence of the Crooks Fluctuation Theorem in the following discussion. The Crooks Fluctuation Theorem reads</p>
\[\frac{p_f(W=\mathcal{A})}{p_r(W=-\mathcal{A})}=\exp\left(\beta(\mathcal{A}-\Delta F)\right),\]
<p>where $p_f(W=\mathcal{A})$ is the probability of work done on the system $W=\mathcal{A}$ between the initial equilibrium state $A$ to the final equilibrium state $B$. Additionally, $p_B(W=\mathcal{A})$ is the probability distribution of the reverse trajectories. On the right-hand side, $\Delta F$ is the free energy difference between the two states and $\beta\equiv\frac{1}{k_BT} $ is the reverse temperature of the heat bath.</p>
<p>The external work is introduced by a control parameter $\lambda$. The Hamiltonian of the system can be written as</p>
\[H(\Gamma_t,t,\lambda_t)=T(\mathbf{p})+V(\mathbf{q},\lambda),\]
<p>where $T$ and $V$ are the kinetic energy and the potential, respectively. The potential can be adjusted by the external control parameter $\lambda$ and varies from the initial value $\lambda=A$ to the final value $\lambda=B$. If it varies slowly enough, it becomes a trivial quasistatic case. In more general cases, an external agent drives the system out of equilibrium before it relaxes into a state of equilibrium once again.</p>
<p>Initially, the system is in contact with a heat bath at a temperature of $T=\frac{1}{k_B\beta}$. Thus, it is a canonical ensemble characterised by the Boltzmann probability distribution:</p>
\[p(H(\Gamma_0,A))=\frac{1}{Z_A}e^{-\beta H(\Gamma_0,A)}.\]
<p>Then the $\lambda$ varies from an initial value of $A$ to final value of $B$ in a specific protocol. The final equilibrium state has the probability distribution</p>
\[p(H(\Gamma_\tau,B))=\frac{1}{Z_B}e^{-\beta H(\Gamma_\tau,B)},\]
<p>and the change of Hamiltonian can be written as</p>
\[H(\Gamma_\tau,B)-H(\Gamma_0, A)=\int_0^\tau \mathrm{d}t \ \frac{\partial H(\Gamma,\lambda)}{\partial\lambda}\dot\lambda +\frac{\partial H(\Gamma,\lambda)}{\partial{\Gamma}}\cdot\dot{\Gamma}\]
<p>The first term of the integral is the total work done on the system, and the second term is the heat absorbed from the environment[8].</p>
\[\begin{aligned}
Q(\Gamma_0,\tau)\equiv\int_0^\tau\mathrm{d}t\ \frac{\partial H(\Gamma,\lambda)}{\partial{\Gamma}}\cdot\dot{\Gamma}=k_BT\int_0^\tau
\Lambda(\Gamma_t) \mathrm{d}t\\
W(\Gamma_0,\tau)\equiv \int_0^\tau\mathrm{d}t\ \frac{\partial H(\Gamma,\lambda)}{\partial\lambda}\cdot\dot\lambda.
\end{aligned}\]
<p>Hence, we can express the work done as a function of the energy difference associated with the initial and the final states, and we can express the phase space compression factor as</p>
\[W(\Gamma_0,\tau)=H(\Gamma_\tau,B)-H(\Gamma_0, A)-k_BT\int_0^\tau\Lambda(\Gamma_t)\mathrm{d}t.\]
<p>As time evolution is deterministic for a Hamiltonian system, the probability distribution of trajectories with $W=\mathcal{A}$ is directly determined by the initial distribution function associated with the work parameter $\lambda=A$
\(p_f(W=\mathcal{A})
=\int d\Gamma_0\delta(W(\Gamma_0,\tau)-\mathcal{A}) p(H(\Gamma_0,A)).\)
In the same way, we can write the probability of the anti-trajectories during which the system does work $\mathcal{A}$ to the external agent:</p>
\[p_b(W=-\mathcal{A})=\int d\Gamma_0^*\delta(W(\Gamma_0^*,A)+\mathcal{A}) p(H(\Gamma_0^*,B)).\]
<p>Based on the results obtained, we can write the relative probability as</p>
\[\begin{aligned}
\frac{p_f(W=\mathcal{A})}{p_b(W=-\mathcal{A})}\\
=\frac{\int d\Gamma_0\delta(W(\Gamma_0,\tau)-\mathcal{A}) p(H(\Gamma_0,A))}{\int d\Gamma_0^*\delta(W(\Gamma_0^*,\tau)+\mathcal{A}) p(H(\Gamma_0^*,B))}\\
=\frac{Z_B}{Z_A}\frac{\int d\Gamma_0\delta(W(\Gamma_0,\tau)-\mathcal{A}) e^{-\beta H(\Gamma_0, A)}}{\int d\Gamma_0^*\delta(W(\Gamma_0^*,\tau)+\mathcal{A}) e^{-\beta H(\Gamma_0^*,B)}}\\
=\frac{Z_B}{Z_A}\frac{\int d\Gamma_0\delta(W(\Gamma_0,\tau)-\mathcal{A}) e^{-\beta H(\Gamma_0, A)}}{\int d\Gamma_0\delta(W(\Gamma_0,\tau)-\mathcal{A}) e^{-\beta H(\Gamma_0,A)}e^{-\beta W(\Gamma_0,\tau)}}\\
=\frac{Z_B}{Z_A}e^{\beta \mathcal{A}}\\
=\exp\left({-\beta\Delta F+\beta \mathcal{A}}\right),
\end{aligned}\]
<p>where the first equality is a direct substitution of forward and backwards probability. Then writing explicitly the equilibrium distribution leads to the second equality. To get the third equality, we used the work related to rewrite the denominator. With some simplification, we reach the final expression which is so-called Crooks fluctuation relation</p>
\[\frac{p_f(W=\mathcal{A})}{p_b(W=-\mathcal{A})}=\exp\left({-\beta\Delta F+\beta \mathcal{A}}\right).\]
<h3 id="jarzynski-equality-1997">Jarzynski equality (1997)</h3>
<p>As we mentioned before, Jarzynski equality can be regarded as a direct consequence of Crooks fluctuation theorem. With this probability distribution of trajectories given by Crooks FT, we can calculate the Jarzynski average of the work done on the system between initial and final state associated with $\lambda = A$ and $\lambda = B$</p>
\[\begin{aligned}
\langle \exp(-\beta W)\rangle
= \int \mathrm{d}\mathcal{A}\ p_f(W=\mathcal{A})\exp(-\beta\mathcal{A})\\
=\int\mathrm{d}\mathcal{A}\ p_b(W=-\mathcal{A})\exp(-\beta\Delta F)\\
=\exp(-\beta\Delta F).
\end{aligned}\]
<p>This equality is highly useful; it allows for the calculation of the free energy difference by conducting the experiment many times. Due to the convexity of the exponential function, the Jarzynski equality implies</p>
\[\Delta F \leq W.\]
<p>Therefore we can see it is consistent with the second law of thermodynamics.
##Example</p>
<h3 id="colloidal-in-an-optical-trap">Colloidal in an optical trap</h3>
<p>The simplest and most practical example of applying fluctuation theorems is through a single colloidal in an optical trap. This system has the smallest possible degrees of freedom, and the optic trap can be approximated as a harmonical potential, which is the simplest potential providing restoring force. For such a system, we can obtain an analytical solution to verify the fluctuation theorems.</p>
<p>We treat the optical trap as a harmonical potential with the spring constant $k$ and assume the particle confined in the trap is over-damped; in this way, we can neglect the kinetic energy. Thus, the Hamiltonian can be written as</p>
\[H(\Gamma_0,\lambda)=\phi_{ext}=\frac{1}{2}k^2 \mathbf{r}^2,\]
<p>where $\lambda$ is the control parameter. In the beginning, $k=k_0$ and the system is in a canonical distribution</p>
\[p_{k_0}(\mathbf{r})=\frac{2\pi}{\beta k_0}e^{-\beta \frac{1}{2}k_0 \mathbf{r}^2}.\]
<p>At the time $t=0$, we suddenly change the intensity of the laser so that the spring constant jumps to $k_1$. In this process, the work done on the system is dependent on the distance from the centre at that moment</p>
\[W=\int_0^\tau dt \dot{\lambda}\frac{d\phi_{ext}}{d\lambda}=\frac{1}{2}(k_1-k_0)\mathbf{r}_0^2.\]
<p>Now the system is in an non-equilibrium state and will relax to a state of equilibrium:</p>
\[p_{k_1}(\mathbf{r})=\frac{2\pi}{\beta k_1}e^{-\beta \frac{1}{2}k_1 \mathbf{r}^2}.\]
<p>Accordingly, the free energy difference can be directly obtained from the initial and final equilibrium distributions:</p>
\[\Delta F=-k_BT\ln{Z_{k_1}}+k_BT\ln{Z_{k_0}}=k_BT\ln{\frac{k_0}{k_1}}\]
<p>To calculate the Jarzynski average of the work, we can first find the probability distribution of the trajectories as a function of work by combining the initial probability distribution and equation of the work applied on the colloid:</p>
\[p_{k_0\to k_1}(W)=p_{k_0}(W)=\frac{k_1-k_0}{\beta k_0}e^{-\beta\frac{k_0W}{k_1-k_0}}.\]
<p>Then, we can easily calculate the Jarzynski average and confirm the Jarzynski equality:</p>
\[\begin{aligned}
\langle e^{-\beta W}\rangle
=\int_0^\infty \mathrm{d}W\ e^{-\beta W}\frac{k_1-k_0}{\beta k_0}e^{-\beta\frac{k_0W}{k_1-k_0}W}\\
=\frac{k_1}{k_0}\\
=e^{-\beta \Delta F}.
\end{aligned}\]
<p>Following the same procedure, we can also calculate the probability of the reverse process $p_{k_0\to k_1}(W)$ and confirm the Crooks Fluctuation Theorem:</p>
\[\frac{p_{k_0\to k_1}(W)}{p_{k_1\to k_0}(-W)}=\frac{\frac{k_1-k_0}{\beta k_0}e^{-\beta\frac{k_0W}{k_1-k_0}}}{\frac{k_0-k_1}{\beta k_1}e^{\beta\frac{k_1W}{k_0-k_1}}}=e^{\beta(W-\Delta F)}.\]
<p>This example can also be used to verify the Evans-Searles Fluctuation Theorem. Since the Evans-Searles Fluctuation Theorem requires that all processes are time-reversible, we need to change the protocol to meet this condition, which involves changing $k_1$ back to $k_0$ at time $t=\tau$.</p>
<h2 id="conclusion">Conclusion</h2>
<p>Fluctuation theorems bring us a deeper understanding of the irreversible process. Evans-Searles fluctuations resolved Lochimid‘s objection on Boltzmann’s statistical thermodynamics. The Crooks Fluctuation Theorem and Jarzynsky equality are powerful tools for investigating small systems with non-negligible fluctuations. However, due to time restrictions, we can only discuss the deterministic dynamics described by Hamiltonian mechanics. The quantum version of the fluctuation theorem and stochastic dynamics are also worth discussing.</p>
<h2 id="appendix">Appendix</h2>
<h3 id="a-hamiltonian-mechanics-with-dissipative-force">a. Hamiltonian mechanics with dissipative force</h3>
<p>See in section 2, <em>Fluctuation Theorem</em>, E.M Sevick et al.[1].</p>
<h3 id="b-heat-absorbed-and-the-phase-space-compression-factor">b. Heat absorbed and the phase space compression factor</h3>
<p>In the derivation of the Crooks Fluctuation Theorem, we used the relation</p>
\[Q(\Gamma_0,\tau)\equiv\int_0^\tau\mathrm{d}t\ \frac{\partial H(\Gamma,\lambda)}{\partial{\Gamma}}\cdot\dot{\Gamma}=k_BT\int_0^\tau
\Lambda(\Gamma_t) \mathrm{d}t\]
<p>without proof. For an intuitive understanding, we can consider a specific case in which heat slowly enters in a microcanonical ensemble. We begin by writing the above relation in the instantaneous form:</p>
\[\dot{Q}(\Gamma_t)\equiv\frac{\partial H(\Gamma,\lambda)}{\partial \Gamma}\cdot\dot\Gamma = k_BT\Lambda(\Gamma_t)\]
<p>To understand this, let us consider the case for states of equilibrium with quasistatic processes, in which Boltzmann’s entropy is defined as</p>
\[S=k_B\log \Omega,\]
<p>where $\Omega$ is the number of states. In a quasi-static process, we have</p>
\[\mathrm{d}S=\frac{\mathrm{d}Q}{T}.\]
<p>Thus,</p>
\[\dot{Q}\equiv\frac{\mathrm{d}Q}{\mathrm{d}t}=T\frac{\mathrm{d}S}{\mathrm{d}t}=k_BT\frac{\mathrm{d}}{\mathrm{d}t}\log{\Omega}=k_BT\Lambda(\Gamma).\]
<h2 id="reference">Reference</h2>
<p>[1] Edith M Sevick, R Prabhakar, Stephen R Williams, and Debra J Searles. Fluctuation theorems.Annu. Rev. Phys.Chem., 59:603–633, 2008.</p>
<p>[2] C. Jarzynski. Nonequilibrium equality for free energy differences.Physical Review Letters, 78(14):2690–2693, 1997.</p>
<p>[3] Denis J. Evans and Debra J. Searles. The fluctuation theorem.Advances in Physics, 51(7):1529–1585, 2002.</p>
<p>[4] Chris Jarzynski. Nonequilibrium work theorem for a system strongly coupled to a thermal environment. Journal of Statistical Mechanics: Theory and Experiment,2004(09): P09005, 2004.</p>
<p>[5] Denis James Evans, Debra Joy Searles, and Stephen Rod-ney Williams.Fundamentals of classical statistical thermodynamics: dissipation, relaxation, and fluctuation theorems. John Wiley & Sons, 2016.</p>
<p>[6] Denis J Evans and Debra J Searles. Equilibrium microstates which generate second law violating steady states.Physical Review E, 50(2):1645, 1994.</p>
<p>[7] Gavin E Crooks. Nonequilibrium measurements of free energy differences for microscopically reversible Markovian systems.Journal of Statistical Physics, 90(5-6):1481–1487,1998.</p>
<p>[8] For an intuitive understanding of this relation, see theAppendix. More rigorous proof can be obtained with Nos ́e- Hoover thermostat</p>
<object data="/files/Fluctuation_Theorems.pdf" width="1000" height="2000" type="application/pdf" />Shiling Liang 梁师翎shiling.liang@epfl.chGet the PDFMonte Carlo Simulation of XY Model with Python2017-06-08T00:00:00-07:002017-06-08T00:00:00-07:00https://shiling42.github.io/posts/2017/06/XY-Model<p><img src="/files/XY_model/XY_color.jpg" width="60%" /></p>
<blockquote>
<ul>
<li><a href="https://shilingliang.com/XY-MODEL/">Project page</a></li>
<li><a href="https://github.com/Shiling42/XY-MODEL/blob/master/README.ipynb">Jupyter notebook</a></li>
</ul>
</blockquote>
<h2 id="whats-it">What’s it?</h2>
<p>A python program used for Monte Carlo simulation (Metropolis algorithm) of XY model.</p>
<h2 id="what-are-the-outputs">What are the outputs?</h2>
<ul>
<li>equilibrium spin configuration in differnet temperature</li>
<li>thermal quantities of XY spin system in different temperature</li>
</ul>
<h2 id="how-to-use-this-program">How to use this program</h2>
<h4 id="import-the-class">import the class</h4>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">XY_model</span> <span class="kn">import</span> <span class="n">XYSystem</span>
</code></pre></div></div>
<h4 id="creating-an-object-as-a-x-y-spin-system-with-given-width-and-temperature">creating an object as a X-Y spin system with given width and temperature</h4>
<p>Use <code class="language-plaintext highlighter-rouge">XYSystem(temperature = , width = )</code> to creat a class object. Two variables can be assigned to initilize the system: the temperature and the width.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">xy_system_1</span> <span class="o">=</span> <span class="n">XYSystem</span><span class="p">(</span><span class="n">temperature</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">,</span> <span class="n">width</span> <span class="o">=</span> <span class="mi">15</span><span class="p">)</span>
</code></pre></div></div>
<h4 id="visulizingthe-spin-system">visulizingthe spin system</h4>
<p>Using <code class="language-plaintext highlighter-rouge">.show()</code> to visulize the xy spin system as arrows on a two-dimensional plane.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">xy_system_1</span><span class="p">.</span><span class="n">show</span><span class="p">()</span>
<span class="k">print</span><span class="p">(</span><span class="s">'Energy per spin:%.3f'</span><span class="o">%</span><span class="n">xy_system_1</span><span class="p">.</span><span class="n">energy</span><span class="p">)</span>
</code></pre></div></div>
<p><img src="/files/XY_model/output_7_0.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Energy per spin:0.056
</code></pre></div></div>
<h4 id="now-let-the-system-evolve-to-an-equilibrium-state">Now, let the system evolve to an equilibrium state</h4>
<blockquote>
<p><code class="language-plaintext highlighter-rouge">self.equilibrate(self,max_nsweeps=int(1e4),temperature=None,H=None,show = False)</code> allows you to assign a new temperature, just simply do object.equilibrate(temperature = 3). If you want to keep the temperature defined before, leave it blank. And ·sohw=Ture` will let show the configuration of the system for each 1000 sweeps.</p>
</blockquote>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">xy_system_1</span><span class="p">.</span><span class="n">equilibrate</span><span class="p">(</span><span class="n">show</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="n">xy_system_1</span><span class="p">.</span><span class="n">show</span><span class="p">()</span>
</code></pre></div></div>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#sweeps=1
energy=-0.60
</code></pre></div></div>
<p><img src="/files/XY_model/output_9_1.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=0.5
#sweep=504
energy=-1.72
</code></pre></div></div>
<p><img src="/files/XY_model/output_9_3.png" alt="" /></p>
<h4 id="observing-the-thermal-quantities-in-different-temperature---annealing-approach">Observing the thermal quantities in different temperature - annealing approach</h4>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">xy_system_2</span> <span class="o">=</span> <span class="n">XYSystem</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="mi">7</span><span class="p">)</span>
<span class="n">cool_dat</span><span class="o">=</span><span class="n">xy_system_2</span><span class="p">.</span><span class="n">annealing</span><span class="p">(</span><span class="n">T_init</span><span class="o">=</span><span class="mf">2.5</span><span class="p">,</span><span class="n">T_final</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span><span class="n">nsteps</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span><span class="n">show_equi</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</code></pre></div></div>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=2.5
#sweep=6802
energy=-0.48
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_1.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=2.2
#sweep=3429
energy=-0.48
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_3.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=2.0
#sweep=9999
energy=-0.47
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_5.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=1.7
#sweep=2809
energy=-0.60
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_7.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=1.4
#sweep=989
energy=-0.74
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_9.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=1.2
#sweep=2253
energy=-1.35
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_11.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=0.9
#sweep=636
energy=-1.68
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_13.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=0.6
#sweep=837
energy=-1.72
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_15.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=0.4
#sweep=548
energy=-1.86
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_17.png" alt="" /></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>equilibrium state is reached at T=0.1
#sweep=503
energy=-1.95
</code></pre></div></div>
<p><img src="/files/XY_model/output_11_19.png" alt="" /></p>
<p><img src="/files/XY_model/output_11_20.png" alt="" /></p>
<p><img src="/files/XY_model/output_11_21.png" alt="" /></p>Shiling Liang 梁师翎shiling.liang@epfl.ch