-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
3882 lines (3768 loc) · 138 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CCP5 Summer School, Monte Carlo</title>
<meta name="description" content="A presentation by Marcus Bannerman.">
<meta name="author" content="Marcus Bannerman <[email protected]">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="initial-scale=1">
<style>
loaded {color:aquamarine}
</style>
<link rel="stylesheet" href="reveal.js/dist/reveal.css"></link>
<link rel="stylesheet" href="Font-Awesome/css/font-awesome.min.css"></link>
<!-- Default themes -->
<!-- <link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme"></link>-->
<!-- For syntax highlighting -->
<link rel="stylesheet" href="reveal.js/dist/theme/night.css"></link>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
<script>
/**
* Simple object check.
* @param item
* @returns {boolean}
*/
function isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
/**
* Deep merge two objects.
* @param target
* @param ...sources
*/
function mergeDeep(target, ...sources) {
if (!sources.length) return target;
const source = sources.shift();
if (isObject(target) && isObject(source)) {
for (const key in source) {
if (isObject(source[key])) {
if (!target[key]) Object.assign(target, { [key]: {} });
mergeDeep(target[key], source[key]);
} else {
Object.assign(target, { [key]: source[key] });
}
}
}
return mergeDeep(target, ...sources);
}
var default_plot_Layout = {
autosize:true,
font: {
color: 'white',
size: 15,
},
showlegend:true,
legend: {
x:1, y:1, xanchor: 'right',
},
xaxis: {
gridcolor:'white',
},
yaxis: {
automargin:true,
gridcolor:'white',
},
plot_bgcolor: '#000',
paper_bgcolor: '#000E',
};
var default_plot_Config = {
responsive: false,
displaylogo: false,
};
</script>
<script src="reveal.js/dist/reveal.js"></script>
<script src="reveal.js/plugin/math/math.js"></script>
<script src="reveal.js/plugin/markdown/markdown.js"></script>
<script src="reveal.js/plugin/highlight/highlight.js"></script>
<script src="reveal.js/plugin/notes/notes.js"></script>
<script src="codeButtons.js"></script>
<link rel="stylesheet" href="UoA.css" id="theme"></link>
</head>
<body>
<div class="reveal">
<div class="slides" style="border: 1px solid darkslategray">
<section>
<section data-background-image="img/UoAbackground.jpg">
<div class="backbox">
<h3>Notes on Molecular Simulation</h3>
<h3>CCP5 Summer School</h3>
</div>
<p>
Marcus N. Bannerman<br/>
<a href="mailto:[email protected]">[email protected]</a>
<object type="image/svg+xml" data="img/UoALarge_reversed.svg" width="30%" style="margin:2em auto;display:block;">
Your browser does not support SVG
</object>
Access the slides here:
<a href="http://www.marcusbannerman.co.uk/CCP5School">www.marcusbannerman.co.uk/CCP5School</a>
</p>
</section>
<section>
<h3 style="margin-top:1em;">Current Lectures</h3>
<p>
<ul>
<li>
<a href="https://colab.research.google.com/github/toastedcrumpets/CCP5_Python_examples/blob/master/Table_of_contents_for_collab_research_google_com.ipynb">Python pre-school notes (hosted on Google collab)</a>
</li>
<li>
<a href="#SM1">Statistical mechanics (1 & 2)</a>
</li>
</ul>
<h3>My old notes (ignore)</h3>
<ul>
<li style="font-size:75%;">
<a href="#MC1">Monte carlo 1</a>
</li>
<li style="font-size:75%;">
<a href="#MC2">Monte carlo 2</a>
</li>
<li style="font-size:75%;">
<a href="#MC3">Monte carlo 3</a>
</li>
</ul>
</p>
</section>
</section>
<section id="SM1">
<section data-background="img/Boltzmann_grave.jpg">
<h2 class="backbox">Statistical mechanics</h2>
</section>
<section data-background="img/Boltzmann_grave.jpg">
<p class="backbox"><em>
Ludwig Boltzmann, who spent much of his life studying statistical mechanics, died in 1906, by his own hand. Paul Ehrenfest, carrying on the work, died similarly in 1933. Now it is our turn to study statistical mechanics. Perhaps it will be wise to approach the subject cautiously.
</em>
</p>
<p class="backbox" style="float:right">(Opening lines of "States of Matter", by D.L. Goodstein).</p>
<div class="fragment backbox" style="font-size:75%;clear:both;">
<p>
Other excellent stat-mech texts include:
</p>
<ul>
<li><a href="https://www.researchgate.net/publication/27693700_Statistical_mechanics_for_computer_simulators">“Statistical mechanics for computer simulators,”</a> Daan Frenkel (free/online/40 pages)</li>
<li>“Physical chemistry,” P. W. Atkins.</li>
<li>“Molecular driving forces,” K. A. Dill and S. Bromberg</li>
<li>“Statistical mechanics: A survival guide,” M. Glazer and J. Wark</li>
<li>“Statistical mechanics,” D. A. McQuarrie</li>
<li>“Statistical mechanics, principles and selected applications” T. L. Hill</li>
<li>“Introduction to modern statistical mechanics” David Chandler</li>
<li>“Statistical mechanics: Theory and molecular simulation” Mark Tuckerman</li>
<li>“Computer simulation of liquids” M. P. Allen and D. J. Tildesley</li>
</ul>
</div>
</section>
<section>
<p>
Two hours/lectures is nothing, I will hopelessly fail to
teach you it all, so I'll give you the key touch points,
and try my best to be different/interesting/intuitive.
</p>
<p class="fragment">
Interrupt me, question me, tell me how to do it better! Anything is better than silence.
</p>
<p class="fragment">
I'll put “loaded” words which I think could be
interesting to ask about <loaded>in this colour</loaded> to remind
me to tell you about them, and to remind you to ask!
</p>
</section>
<section>
<p>
Statistical mechanics is our bridge from the microscopic
scale (simulating individual atoms/molecules) to the
“macroscopic” measurements we make in
experiments (i.e., density, temperature, heat capacity, pressure,
<loaded>free-energy</loaded>).
</p>
<p>
<img src="img/DiffusionMicroMacro.gif" style="width:45%;display:block;margin: 0 auto;"/>
</p>
<p>
We will use Statistical Mechanics to connect to <b>thermodynamics</b>, and that
is the focus here (statistical
thermodynamics/equilibrium statistical mechanics), but
it also is used to explore dynamics.
</p>
</section>
</section>
<section>
<section>
<h3>Thermodynamics Recap</h3>
<p>
Thermodynamics was/is a <loaded>phenomenological theory</loaded>,
based on observations of <b>state</b> variables,
$p,\,T,\,V,\,U,\,M,\,S,\ldots$ that <loaded>seem</loaded> to fully describe a
thermodynamic <b>system</b>.
</p>
<p class="fragment">
The power of thermodynamics arises from its ability to
find simple universal relationships between <loaded>observable</loaded>
state variables.</p>
<p class="fragment">
First law: <b>Energy is conserved</b>
\begin{align*}
U_{system}+U_{surroundings}={\rm Constant}
\end{align*}
which also implies the differential relationship
\begin{align*}
{\rm d}U_{system}=-{\rm d}U_{surroundings}
\end{align*}
</p>
<p class="fragment">
<loaded>Have you ever seen energy?</loaded>
</p>
</section>
<section>
<p>
Energy is conserved but can be transferred in many ways; however, heat
is <loaded>special</loaded> thanks to the second law so we distinguish
it from other transfers called work: \begin{align*} {\rm d}U_{system}
= \partial Q - \partial W \end{align*}
</p>
<p class="fragment">
Second law: Entropy must increase ${\rm d}S_{universe}\ge0$ but the key relationship is actually ${\rm
d}S \ge \partial Q/T$.
</p>
<p class="fragment">
This becomes ${\rm d}S=\partial Q/T$ if the process is
<loaded>reversible</loaded> (and we can make things almost reversible if
we chop them up enough so that the chunks/sub-systems are almost homogeneous), leading to
\begin{align*}
{\rm d}U = T\,{\rm d}S - \partial W
\end{align*}
for a reversible processes.
</p>
</section>
<section>
<p>We have now made the</p>
<h3>Fundamental thermodynamic equation</h3>
<p>
\begin{align*}
{\rm d}U &= T\,{\rm d}S - \partial W
\\
&= T\,{\rm d}S - \sum_i {\color{red}F_i}\,{\color{teal}{\rm d}L_i}
\end{align*}
It relates its <loaded>natural</loaded> variables $U$, $S$, and $L_i$ together, where
$L_i$ is built up by adding the work terms we can <loaded>observe/control</loaded> in our system.
</p>
<table>
<tbody>
<tr>
<td style="border-right:4px solid white;">${\color{red}F_i}$</td>
<td>$p$</td>
<td>$\mu_\alpha$</td>
<td>$\gamma$</td>
<td>$\tau$</td>
<td>…</td>
</tr>
<tr>
<td style="border-right:4px solid white;">${\color{teal}L_i}$</td>
<td>$V$</td>
<td>$-N_\alpha$</td>
<td>$\Sigma$</td>
<td>$\dot{\omega}$</td>
<td>…</td>
</tr>
</tbody>
</table>
<p>
For now, assume we want to calculate $U$ when controlling $S$, and
$L_i$, but any rearrangement of this is possible (see implicit function theorem).
</p>
</section>
</section>
<section>
<h3>Choosing work terms</h3>
<img src="img/balloon.svg" style="width:40%"/>
<p>Taking some gas (B), then we always have entropy $T\,{\rm d}S$, but
also have a volume/pressure work, $V\,{\rm d}p$, as well as
mass/chemical-potential work, $N_i\,{\rm d}\mu_i$, as it moves through the
boundary.</p>
<p>
Adding a baloon skin means energy is stored in the force/tension, ${\rm
d}\gamma$, of the stretched elastic surface, $\Sigma$ which must be
included; however, ignoring diffusion through the skin means we can
ignore the mass change (${\rm d}N=0$) and throw away this term!
</p>
</section>
<section>
<h3>Example</h3>
<img src="img/balloon.svg" style="width:40%"/>
<p>
The <loaded>independent</loaded> variables $S$ and $V$ are unwieldy as
we can't measure entropy and the balloon's volume will change. $T$ and
$p$ are much better variables for real problems so we need to change
them, but first lets solve the fundamental equation as this can be
done in its current form.</p>
</section>
<section>
<h3>Fundamental thermodynamic equation</h3>
<p>
\begin{align*}
{\rm d}U &= T\,{\rm d}S - \partial W
= T\,{\rm d}S - \sum_i F_i\,{\rm d}L_i
\end{align*}
</p>
<table>
<tbody>
<tr>
<td style="border-right:4px solid white;">$F_i$</td>
<td>$p$</td>
<td>$\mu_\alpha$</td>
<td>$\gamma$</td>
<td>…</td>
</tr>
<tr>
<td style="border-right:4px solid white;">$L_i$</td>
<td>$V$</td>
<td>$-N_\alpha$</td>
<td>$\Sigma$</td>
<td>…</td>
</tr>
</tbody>
</table>
<p>
Amazingly, as each term is a <b>conjugate</b> pairing of an <b>intensive</b> term and a differential <b>extensive</b> term,
this equation can be solved using Euler's
solution for homogeneous functions (<a href="https://www.simcem.com/docs/thermo/#UEuler">my notes here</a>).
\begin{align*}
U(S,\,V,\,\left\{N_\alpha\right\},\ldots) &= T\,S -p\,V+\sum_\alpha \mu_\alpha\,N_\alpha + \ldots\\
\end{align*}
</p>
</section>
</section>
<section>
<h3>Generating identities</h3>
<p>
<span style="font-size:70%">
\begin{align*}
U(S,\,V,\,\left\{N_\alpha\right\},\ldots) &= T\,S -p\,V+\sum_\alpha \mu_\alpha N_\alpha + \ldots
\\
{\rm d}U &= T\,{\rm d}S -p\,{\rm d}V+\sum_\alpha \mu_\alpha\,{\rm d}N_\alpha + \ldots
\end{align*}
</span>
Comparing the equations we see lots of differential identities which
will later help us connect thermodynmics to microscopics as we'll have the derivatives:
<span style="font-size:70%">
\begin{align*}
\left(\frac{{\rm d}U}{{\rm d}S}\right)_{V,\,\left\{N_\alpha\right\},\ldots} &= T & \left(\frac{{\rm d}U}{{\rm d}V}\right)_{S,\,\left\{N_\alpha\right\},\ldots} &= -p
\\
\left(\frac{{\rm d}U}{{\rm d}N_\alpha}\right)_{S,\,V,\,\left\{N_\beta\neq\alpha\right\},\ldots} &= \mu & \ldots &= \ldots
\end{align*}
</span>
</p>
<div class="fragment">
<p>
In general, when we have a relationship between $U,\,S,\,V,\ldots$,
then it is a <b>generating function</b> for the rest of the
thermodynamic properties.
</p>
<div class="footnote">
Note that $U(S,\,V,\,\left\{N_\alpha\right\})$ can be rearranged to $S(U,\,V,\,\left\{N_\alpha\right\})$ and $\left(\frac{{\rm d}U}{{\rm d}S}\right)_X = \left(\frac{{\rm d}S}{{\rm d}U}\right)_X^{-1}$ so entropy is a generating function as well as energy.
</div>
</div>
</section>
<section>
<h3>Legendre Transformations</h3>
<p>
<span style="font-size:75%">
\begin{align*}
U(S,\,V,\,\left\{N_\alpha\right\},\ldots) &= T\,S -p\,V+\sum_\alpha \mu_\alpha N_\alpha + \ldots
\\
{\rm d}U &= T\,{\rm d}S -p\,{\rm d}V+\sum_\alpha \mu_\alpha\,{\rm d}N_\alpha + \ldots
\end{align*}
</span>
$U,\,S,\,V$ can be challenging variables to measure/control, so we want
something more observable/controllable. The
<b>conjugate</b> variables $T,\,T^{-1},\,p$ are nicer for experiments (maybe not simulation though).
</p>
<p>
A Legendre transformation defines a new <b>potential</b> that swaps the pair
around as <b>independent</b> variable. I.e. Defining the enthalpy $H = U + p\,V$
leads to:
<span style="font-size:75%">
\begin{align*}
{\rm d}H &= {\rm d}U + V\,{\rm d}p +p\,{\rm d}V\\
&= T\,{\rm d}S +V{\rm d}p+\sum_\alpha \mu_\alpha\,{\rm d}N_\alpha + \ldots
\\
H\left(S,\,p,\,\left\{N_\alpha\right\},\ldots\right) &= \ldots
\end{align*}
</span>
</p>
</section>
<section>
<h3>The thermodynamic table</h3>
<p style="font-size:65%">
\begin{align*}
U\left(S,\,V,\,\left\{N_\alpha\right\}\right)&= T\,S - p\,V + \sum_\alpha \mu_\alpha\,N_\alpha
&
{\rm d}U &= T\,{\rm d}S - p\,{\rm d}V + \sum_\alpha\mu_{\alpha}\,{\rm d} N_{\alpha}
\\
S\left(U,\,V,\,\left\{N_\alpha\right\}\right)&= \frac{U}{T} + \frac{p}{T}\,V - \sum_\alpha \frac{\mu_\alpha}{T}\,N_\alpha
&
{\rm d}S &= T^{-1}\,{\rm d}S + \frac{p}{T}{\rm d}V - \sum_\alpha\frac{\mu_{\alpha}}{T}{\rm d} N_{\alpha}
\end{align*}
</p>
<p style="font-size:65%">
<b>Legendre transforms</b>
\begin{align*}
H\left(S,\,p,\,\left\{N_\alpha\right\}\right)&= U {\color{red} + p\,V} = T\,S + \sum_\alpha\mu_\alpha\,N_\alpha
&
{\rm d}H &=
T\,{\rm d}S + V\,{\rm d}p + \sum_\alpha\mu_\alpha\,{\rm d} N_\alpha
\\
A\left(T,\,V,\,\left\{N_\alpha\right\}\right)&= U {\color{red}- T\,S} = - p\,V + \sum_\alpha\mu_\alpha\,N_\alpha
&
{\rm d}A &= -S\,{\rm d}T - p\,{\rm d}V +
\sum_\alpha\mu_{\alpha}\,{\rm d} N_{\alpha}
\\
G\left(T,\,p,\,\left\{N_\alpha\right\}\right)&= H {\color{red}- T\,S} = \sum_\alpha\mu_\alpha\,N_\alpha
&
{\rm d}G &= -S\,{\rm d}T + V\,{\rm d}p + \sum_\alpha\mu_\alpha\,{\rm
d} N_\alpha\\
\ldots & & & \ldots
\end{align*}
</p>
<p>
Every time we add a new work term, there is a new Legendre transform,
and thus a new free energy (homework, find a new work term and name the
free energy after yourself).
</p>
</section>
<section>
<section>
<h3>Statistical mechanics by example</h3>
<p>
We've now covered all of thermodynamics (!). We're ready for statistical mechanics now.
</p>
<p class="fragment">
The simplest example I can think of that fits statistical
mechanics AND thermodynamics is the game of craps (the
sum of two dice).</p>
<p class="fragment">
We'll study this, and try to draw parallels to molecular
systems. Whenever the link isn't clear, let me know!
</p>
<p class="fragment">
Amazingly to me, we derive entropy first, then add
conservation of energy to bring in temperature, then the
rest of thermo follows.
</p>
</section>
</section>
<section >
<section data-background="https://upload.wikimedia.org/wikipedia/commons/3/3f/Craps_game_at_military_camp_in_1918.jpg">
<h2 class="backbox">A craps example</h2>
<p class="backbox fragment">
In craps, players roll two dice and place bets on the
outcome of the sum, which we'll call $U$.
</p>
<p class="backbox fragment">
We will later generalise to hyper-craps, where $N$ dice
are rolled simultaneously, but for now we start with
traditional craps where $N=2$.</p>
</section>
<section data-background="https://upload.wikimedia.org/wikipedia/commons/3/3f/Craps_game_at_military_camp_in_1918.jpg">
<p class="backbox">
The numbers on each individual dice at any point in the game/<b>simulation</b>
are called the <b>microstate</b> variables and describe everything about the <b>state</b> of
the game.</p>
<p class="backbox fragment" data-fragment-index="1" style="padding-top:0.5em">
<b>State</b> variables are observables which must change IFF<sup>1</sup> the system
changes.
</p>
<p class="backbox footnote fragment" data-fragment-index="1">
1: IFF = IF and only if.</p>
<p class="backbox fragment">
The <b>microstate</b> of <em>molecular</em> systems are the atomic
coordinates and velocities.
</p>
</section>
<section data-background="https://upload.wikimedia.org/wikipedia/commons/3/3f/Craps_game_at_military_camp_in_1918.jpg">
<p class="backbox">
Players/<b>observers</b> of craps do not really care or measure the
<b>microstate</b>. The only <b>state</b> that is observed in craps is
the sum of the dice, $U$. The microstate could change, but if $U$
stays the same then as far as the players are concerned its the same
roll.</p>
<p class="backbox fragment">
The sum of the dice, $U$, is a <b>macrostate</b> variable
(along with $N$). A <b>macrostate</b> can consist of an <b>ensemble</b> of
many microstates. </p>
<p class="backbox fragment">
For example, the <b>state</b> of a sum of 7 on the two dice is made of the six <b>microstates</b>, $\left\{\left[1,\,6\right],\,\left[2,\,5\right],\,\left[3,\,4\right],\ldots\right\}$ .
</p>
<p class="backbox fragment">
This is like a molecular system, where an observer sees a particular <b>state</b> (i.e. pressure,
temperature, and mass) will have many possible <b>microstates</b> (molecular
configurations), and they don't particularly care about
the microstate.</p>
<p class="backbox fragment">
Note: When we say <b>state</b> we typically mean the <b>macrostate</b>
as its the one we can see experimentally/IRL, thus it's
the one we interact with and actually care about.</p>
</section>
<section data-background="https://upload.wikimedia.org/wikipedia/commons/3/32/Craps.jpg">
<p class="backbox">
<loaded>Fundamental postulate: Each <b>microstate</b> is equally probable.</loaded>
</p>
<p class="backbox fragment">
This is intuitive for perfect dice, each possible roll
is equally probable. Not intuitive at all for molecular
systems; however, it works, and that is all we have time
for.</p>
<p class="backbox fragment">
Even though the <b>microstates</b> are equally probable, the <b>macrostates</b> have
different probabilities due to the <em>combinations</em> of <b>microstates</b> that make up their <b>ensemble</b>.
</p>
<p class="backbox fragment">
For two dice, rolling a $U=7$ <br/>
$\left\{\left[1,\,6\right],\,\left[2,\,5\right],\,\left[3,\,4\right],\,\left[4,\,3\right],\,\left[5,\,2\right],\,\left[6,\,1\right]\right\}$.
<br/>
is six times more likely than a snake eyes ($U=2$)
<br/>
$\left\{\left[1,\,1\right]\right\}$
</p>
<p class="backbox fragment">
What happens as we add more dice? Molecular systems have
very large numbers of microstate variables
$\left(\mathcal{O}\left(10^{26}\right)\right)$, so we
need an intuition of what happens when we have so many
dice....</p>
</section>
<section style="height:100%" data-background="img/dice_heap.jpg" id="dicecount1slide">
<h2 class="backbox">Example: Hyper-craps</h2>
<form class="backbox">
<div class="row">
<div class="col">
<div class="form-group">
<label id="dicecount1label" for="dicecount1">$N$: 1</label>
<input type="range" class="form-control-range" id="dicecount1" min="1" max="28" value="1" step="1">
</div>
</div>
<div class="col">
<input class="form-check-input" type="checkbox" value="" id="dicenormalisation1">
<label class="form-check-label" for="dicenormalisation1">
Per-dice normalisation
</label>
</div>
</div>
<div class="row">
<div class="col">
<input class="form-check-input" type="radio" name="dicey" id="dicey1" value="1" checked><br/>
<label class="form-check-label" for="dicey1" id="dicey1label" style="font-size:75%">$\Omega\left(N,\,U\right)$</label>
</div>
<div class="col">
<input class="form-check-input" type="radio" name="dicey" id="dicey2" value="2"><br/>
<label class="form-check-label" for="dicey2" id="dicey2label" style="font-size:75%">$P(U)=\Omega\left(N,\,U\right) / \sum_U \Omega\left(N,\,U\right)$</label>
</div>
<div class="col">
<input class="form-check-input" type="radio" name="dicey" id="dicey3" value="3"><br/>
<label class="form-check-label" for="dicey3" id="dicey3label" style="font-size:75%">$P(U)/\left({\rm max}_U\,P(U)\right)$</label>
</div>
</div>
</form>
<div id="dicePlot" class="plot"/>
<div class="attribution backbox">
Background: <i><a href="/wiki/User:XRay" title="User:XRay">Dietmar Rabich</a> / <a href="/wiki/Main_Page" title="Main Page">Wikimedia Commons</a> / <span class="plainlinks noprint"><a class="external text" href="https://commons.wikimedia.org/wiki/File:W%C3%BCrfel,_gemischt_--_2021_--_5649.jpg">“Würfel, gemischt -- 2021 -- 5649”</a></span> / <span class="plainlinks noprint"><a rel="nofollow" class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a></span></i>
</div>
<script>
function binomial(n, k) {
if ((typeof n !== 'number') || (typeof k !== 'number'))
return false;
var coeff = 1;
for (var x = n-k+1; x <= n; x++) coeff *= x;
for (x = 1; x <= k; x++) coeff /= x;
return coeff;
}
//https://mathworld.wolfram.com/Dice.html
function most_probable_rolls(dice_rolled, dice_sides) {
var n = dice_rolled;
var s = dice_sides;
if (dice_rolled == 1)
//A complex way of generating [1,2,3,4,..., dice_sides]
return [...Array(dice_sides).keys()].map((e) => {return e+1;});
var val = Math.floor(0.5 * n * (s + 1));
if (dice_rolled % 2)
return [val, val+1];
else
return [val];
}
function dice_prob(dice_points, dice_rolled, dice_sides) {
var p = dice_points;
var n = dice_rolled;
var s = dice_sides;
var N = Math.floor((p - n) / s);
var sum = 0;
for (var k=0; k <= N; ++k)
sum += ((-1)**k) * binomial(n, k) * binomial(p - s*k - 1, n-1);
return (dice_sides**(-dice_rolled)) * sum;
}
function dice_dist_plot(n, s) {
var x = [];
var y = [];
for (var k = n; k <= n * s; ++k) {
x.push(k);
y.push(dice_prob(k, n, s));
}
return {x, y};
}
var max_dice = parseInt($('#dicecount1').max);
var dice_sides = 6;
function refresh_dice_plot(dice_rolled) {
var mpr = most_probable_rolls(dice_rolled, dice_sides);
var normalise_x = 1;
if ($('#dicenormalisation1')[0].checked)
normalise_x = dice_rolled;
var ystate = parseInt($('input[name=dicey]:checked').val());
var data1 = dice_dist_plot(dice_rolled, dice_sides);
data1.x = data1.x.map((e) => { return e / normalise_x; });
var data2 = {
x: mpr.map((e) => { return e / normalise_x; } ),
y: mpr.map((element) => { return dice_prob(element, dice_rolled, dice_sides); }),
};
if (ystate == 1) {
var factor = data1.y[0];
data1.y = data1.y.map((e) => { return e / factor; });
data2.y = data2.y.map((e) => { return e / factor; });
} else if (ystate == 2) {
} else if (ystate == 3) {
data1.y = data1.y.map((e) => { return e / data2.y[0]; });
data2.y = data2.y.map((e) => { return 1.0; });
}
var xlabel = 'U';
if ($('#dicenormalisation1')[0].checked)
xlabel = 'u';
var traces = [
mergeDeep(
{
name:'Value',
type:'bar',
},
data1
),
{
name:'Peak',
mode: 'markers',
type: 'scatter',
...data2,
},
];
var layout = {
showlegend:false,
xaxis: {
title: '$'+xlabel+'$',
autorange: true,
},
yaxis: {
title: {
text: '$P\\left(' + xlabel + '\\right)$',
},
range:[0, 1.0 / dice_sides + 0.1],
}
};
if (ystate == 1) {
layout.yaxis.autorange = true;
layout.yaxis.title = '$\\Omega\\left(N,\\,'+ xlabel +'\\right)$';
} else if (ystate == 2) {
layout.yaxis.autorange = false;
layout.yaxis.range = [0, 1.0 / dice_sides + 0.1];
layout.yaxis.title = '$P\\left(' + xlabel + '\\right)$';
} else if (ystate == 3) {
layout.yaxis.autorange = false;
layout.yaxis.range = [0, 1.0];
layout.yaxis.title = '$P\\left(' + xlabel + '\\right) / \\left(\\max_{'+xlabel+'} P\\left(' + xlabel + '\\right)\\right)$';
}
return {
data: traces,
layout: mergeDeep(default_plot_Layout, layout),
config: default_plot_Config,
};
}
function diceupdate1() {
var target = $('#dicecount1')[0];
$('#dicecount1label').text("N: "+target.value);
Plotly.react('dicePlot', refresh_dice_plot(target.valueAsNumber, dice_sides));
}
$('#dicecount1').on('input', (event) => { diceupdate1() });
$('#dicenormalisation1').on('input', (event) => { diceupdate1() });
$('input[name=dicey]').on('input', (event) => { diceupdate1() });
Reveal.on( 'slidechanged', event => {
if (event.currentSlide.id == 'dicecount1slide') {
Plotly.plot('dicePlot', refresh_dice_plot(1, 6));
Reveal.layout();
} else {
Plotly.purge('dicePlot');
}
});
</script>
</section>
<section style="height:100%; width:100%;">
<div style="height:90%;width:100%; position:relative;">
<iframe src="http://www.youtube.com/embed/03tx4v0i7MA" frameborder="0" allowfullscreen style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
</div>
</section>
<section class="backbox">
<h3 class="backbox">
Key points from hyper-craps
</h3>
<ul >
<li class="fragment">
Combinations increase incredibly quickly, even for
small systems (20 dice, 189T combinations to roll 70).</li>
<li class="fragment">
The distribution sharpens as $N\to\infty$. Thus
“large” systems will have a relatively
small collection of extremely-high probability states,
which we will call the <b>equilibrium state</b>.
</li>
<li class="fragment">
This equilibrium state <loaded>might be “unique”</loaded>
and appear at a maximum (more on uniqueness later).
</li>
<li class="fragment">
Everything is possible, but much of it is highly
highly highly highly improbable compared to the
equilibrium state.</li>
<li class="fragment">
Normalisation is a convenience to:
<ul>
<li>Make properties <b>intensive</b> (i.e. $U$ to $u$).</li>
<li>Move from combinations to probability, which is more useful for calculations.</li></ul>
</li>
<li class="fragment">
The number of microstates, $\Omega(N,\,U)$, for a
particular dice roll/macrostate, $U$, is an
unnormalised probability.</li>
</ul>
</section>
</section>
<section>
<section data-background="img/Boltzmann_grave.jpg">
<h3 class="backbox">Thermodynamics of craps</h3>
<p class="backbox">
Lets say we start with a roll of hyper-snake-eyes (all
ones). Its <b>density-of-states</b>/combinations is the lowest possible value in this system of $\Omega(N,\, U=N)=1$.
What happens if we start to reroll dice randomly one at
a time?</p>
<p class="backbox fragment">
The system moves towards states with higher $\Omega$,
simply because they are more probable. This movement is
gradual as we're rerolling small portions of dice, thus
introducing quasi-dynamics.</p>
<p class="backbox fragment">
Generally ${\rm d}\Omega \ge 0$..... just like entropy!
</p>
<div class="attribution backbox">
Background <a href="https://en.wikipedia.org/wiki/Ludwig_Boltzmann#/media/File:Zentralfriedhof_Vienna_-_Boltzmann.JPG">Daderot at English Wikipedia</a> - Own work CC BY-SA 3.0
</div>
</section>
<section style="height:100%" data-background="img/Boltzmann_grave.jpg">
<h3 class="backbox">Thermodynamics of craps</h3>
<p class="backbox">
But entropy is additive, i.e. $2\times$ the system size
gives $2\times$ the entropy. Can combinations match this property?</p>
<p class="backbox fragment">
\begin{multline}
\Omega\left(N=N_1+N_2,\,U=U_1+U_2\right) \\
= \Omega\left(N_1,\,U_1\right)\times\Omega\left(N_2,\,U_2\right)
\end{multline}
</p>
<p class="backbox fragment">
\begin{multline}
\ln\Omega\left(N=N_1+N_2,\,U=U_1+U_2\right) \\
= \ln\Omega\left(N_1,\,U_1\right) + \ln\Omega\left(N_2,\,U_2\right)
\end{multline}
</p>
<p class="backbox fragment">
$S = \ln \Omega$ has all the properties of entropy! We
have discovered it inside our game of craps, it is not
too much of a leap to believe it is more fundamental and
in molecular systems too.</p>
<div class="attribution backbox">
Background <a href="https://en.wikipedia.org/wiki/Ludwig_Boltzmann#/media/File:Zentralfriedhof_Vienna_-_Boltzmann.JPG">Daderot at English Wikipedia</a> - Own work CC BY-SA 3.0
</div>
</section>
<section style="height:100%" data-background="img/Boltzmann_grave.jpg">
<h3 class="backbox">Thermodynamics of everything</h3>
<p class="backbox">
Due to a historical accident, the actual relationship to
entropy is multiplied by the Boltzmann constant, $k_B$.
<img src="img/Boltzmann_equation.jfif"><br/>
where $W=\Omega$, and $k.=k_B$.
</p>
<p class="backbox fragment">
We now intuitively understand entropy as some measure of
probability, thus it increases as things move
towards the most probable state... but only probably (!).</p>
<p class="backbox fragment">
This has fascinating implications, i.e. see<a href="https://www.bbc.co.uk/sounds/play/m000lvbx">
The Infinite Monkey Cage: Does Time Exist?"
</a> for one aspect.
</p>
<div class="attribution backbox">
Background <a href="https://en.wikipedia.org/wiki/Ludwig_Boltzmann#/media/File:Zentralfriedhof_Vienna_-_Boltzmann.JPG">Daderot at English Wikipedia</a> - Own work CC BY-SA 3.0
</div>
</section>
<section data-background-image="img/mindblown.gif">
<p class="backbox">
The second law of thermodynamics, put simply, is that
the most likely things will eventually happen and stay
there.
</p>
<p class="backbox fragment">
Richard Feynman says in his Lectures on Physics “…
entropy is just the logarithm of the number of ways of
internally arranging a system while <loaded>have it look the same
from the outside</loaded>”.</p>
<p class="backbox fragment">
Entropy is a measure of how much we don't know, i.e. it
measures our lack of control-over/measurement-of the
microstate.</p>
<p class="backbox fragment">
Entropy is NOT disorder/chaos, its just that there's so many
ways to make a mess...
</p>
<p class="backbox fragment">
Sometimes order is more likely, i.e., look at any
crystal transition.
</p>
</section>
<section style="height:100%">
<h3 class="backbox">Microcanonical ensemble</h3>
<p class="backbox">
We have derived the key relationships of the <b>micro-canonical ensemble</b>,
where the system is isolated (typically $N,\,V,\,E$ held constant in molecular systems):
<span style="font-size:65%">
\begin{align*}
P(N,\,U, \ldots) &= \frac{\Omega\left(N, U, \ldots\right)}{\sum_U \Omega\left(N,\,U, \ldots\right)}
&
S(N,\,U, \ldots) &= k_B \ln \Omega\left(N, U, \ldots\right)
\end{align*}
</span>
</p>
<p class="backbox fragment">
Other thermodynamic properties can be generated from
here, just like in normal thermodynamics
<span style="font-size:65%">
\begin{align*}
\left\langle U\right\rangle &= \sum_U U\,P(N,\,U, \ldots) &
\mu &= - T\frac{\partial S(N,\,U, \ldots)}{\partial N}
\end{align*}
</span>
</p>
<p class="backbox fragment">
We don't have pressure or any other work variable in this system, we'd
need to have some "volume" and "pressure" that somehow contributes to
the dice roll for that.
</p>
<p class="backbox fragment">
However, we do still have temperature, although it requires us to add
the first law.
</p>
</section>
<section>
<h3>Canonical ensemble</h3>
<p>
Lets hold the dice sum, $U$, fixed in ALL our dice
rolls. If you haven't guessed yet from the variable
name, we're adding conservation of energy. </p>
<p class="fragment">
Divide the $N$ dice into two groups, each with a
separate $U_1$ and $U_2 = U - U_1$ which adds to the
(fixed) total $U=U_1+U_2$.
<img src="img/NEDiceEnsemble.svg" style="width:75%" />
</p>
</section>
<section>
<h3>Canonical ensemble</h3>
<p >
The equilibrium value of $U_1$ occurs at the maxiumum
entropy, where the total entropy is:
\begin{align*} \ln \Omega_{1+2}(U_1+U_2) &= \ln
\Omega_1(U_1) + \ln \Omega_2(U_2) \\ \ln
\Omega_{1+2}(U,\,U_1) &= \ln \Omega_1(U_1) + \ln
\Omega_2(U-U_1) \\ \end{align*}
The maximum entropy when varying $U_1$ (but holding $U$ fixed) occurs
at a stationary point, i.e.
\begin{align*}
\left(\frac{{\rm d} \ln
\Omega_{1+2}(U,\,U_1)}{{\rm d} U_1}\right)_{N} = 0
\end{align*}
</p>
</section>
<section>
<h3>The rest of thermodynamics</h3>
<p>
\begin{align*}
\frac{{\rm d}}{{\rm d} U_1}\ln \Omega_{1+2}(U,\,U_1) &= 0\\
\frac{{\rm d}}{{\rm d} U_1}\ln \Omega_1(U_1) + \frac{{\rm d}}{{\rm d} U_1}\ln \Omega_2(U-U_1)&=0 \\
\frac{{\rm d}}{{\rm d} U_1}\ln \Omega_1(U_1) &= \frac{{\rm d}}{{\rm d} U_2}\ln \Omega_2(U_2)
\end{align*}
</p>
<p class="fragment">
We now define some shorthand: \begin{align*} \beta = \frac{{\partial}
S\left(N,\,U,\,\ldots\right)}{{\partial} U} = \frac{{\partial} \ln
\Omega\left(N,\,U,\,\ldots\right)}{{\partial} U} \end{align*} and note
the result, $\beta_1 = \beta_2$ when two systems have fixed energy and
are at maximum entropy/equilibrium.
</p>
</section>
<section>
<h3>Back to reality</h3>
<p>
Thus adding conservation of $U$ between two systems that
can exchange ${\rm d}U$ gives us that $\beta$ must be
equal between the systems at equilibrium. We call this
“thermal” equilibrium if $U$ is energy, even though it
works for conserved dice sum too.</p>
<p class="fragment">
If we look up the derivative $\left({\rm d}S/{\rm
d}U\right)_{N,\ldots}$ in traditional thermodynamics, we
realise that $\beta=1/(k_B\,T)$, and thus have proven
that systems at thermal equilibrium must have the same
temperature.</p>
<p class="fragment">
This generalises to three systems, and thus is proof of the zeroth law.
</p>
<p class="fragment">
Lets now generate the probabilty function for when $U$ is conserved
(and everything else).
</p>
</section>
<section>
<h3>Canonical ensemble</h3>
<p class>
Again, consider system 1 in a <b>microstate</b>, $i$, with
energy $U_{1,i}$ in thermal equilibrium with another
system 2 at constant $U$. The combinations available are
set by system 2's <b>degeneracy</b>:
<span style="font-size:65%">
\begin{align*}
P\left(i\right) \propto \Omega_2(U_2=U-U_{1,i})
\end{align*}
</span>
</p>
<p class="fragment">
Expanding system 2 entropy around $U$:
<span style="font-size:65%">
\begin{align*}
\ln \Omega_2(U_2=U-U_{1,i}) &= \ln\Omega_2(U_2=U)
- U_{1,i} \frac{{\rm d} \ln\Omega_2(U)}{{\rm d}U}
+ \mathcal{O}(1/U)
\\
&\approx \ln\Omega_2(U_2=U) - \frac{U_{1,i}}{k_B\,T}