30
Lecture 4 Microstates, Multiplicity of a macrostate 29.08.2019 Fys2160 2019 1

Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Lecture 4Microstates, Multiplicity of a macrostate

29.08.2019

Fys2160 2019 1

Page 2: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Microstates and macrostates

• Microstates:• MD, ideal gas: particular xi and vi

(not countable)• RW, particular xi and vi (countable

on grid)• Algorithmic: single particle states

si=1 (left), si=0 (right)

• Macrostates• n = number of particles on left

side• n = 0, 1, 2, ..., N• Algo: n=Si si

Fys2160 2018 2

Page 3: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Microstates and macrostates• Box with left and right side• Example: 𝑁 = 5• Particles can be distinguished (i=1,

2,.. 5)• Particle states left:

• si=1• right: si=0

• macrostates n=Si si (= 1,2, ..5)• Total number of microstates: 25=32• List the possible microstates of n=1

Fys2160 2018 3

• 00001• 00010• 00100• 01000• 10000

5 microstates => multiplicity 𝛀(n,N) of macrostate n=1 is 𝛀(1,5) = 5

Page 4: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Multiplicity of macrostates

4

n=200011001010100110001001100101001100100101010011000

𝛀(0,5)=10

n=10000100010001000100010000

𝛀(0,5)=5

n=311100110101011001110110011010110011011010101100111

𝛀(0,5)=10

n=41111011101110111011101111

𝛀(4,5)=5

n=511111

𝛀(5,5)=1

n=000000

𝛀(0,5)=1

Number of possible microstates: Ω. = ∑0123 Ω 𝑛 = 32(= 23)

General formula for multiplicity: Ω 𝑛,𝑁 = :!:<0 !0!

Ω 2,5 = 3!=!>!

= 10

Probability of macrostates: P n, N = Ω 𝑛,𝑁 /2: = >EF:!:<0 !0!

Page 5: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Plots of multiplicity and probability

Fys2160 2018 5

Page 6: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Summary: multiplicity of a system with Nparticles in a macrostate with n particles onthe left side

Number of microstates with n on left side: Ω 𝑛,𝑁 = :!0! :<0 !

Total number of microstates

G012

:

Ω 𝑛,𝑁 = G012

:𝑁!

𝑛! 𝑁 − 𝑛 ! = 2:

Probability of a macrostate with n on left side:

𝑃 𝑛,𝑁 =Ω 𝑛,𝑁

∑0Ω 𝑛,𝑁=

𝑁! 2<:

𝑛! 𝑁 − 𝑛 !

Fys2160 2018 6

n N-n

Page 7: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Apply this type of combinatorics to

1. Paramagnetic systems

2. Random walks

3. Thermal vibrations in crystals

Fys2160 2018 7

Page 8: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Two-state paramagnet model

Paramagnetic solid:

• A system of N independent, localised particles with spin 𝑠 = ±1 in a constantmagnetic field 𝑩

• Energy of a single spin 𝜖 = −𝑠𝜇𝐵

• For 𝑁 spins , we have 𝑁 = 𝑁↓ + 𝑁↑• Net magnetization

𝑴 = 𝝁G𝒊1𝟏

𝑵

𝒔𝒊 = 𝝁 𝑵↑ − 𝑵↓ = 𝝁(𝑵 − 𝟐𝑵↑)

• Average magnetization⟨𝑴⟩ = 𝝁(𝑵 − 𝟐⟨𝑵↑⟩)

Fys2160 2018 8

𝐁

𝜖+𝜇𝐵

0

−𝜇𝐵

𝑠 = −1

𝑠 = +1

Page 9: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Two-state paramagnet model, B=0

• Consider a paramagnet with N spins at zero applied field

• Spins ↑ or ↓ have the same energy

• Microstate is a particular configuration of spins ↑ and ↓

What is the multiplicity of macrostate with 𝑵↑ out of 𝑵 spins?

𝛀 𝐍,𝐍↑ = ?

