Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
anderkve committed Nov 7, 2024
1 parent 0a63213 commit b5e21a7
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 12 deletions.
10 changes: 10 additions & 0 deletions _sources/book/projects/project4.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ Assume a $2 \times 2$ lattice with periodic boundary conditions.
- total magnetisation
- degeneracy

```{note}
When computing the energy, we have said that the sum should avoid double-counting spin pairs. However, a $2 \times 2$ lattice is a special case, since using periodic boundary conditions in this case necessarily leads to counting all spin pairs twice. So for this particular case it is OK to double-count. And we recommend doing it, since in Problem 4 we will use the analytical results from this problem to test our code, so it's useful to have the periodic boundary conditions work the same way in the $2 \times 2$ case as in the general $L \times L$ case. (Otherwise we would have to add a special `if-else` block in the code to turn off the periodic boundaries for the case when L=2.)
```


- **b)** Find analytical expressions for
- $Z$
- $\langle \epsilon \rangle$
Expand Down Expand Up @@ -248,6 +253,11 @@ Time to actually write some code!

**b)** Validation: For a temperature of $T = 1.0\,J/k_B$, compare your results to the analytical results from Problem 1. (Feel free to compare for other temperature values as well, or simply make plots of these quantities versus temperature.)

```{note}
See the note in Problem 1 about periodic boundary conditions for the special case of a $2 \times 2$ lattice. Short summary: it is OK to double-count spin pairs for this special case, so we can use the exact same code for all lattice sizes, including $2 \times 2$.
```


**c)** How many **Monte Carlo cycles** do you need to get good agreement with the analytical result? (Here *one Monte Carlo cycle* corresponds to *$N$ attempted spin flips*.)


Expand Down
22 changes: 20 additions & 2 deletions _sources/lecture_notes/2024/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,31 @@
- Markov chains


### Plan for Lecture 21, October 31:
### Lecture 21, October 31:

- Wrap up discussion of Markov chains
- Markov chain Monte Carlo (MCMC)
- Start on parallel computing


### Lecture 22, November 1:
- Wrap up discussion of MCMC
- MCMC code examples
- Parallel computing


### Lecture 23, November 7:
- Wrap up discussion of parallel computing
- Amdahl's law
- Random number generation
- If time: start on sampling from low-dimensional pdfs


### Lecture 24, November 8:
- Sampling from low-dimensional pdfs
- Rejection sampling
- Importance sampling
- Inverse transform sampling