Fys2160 2018 9

Page 10: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

What is the multiplicity of macrostate with 𝑵↑ out of 𝑵 spins?

Ω 𝑁,𝑁↑ =𝑁!

𝑁↑! 𝑁 − 𝑁↑ !

Total number of microstates

G:↑12

:

Ω(𝑁↑) = G012

:𝑁!

𝑁↑! 𝑁 − 𝑁↑ != 2:

Probability of a macrostate with 𝑁↑ spins up

𝑃 𝑁↑ = 2<:Ω 𝑁,𝑁↑

Fys2160 2018 10

Page 11: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

What is the average number of 𝑁↑?

𝑁↑ = G:↑12

:

𝑁↑ 𝑃 𝑁,𝑁↑

Fys2160 2018 11

𝑁↑ = 2<: G:↑12

:

𝑁↑𝑁!

𝑁↑! 𝑁 − 𝑁↑ !

𝑁↑ =𝑁2

Page 12: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Macrostate with𝑁↑ = 𝑁↑ has the largest multiplicity

• 𝑁↑ = :>

• ⟨𝑴⟩ = 𝝁(𝑵 − 𝟐⟨𝑵↑⟩)

• ⟨𝑴⟩ = 𝟎

• In the absence of an external magneticfield, spins are randomly oriented with a zero net magnetization

Fys2160 2018 12

Page 13: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

1D Random walk

• Random motion of a walker along a line• Discrete time steps 𝑁 = 0,1,2⋯ in units of Δ𝑡 = 1• Discrete space: lattice index 𝑗 = 0,±1,±2⋯ with increments Δ𝑥 = 1

• At each timestep, the walker has probability 𝑝 = f>

to the right 𝑗 →𝑗 + 1

and probability 𝑞 = f>

to the left 𝑗 → 𝑗 − 1

• What is the probability distribution for R steps to the rightN steps, 𝑃(𝑁, 𝑅)?

• What is the mean displacement ⟨𝑆⟩ after 𝑁 steps?

Fys2160 2018 13

𝑝 =12

𝑞 =12

𝑗 + 1𝑗𝑗 − 1

Page 14: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

1D Random Walk

Fys2160 2018 14

𝑝 =12𝑞 =

12

𝑗 + 1𝑗𝑗 − 1

Page 15: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

1D Random Walk

Fys2160 2018 15

𝑝 =12𝑞 =

12

𝑗 + 1𝑗𝑗 − 1

Page 16: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

1D Random walk

After 𝑁 steps, we have 𝑅 steps to the right and 𝐿 steps to the right

𝑅 + 𝐿 = 𝑁, 𝑆 = 𝑅 − 𝐿 (net displacement)

• Number of configurations in which we have 𝑅 right steps out of 𝑁 steps

Ω 𝑁,𝑅 =𝑁!

𝑅! 𝑁 − 𝑅 !

• Probability for 𝑅 steps to the right out of 𝑁 steps

𝑃 𝑁,𝑅 = Ω 𝑁,𝑅12

l 12

:<l= 2<:

𝑁!𝑅! 𝑁 − 𝑅 !

Fys2160 2018 16

𝑝 =12𝑞 =

12

𝑗 + 1𝑗𝑗 − 1

Page 17: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

1D Random walk

• Probability for 𝑅 steps to the right out of 𝑁 steps

𝑃 𝑁, 𝑅 = 2<:𝑁!

𝑅! 𝑁 − 𝑅 !

• Normalization condition: probability for 𝑁 steps

Gl12

:

𝑃(𝑁, 𝑅) = 2<: Gl12

:𝑁!

𝑅! 𝑁 − 𝑅 != 1

Fys2160 2018 17

𝑝 =12𝑞 =

12

𝑗 + 1𝑗𝑗 − 1

Page 18: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Average displacement from the origin

𝑅 =𝑁2

𝑆 = 𝑅 − (𝑁 − 𝑅 ) = 2 𝑅 − 𝑁

𝑆 = 0

Fys2160 2018 18

𝑝 =12𝑞 =

12

𝑗 + 1𝑗𝑗 − 1

Page 19: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Thermal vibrations in solids: Einstein crystal

• Collection of identical harmonicoscillators

• Each atomin3Dhas3one-dimensional harmonic oscillators

• Classical harmonic oscillator

• 𝑈f =z{

>|+ f

>𝑚𝜔>(𝑥 − 𝑥2)>

• Frequency 𝜔 = �|

Fys2160 2018 19

𝑈 =𝑝>

2𝑚+12𝜅𝑥>

𝑉 = 0, 𝑇 =𝑝>

2𝑚

𝑉 =12𝜅𝑥>, 𝑇 = 0𝑈

Page 20: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Einstein crystal modelOne quantum harmonic oscillator

�𝐻 =�̂�>

2𝑚+12𝜅�𝑥> =

�̂�>

2𝑚+12𝑚𝜔> �𝑥>

Quantized energy levels 𝜖 = 𝑛 + f>ℏ𝜔

Energy level relative to the ground state

Δ𝜖 = 𝑛ℏ𝜔

Total energy of N harmonic oscillators

𝑈: = ∑�1f: 𝜖� = ∑�1f: 𝑛� ℏ𝜔 +:>ℏ𝜔

Energy units (integer numbers) for N quantum harmonic oscillators at frequency 𝝎

𝐪 =𝑼𝑵 −

𝑵𝟐 ℏ𝝎

ℏ𝝎 Fys2160 2018 20

Page 21: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Find multiplicity Ω(𝑞, 𝑁) of a macrostate with 𝑁 oscillators and 𝑞 units of energy distributed between them

𝑞 = 1, 𝑁 = 4

Ω 1,4 = 4

Fys2160 2018 21

#1 #2 #3 #4

1 0 0 0

0 1 0 0

0 0 1 0

0 0 0 1

Page 22: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Find multiplicity Ω(𝑞, 𝑁) of a macrostate with 𝑁 oscillators and 𝑞 units of energy distributed between them

𝑞 = 2, 𝑁 = 4

Ω 2,4 =?

Fys2160 2018 22

Ω 2,4 = 10

1 oscillators has 2 energy quanta, and 3 oscillators are in the ground state

2 oscillators have 1 energy quanta each, and 2 oscillators are in the ground state

2 0 0 0

1 1 0 0

2000 11000200 10100020 10010002 0101

00110110

Page 23: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Trick: Call balls 0 and walls 1

𝑞 = 2, 𝑁 = 4

Ω 2,4 =?

Fys2160 2018 23

Ω 2,4 =𝑁 − 1 + 𝑞 !𝑞! 𝑁 − 1 ! = 10

1 oscillators has 2 energy quanta, and 3 oscillators are in the ground state

2 oscillators have 1 energy quanta each, and 2 oscillators are in the ground state

0 0 1 1 1

0 1 0 1 1

00111011101110001011011011101010110101011001101011

N-1 wallsq balls=> 2 states, N-1+q particles, N-1

General formula for multiplicity formacrostate• n in state 1 (N-1)• in system with 2 states• N particles (N-1+q)

Ω 𝑛,𝑁 =𝑁!

𝑁 − 𝑛 ! 𝑛!

Page 24: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Find multiplicity Ω(𝑞, 𝑁) of a macrostate with 𝑁 oscillators and 𝑞 units of energy distributed between them

Ω 3,4 =?

Fys2160 2018 24

Ω 3,4 = 20

3 oscillators are in an excited state, and the 4th is in the ground state

1 oscillators has 2 energy quanta, 1 oscillator has 1 energyquanta and 2 oscillators are in the ground state

1 oscillators has 3 energy quanta, and 3 oscillators are in the ground state

Page 25: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Weakly-coupled Einstein crystals

Ω� 𝑞�,𝑁� =𝑁� − 1 + 𝑞� !𝑞�! 𝑁� − 1 !

Ω 𝑞�,𝑁� =𝑁� − 1 + 𝑞� !𝑞�! 𝑁� − 1 !

Composite system: 𝑞 = 𝑞� + 𝑞�, 𝑁 = 𝑁� + 𝑁�

Multiplicity of a macrostate of the composite systems

𝜴𝐭 = 𝛀𝑨 𝒒𝑨,𝑵𝑨 ⋅ 𝛀𝑩(𝒒𝑩,𝑵𝑩)

Fys2160 2018 25

CrystalA𝑁�, 𝑞�

CrystalB𝑁�, 𝑞�

Page 26: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Weakly-coupled Einstein crystals

Multiplicity of a macrostate with 𝑞�and 𝑞� = 𝑞 − 𝑞� for two coupledEinstein solids

𝜴𝐭(𝐪𝐀, 𝐪, 𝐍)= 𝛀𝑨 𝒒𝑨,𝑵𝑨 ⋅ 𝛀𝑩(𝒒𝑩,𝑵𝑩)

What the macrostate with themaximum multiplicity ?

Matlab tests..

Fys2160 2018 26

CrystalA𝑁�, 𝑞�

CrystalB𝑁�, 𝑞�

Page 27: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Weakly-coupled Einstein crystals

Multiplicity of a macrostate with 𝑞� and 𝑞� = 𝑞 − 𝑞� for two coupled Einstein solids

𝜴𝐭(𝐪𝐀, 𝐪, 𝐍) = 𝛀𝑨 𝒒𝑨,𝑵𝑨 ⋅ 𝛀𝑩(𝒒𝑩,𝑵𝑩)

What the macrostate with the maximummultiplicity ?

Matlab tests..

Fys2160 2018 27

CrystalA𝑁�, 𝑞�

CrystalB𝑁�, 𝑞�

Page 28: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Take home---• Multiplicity in two-state systems (paramagnets, random walk)

Ω 𝑛,𝑁 =𝑁!

𝑛! 𝑁 − 𝑛 !

has a maximum peaked around the average value ⟨𝑛⟩

• Multiplicity in Einstein crystal by analogy with q «identical balls» (energy units) and N «identical bins» (oscillators)

Ω 𝑞,𝑁 =(𝑁 − 1+ 𝑞)!(𝑁 − 1)! 𝑞!

• Multiplicity of two-coupled Einstein crystal

Ω� = Ω� ⋅ Ω�

has also a maximum around the average value

• Macrostates with maximum multiplicity are the most likely and they correspond to the average values

Fys2160 2018 28

Page 29: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Fys2160 2018 29

NA = 300; NB = 100; % Nr of oscillatorsqA = 500; qB = 500; % Initial energyq = qA + qB; % Total energyN = NA + NB; % Total oscillatorsstate = zeros(N,1); % Microstate of the system% state(1:NA) is part A, state(NA+1:NA+NB) is part B% Generate initial, random microstateplaceA = randi(NA,qA,1);figure(1)for ip = 1:qA;

state(placeA(ip)) = state(placeA(ip)) + 1;endplaceB = randi(NB,qB,1);for ip = 1:qB;

i = NA + placeB(ip);state(i) = state(i) + 1;

end% Simulate random state developmentnstep = 100000; % Number of stepsEA = zeros(nstep,1); EB = zeros(nstep,1);for istep = 1:nstep

i1 = randi(N,1,1); % Select random osc. i1if (state(i1)>0) % Does it have any energy ?

i2 = randi(N,1,1); % Select random osc. i2state(i2) = state(i2) + 1; % Transferstate(i1) = state(i1) - 1; % energy

endEA(istep) = double(sum(state(1:NA)))/NA;EB(istep) = double(sum(state(NA+1:end)))/NB;if rem(istep,100)==1

subplot(2,1,1) % Microstate of systemplot((1:NA),state(1:NA),'b',(1:NB)+NA,state(NA+1:end),'r');xlabel('i'); ylabel('n_i'); drawnowsubplot(2,1,2); % Avg energy in each systemplot((1:istep),EA(1:istep),'-b',(1:istep),EB(1:istep),'-r');xlabel('t'); ylabel('q_A/N_A , q_B/N_B'), drawnow

endendline([0 nstep],[q/N q/N])

• NA=3NB => this means that the crystal is 3 times bigger• qA=qB => this means they have the same total energy• Temperature is related to energy per oscillator• Therefore temperature of crystal B is TB=3TA• Random transfer of energy => towards thermal equilibrium• Thermal equilibrium = equal temperature

Page 30: Lecture4 - Forsiden - Universitetet i Oslo · Multiplicityofmacrostates 4 n=2 00011 00101 01001 10001 00110 01010 01100 10010 10100 11000,(0,5)=10 n=1 00001 00010 00100 01000 10000,(0,5)=5

Fys2160 2018 30

% Two Einstein solids NA & NB oscillators% in contact to exchange energyNA = 30; % Number of oscillators in crystal ANB = 10; % Number of oscillators in crystal Bq = 50; % qA+qB total energy of crystals A and B% Find multiplicity of all macrostatesnstate = q+1; % number of statesqA = 0:q; % all possible values of qAqB = q - qA; % all possible values of qBOmegaA = zeros(nstate,1);OmegaB = OmegaA;FontSize=20;% Loop through all macrostates and find multiplicityfor i = 1:nstate

OmegaA(i) = nchoosek(qA(i)+NA-1,qA(i)); %binomialOmegaB(i) = nchoosek(qB(i)+NB-1,qB(i)); %binomial

endOmegaTOT= OmegaA.*OmegaB; % Total multiplicityfigure(1)subplot(1,2,1), plot(qA,OmegaTOT/max(OmegaTOT),'-o');subplot(1,2,2), semilogy(qA,OmegaTOT/max(OmegaTOT),'-o');% pretty plotting...maxO=sprintf('%0.3g',max(OmegaTOT));title(['max(\Omega_{Tot}) = ',maxO],'FontSize',FontSize)for i=1:2

subplot(1,2,i)xlabel('q_A','FontSize',FontSize)ylabel('\Omega_{Tot}(N_A, N_B, q_A) / max(\Omega_{Tot})','FontSize',FontSize)h=gca;h.FontSize=FontSize;

end%%figure(2)P=OmegaTOT/sum(OmegaTOT);subplot(1,2,1), plot(qA,P,'-o');subplot(1,2,2), semilogy(qA,P,'-o');% pretty plotting...FontSize=20;for i=1:2

subplot(1,2,i)xlabel('q_A','FontSize',FontSize)ylabel('P(N_A, N_B, q_A)','FontSize',FontSize)h=gca;h.FontSize=FontSize;

end[Pmax,qmax]=max(P);subplot(1,2,1), text(60, Pmax+0.01,['q_A(P_{max})=',num2str(qmax)],'FontSize',FontSize-2)%%qA0=q/2; % (Hypothetical) initial energy of crystal A[Pmax,qmax]=max(P);qmax=qmax-1; % Matlab counts from 1.., q goes from 0..figure(2)subplot(1,2,1), text(qA0-10, Pmax/2,['q_{A,0}=',num2str(qA0)],'FontSize',FontSize-2)subplot(1,2,1), hold onplot([qA0 qA0],[0 max(OmegaTOT/sum(OmegaTOT))],'k-')plot([qA0 qA0],[0 max(OmegaTOT/sum(OmegaTOT))],'k-')hold offsubplot(1,2,2), hold on, semilogy([qA0 qA0],[1e-50 1],'k-'), hold offPmaxoverP0=sprintf('%0.5g',Pmax/P(qA0));subplot(1,2,2), text(30,1e-20,['P_{max}/P(q_{A0})=',PmaxoverP0],'FontSize',FontSize-2)