Expand Down
14 changes: 12 additions & 2 deletions book/projects/project4.html
Original file line number Diff line number Diff line change
Expand Up @@ -844,15 +844,21 @@ <h2>Problems<a class="headerlink" href="#problems" title="Permalink to this head
<section id="problem-1">
<h3>Problem 1<a class="headerlink" href="#problem-1" title="Permalink to this headline">#</a></h3>
<p>Assume a <span class="math notranslate nohighlight">\(2 \times 2\)</span> lattice with periodic boundary conditions.</p>
<ul>
<li><p><strong>a)</strong> Summarise all possible states of the system by setting up a table with four coloumns showing the following quantities</p>
<ul class="simple">
<li><p><strong>a)</strong> Summarise all possible states of the system by setting up a table with four coloumns showing the following quantities</p>
<ul>
<li><p>number of spins in state +1</p></li>
<li><p>total energy</p></li>
<li><p>total magnetisation</p></li>
<li><p>degeneracy</p></li>
</ul>
</li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>When computing the energy, we have said that the sum should avoid double-counting spin pairs. However, a <span class="math notranslate nohighlight">\(2 \times 2\)</span> lattice is a special case, since using periodic boundary conditions in this case necessarily leads to counting all spin pairs twice. So for this particular case it is OK to double-count. And we recommend doing it, since in Problem 4 we will use the analytical results from this problem to test our code, so it’s useful to have the periodic boundary conditions work the same way in the <span class="math notranslate nohighlight">\(2 \times 2\)</span> case as in the general <span class="math notranslate nohighlight">\(L \times L\)</span> case. (Otherwise we would have to add a special <code class="docutils literal notranslate"><span class="pre">if-else</span></code> block in the code to turn off the periodic boundaries for the case when L=2.)</p>
</div>
<ul>
<li><p><strong>b)</strong> Find analytical expressions for</p>
<ul class="simple">
<li><p><span class="math notranslate nohighlight">\(Z\)</span></p></li>
Expand Down Expand Up @@ -973,6 +979,10 @@ <h3>Problem 4<a class="headerlink" href="#problem-4" title="Permalink to this he
<li><p><span class="math notranslate nohighlight">\(\chi / N\)</span></p></li>
</ul>
<p><strong>b)</strong> Validation: For a temperature of <span class="math notranslate nohighlight">\(T = 1.0\,J/k_B\)</span>, compare your results to the analytical results from Problem 1. (Feel free to compare for other temperature values as well, or simply make plots of these quantities versus temperature.)</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>See the note in Problem 1 about periodic boundary conditions for the special case of a <span class="math notranslate nohighlight">\(2 \times 2\)</span> lattice. Short summary: it is OK to double-count spin pairs for this special case, so we can use the exact same code for all lattice sizes, including <span class="math notranslate nohighlight">\(2 \times 2\)</span>.</p>
</div>
<p><strong>c)</strong> How many <strong>Monte Carlo cycles</strong> do you need to get good agreement with the analytical result? (Here <em>one Monte Carlo cycle</em> corresponds to <em><span class="math notranslate nohighlight">\(N\)</span> attempted spin flips</em>.)</p>
</section>
<section id="problem-5">
Expand Down
78 changes: 71 additions & 7 deletions lecture_notes/2024/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,23 @@ <h1 class="site-logo" id="site-title">FYS3150/FYS4150 course material</h1>
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#plan-for-lecture-21-october-31">
Plan for Lecture 21, October 31:
<a class="reference internal nav-link" href="#lecture-21-october-31">
Lecture 21, October 31:
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#lecture-22-november-1">
Lecture 22, November 1:
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#lecture-23-november-7">
Lecture 23, November 7:
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#lecture-24-november-8">
Lecture 24, November 8:
</a>
</li>
</ul>
Expand Down Expand Up @@ -782,8 +797,23 @@ <h2> Contents </h2>
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#plan-for-lecture-21-october-31">
Plan for Lecture 21, October 31:
<a class="reference internal nav-link" href="#lecture-21-october-31">
Lecture 21, October 31:
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#lecture-22-november-1">
Lecture 22, November 1:
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#lecture-23-november-7">
Lecture 23, November 7:
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#lecture-24-november-8">
Lecture 24, November 8:
</a>
</li>
</ul>
Expand Down Expand Up @@ -1065,12 +1095,46 @@ <h2>Lecture 20, October 25:<a class="headerlink" href="#lecture-20-october-25" t
<li><p>Markov chains</p></li>
</ul>
</section>
<section id="plan-for-lecture-21-october-31">
<h2>Plan for Lecture 21, October 31:<a class="headerlink" href="#plan-for-lecture-21-october-31" title="Permalink to this headline">#</a></h2>
<section id="lecture-21-october-31">
<h2>Lecture 21, October 31:<a class="headerlink" href="#lecture-21-october-31" title="Permalink to this headline">#</a></h2>
<ul class="simple">
<li><p>Wrap up discussion of Markov chains</p></li>
<li><p>Markov chain Monte Carlo (MCMC)</p></li>
<li><p>Start on parallel computing</p></li>
</ul>
</section>
<section id="lecture-22-november-1">
<h2>Lecture 22, November 1:<a class="headerlink" href="#lecture-22-november-1" title="Permalink to this headline">#</a></h2>
<ul class="simple">
<li><p>Wrap up discussion of MCMC</p>
<ul>
<li><p>MCMC code examples</p></li>
</ul>
</li>
<li><p>Parallel computing</p></li>
</ul>
</section>
<section id="lecture-23-november-7">
<h2>Lecture 23, November 7:<a class="headerlink" href="#lecture-23-november-7" title="Permalink to this headline">#</a></h2>
<ul class="simple">
<li><p>Wrap up discussion of parallel computing</p>
<ul>
<li><p>Amdahl’s law</p></li>
</ul>
</li>
<li><p>Random number generation</p></li>
<li><p>If time: start on sampling from low-dimensional pdfs</p></li>
</ul>
</section>
<section id="lecture-24-november-8">
<h2>Lecture 24, November 8:<a class="headerlink" href="#lecture-24-november-8" title="Permalink to this headline">#</a></h2>
<ul class="simple">
<li><p>Sampling from low-dimensional pdfs</p>
<ul>
<li><p>Rejection sampling</p></li>
<li><p>Importance sampling</p></li>
<li><p>Inverse transform sampling</p></li>
</ul>
</li>
</ul>
</section>
</section>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit b5e21a7

Please sign in to comment.