1 CE 530 Molecular Simulation Lecture 20 Phase Equilibria David A. Kofke Department of Chemical...
-
Upload
theodora-hampton -
Category
Documents
-
view
216 -
download
1
Transcript of 1 CE 530 Molecular Simulation Lecture 20 Phase Equilibria David A. Kofke Department of Chemical...
1
CE 530 Molecular Simulation
Lecture 20
Phase Equilibria
David A. Kofke
Department of Chemical Engineering
SUNY Buffalo
2
Thermodynamic Phase Equilibria
Certain thermodynamic states find that two (or more) phases may be equally stable• thermodynamic phase coexistence
Phases are distinguished by an order parameter; e.g.• density
• structural order parameter
• magnetic or electrostatic moment
Intensive-variable requirements of phase coexistence• T = T
• P = P
• i = i
, i = 1,…,C
3
Phase Diagrams Phase behavior is described via phase diagrams
Gibbs phase rule• F = 2 + C – P
F = number of degrees of freedom– independently specified thermodynamic state variables
C = number of components (chemical species) in the system
P = number of phases
• Single component, F = 3 – P
Fiel
d va
riab
lee.
g.,
tem
pera
ture
Density variable
L+V
tie line
V LS
S+V
L+S
triple point
critical point
Fiel
d va
riab
le(p
ress
ure)
Field variable(temperature)
V
L
S
critical point
isobar
two-phase regions two-phase lines
4
Approximate Methods for Phase Equilibria by Molecular Simulation 1.
Adjust field variables until crossing of phase transition is observed• e.g., lower temperature until condensation/freezing occurs
Problem: metastability may obsure location of true transition
Try it out with the LJ NPT-MC applet
Pres
sure
Temperature
V
L
S
Metastable region
Tem
pera
ture
Density
LS
S+V
L+S
isobar
L+VV Hysteresis
5
Approximate Methods for Phase Equilibria by Molecular Simulation 2.
Select density variable inside of two-phase region• choose density between liquid and vapor values
Problem: finite system size leads to large surface-to-volume ratios for each phase• bulk behavior not modeled
Metastability may still be a problem
Try it out with the SW NVT MD appletT
empe
ratu
reDensity
LS
S+V
L+SL+VV
6
Rigorous Methods for Phase Equilibria by Molecular Simulation
Search for conditions that satisfy equilibrium criteria• equality of temperature, pressure, chemical potentials
Difficulties• evaluation of chemical potential often is not easy
• tedious search-and-evaluation process
Che
mic
al p
oten
tial
Simulation data
Simulation data orequation of state
T constant
Pressure
7
Rigorous Methods for Phase Equilibria by Molecular Simulation
Search for conditions that satisfy equilibrium criteria• equality of temperature, pressure, chemical potentials
Difficulties• evaluation of chemical potential often is not easy
• tedious search-and-evaluation process
Che
mic
al p
oten
tial
Simulation data orequation of state
T constant
Pressure
8
Rigorous Methods for Phase Equilibria by Molecular Simulation
Search for conditions that satisfy equilibrium criteria• equality of temperature, pressure, chemical potentials
Difficulties• evaluation of chemical potential often is not easy
• tedious search-and-evaluation process
Che
mic
al p
oten
tial
Simulation data orequation of state
T constant
Pressure
9
Rigorous Methods for Phase Equilibria by Molecular Simulation
Search for conditions that satisfy equilibrium criteria• equality of temperature, pressure, chemical potentials
Difficulties• evaluation of chemical potential often is not easy
• tedious search-and-evaluation process
Che
mic
al p
oten
tial
Simulation data orequation of state
T constant
Pressure
10
Rigorous Methods for Phase Equilibria by Molecular Simulation
Search for conditions that satisfy equilibrium criteria• equality of temperature, pressure, chemical potentials
Difficulties• evaluation of chemical potential often is not easy
• tedious search-and-evaluation process
Che
mic
al p
oten
tial
Simulation data orequation of state
Coexistence T constant
Pressure
11
Rigorous Methods for Phase Equilibria by Molecular Simulation
Search for conditions that satisfy equilibrium criteria• equality of temperature, pressure, chemical potentials
Difficulties• evaluation of chemical potential often is not easy
• tedious search-and-evaluation process
Che
mic
al p
oten
tial
Simulation data orequation of state
Coexistence T constant
Pressure
Pres
sure
Temperature
VL
S
+
Many simulations to get one point on phase diagram
12
Gibbs Ensemble 1.
Panagiotopoulos in 1987 introduced a clever way to simulate coexisting phases without an interface
Thermodynamic contact without physical contact• How?
Two simulation volumes
13
Gibbs Ensemble 2.
MC simulation includes moves that couple the two simulation volumes
Try it out with the LJ GEMC applet
Particle exchange equilibrates chemical potential
Volume exchange equilibrates pressure
Incidentally, the coupled moves enforce mass and volume balance
14
Gibbs Ensemble Formalism
Partition function
Limiting distribution
General algorithm. For each trial:• with some pre-specified probability, select
molecules displacement/rotation trial
volume exchange trial
molecule exchange trial
• conduct trial move and decide acceptance
1
1 1 1 1 10 0
( , , ) ( , , ) ( , , )VN
GE
N
Q N V T dV Q N V T Q N N V V T
2 1
2 1
N N N
V V V
1 21 21 2 1 1 2 2
3( , ) ( , )
1 1 1 1 2( , , )N NN
N NN N N U V N U VNGE
N V dV d d V d e V d eQ
s sr s s s s
15Molecule-Exchange Trial Move Analysis of Trial Probabilities
Detailed specification of trial moves and probabilities
Event[reverse event]
Probability[reverse probability]
Select box A[select box B]
1/21/2
Select molecule k[select molecule k]
1/NA
[1/(NB+1)]
Move to rnew
[move back to rold]ds/1
[ds/1]
Accept move[accept move]
min(1,)[min(1,1/)]
Forward-step trial probability
Scaled volume
1min(1, )
2 A
d
N
s
Reverse-step trial probability
11min(1, )
2 1B
d
N s
is formulated to satisfy detailed balance
16
Molecule-Exchange Trial MoveAnalysis of Detailed Balance
Detailed balance
i ij j ji=
Limiting distribution
Forward-step trial probability
1min(1, )
2 A
d
N
s Reverse-step trial probability
11min(1, )
2 1B
d
N s
3( , ) ( , )( , , )
N NA BA BA B A A B B
NN NN N N U V N U VN
A A A BAGEN V dV d d V d e V d e
Q
s sr s s s s
17
Molecule-Exchange Trial MoveAnalysis of Detailed Balance
Detailed balance
i ij j ji=
Forward-step trial probability
1min(1, )
2 A
d
N
s Reverse-step trial probability
11min(1, )
2 1B
d
N s
111 11 1
3 3
min(1, )min(1, )
2 2( 1)
old newA B A BB A BN N N NN N N NU U
A AB BA AN GE N GE
A B
de V d V d dV e V d V d dVd
N NQ Q
ss s s ss
Limiting distribution
3( , ) ( , )( , , )
N NA BA BA B A A B B
NN NN N N U V N U VN
A A A BAGEN V dV d d V d e V d e
Q
s sr s s s s
18
Molecule-Exchange Trial MoveAnalysis of Detailed Balance
Detailed balance
111 11 1
3 3
min(1, )min(1, )
2 2( 1)
old newA B A BB A BN N N NN N N NU U
A AB BA AN GE N GE
A B
de V d V d dV e V d V d dVd
N NQ Q
ss s s ss
i ij j ji=
Forward-step trial probability
1min(1, )
2 A
d
N
s Reverse-step trial probability
11min(1, )
2 1B
d
N s
1 1
1
old newU U B
A A B
Ve e
N V N
1totUB A
A B
V Ne
V N
Acceptance probability
19
Volume-Exchange Trial Move Analysis of Trial Probabilities
Take steps in = ln(VA/VB)
Detailed specification of trial moves and probabilities
Event[reverse event]
Probability[reverse probability]
Step to new
[step to old]d/d/
Accept move[accept move]
min(1,)[min(1,1/)]
Forward-step trial probability
min(1, )d
Reverse-step trial probability
1min(1, )d
1 1
1
A B A B
VA AV V V V
A A BV
d dV dV
dV V V d
20
Volume-Exchange Trial MoveAnalysis of Detailed Balance
Detailed balance
i ij j ji=
Limiting distribution
Forward-step trial probability
Reverse-step trial probability
31 1( , ) ( , )( , , )
N NA BA BA B A A B B
NN NN N N U V N U VN
A A BAGE
dN V d d d V d e V d e
VQ
s sr s s s s
min(1, )d
1min(1, )d
21
Volume-Exchange Trial MoveAnalysis of Detailed Balance
Detailed balance
i ij j ji=
1 11 11 1,,,,
3 3
min(1, )min(1, )newold
A BA BA B B N NN NN N UN NUB jA jB iA i
N GE N GE
de V d V de V d V d d
Q Q
s ss s
Limiting distribution
Forward-step trial probability
Reverse-step trial probability
31 1( , ) ( , )( , , )
N NA BA BA B A A B B
NN NN N N U V N U VN
A A BAGE
dN V d d d V d e V d e
VQ
s sr s s s s
min(1, )d
1min(1, )d
22
Volume-Exchange Trial MoveAnalysis of Detailed Balance
Detailed balance
i ij j ji=
Forward-step trial probability
Reverse-step trial probability
1 1 1 1, ,, ,
old newA B A BN N N NU U
B i B iA i A ie V V e V V
1 1A B
tot
N Nnew newUA B
old oldA B
V Ve
V V
Acceptance probability
1 11 11 1,,,,
3 3
min(1, )min(1, )newold
A BA BA B B N NN NN N UN NUB jA jB iA i
N GE N GE
de V d V de V d V d d
Q Q
s ss s
min(1, )d
1min(1, )d
23
Gibbs Ensemble in the Molecular Simulation API
U ser 's P erspe ctiv e o n the M o lecu la r S im u la tion A P I
S pa ce
In teg ra to rG E M C
C on tro lle r
M ete r B ou nda ry C on fig ura tion
P ha se S p ec ies P o te n tia l D isp lay D ev ice
S im ula tion
24
Gibbs Ensemble MCExamination of Java Code. General
//Performs basic GEMC trial//At present, suitable only for single-component systemspublic void doStep() { int i = (int)(rand.nextDouble()*iTotal); //select type of trial to perform if(i < iDisplace) { //displace a randomly selected atom if(rand.nextDouble() < 0.5) {atomDisplace.doTrial(firstPhase);} else {atomDisplace.doTrial(secondPhase);} } else if(i < iVolume) { //volume exchange trialVolume(); } else { //molecule exchange if(rand.nextDouble() < 0.5) { trialExchange(firstPhase,secondPhase,firstPhase.parentSimulation.firstSpecies); } else { trialExchange(secondPhase,firstPhase,firstPhase.parentSimulation.firstSpecies); } }}
public class IntegratorGEMC extends Integrator
25
Gibbs Ensemble MCExamination of Java Code. Molecule Exchange/** * Performs a GEMC molecule-exchange trial */private void trialExchange(Phase iPhase, Phase dPhase, Species species) { Species.Agent iSpecies = species.getAgent(iPhase); //insertion-phase speciesAgent Species.Agent dSpecies = species.getAgent(dPhase); //deletion-phase species Agent double uNew, uOld; if(dSpecies.nMolecules == 0) {return;} //no molecules to delete; trial is over Molecule m = dSpecies.randomMolecule(); //select random molecule to delete uOld = dPhase.potentialEnergy.currentValue(m); //get its contribution to energy m.displaceTo(iPhase.randomPosition()); //place at random in insertion phase uNew = iPhase.potentialEnergy.insertionValue(m); //get its new energy if(uNew == Double.MAX_VALUE) { //overlap; reject m.replace(); //put it back return; } double bFactor = dSpecies.nMolecules/dPhase.volume()//acceptance probability * iPhase.volume()/(iSpecies.nMolecules+1) * Math.exp(-(uNew-uOld)/temperature); if(bFactor > 1.0 || bFactor > rand.nextDouble()) { //accept iPhase.addMolecule(m,iSpecies); //place molecule in phase } else { //reject m.replace(); //put it back }}
public class IntegratorGEMC extends Integrator
26
Gibbs Ensemble MCExamination of Java Code. Volume Exchange
private void trialVolume() { double v1Old = firstPhase.volume(); double v2Old = secondPhase.volume(); double hOld = firstPhase.potentialEnergy.currentValue() + secondPhase.potentialEnergy.currentValue(); double vStep = (2.*rand.nextDouble()-1.)*maxVStep; //uniform step in volume double v1New = v1Old + vStep; double v2New = v2Old - vStep; double v1Scale = v1New/v1Old; double v2Scale = v2New/v2Old; double r1Scale = Math.pow(v1Scale,1.0/(double)Simulation.D); double r2Scale = Math.pow(v2Scale,1.0/(double)Simulation.D); firstPhase.inflate(r1Scale); //perturb volumes secondPhase.inflate(r2Scale); double hNew = firstPhase.potentialEnergy.currentValue() //acceptance probability + secondPhase.potentialEnergy.currentValue(); if(hNew >= Double.MAX_VALUE || Math.exp(-(hNew-hOld)/temperature + firstPhase.moleculeCount*Math.log(v1Scale) + secondPhase.moleculeCount*Math.log(v2Scale)) < rand.nextDouble()) { //reject; restore volumes firstPhase.inflate(1.0/r1Scale); secondPhase.inflate(1.0/r2Scale); } //accept; nothing more to do}
public class IntegratorGEMC extends Integrator
27
Gibbs Ensemble Example Applications
Seen in first lecture
28
Water and Aqueous Solutions GEMC simulation of water/methanol mixtures
• Strauch and Cummings, Fluid Phase Equilibria, 86 (1993) 147-172; Chialvo and Cummings, Molecular Simulation, 11 (1993) 163-175.
29
Phase Behavior of Alkanes
Panagiotopoulos group• Histogram reweighting with finite-size scaling
30
Critical Properties of Alkanes Siepmann et al. (1993)
31
Alkane Mixtures
Siepmann group• Ethane +
n-heptane
32
Gibbs Ensemble Limitations Limitations arise from particle-exchange requirement
• Molecular dynamics (polarizable models)
• Dense phases, or complex molecular models
• Solid phases N = 4n3 (fcc)
and sometimes from the volume-exchange requirement too
?
33
Approaching the Critical Point Critical phenomena are difficult to capture by molecular simulation Density fluctuations are related to compressibility Correlations between fluctuations important to behavior
• in thermodynamic limit correlations have infinite range
• in simulation correlations limited by system size
• surface tension vanishes
Pres
sure
Density
L+VV LS
S+V
L+S
Cisotherm
0P 1 1
T
V
V P P
2
34
Critical Phenomena and the Gibbs Ensemble
Phase identities break down as critical point is approached• Boxes swap “identities” (liquid vs. vapor)
• Both phases begin to appear in each boxsurface free energy goes to zero
35
Gibbs-Duhem Integration
GD equation can be used to derive Clapeyron equation
• equation for coexistence line
Treat as a nonlinear first-order ODE• use simulation to evaluate
right-hand side
Trace an integration path the coincides with the coexistence line
ln p
–h
Z
Fiel
d va
riab
le(p
ress
ure)
Field variable(temperature)
V
L
S
critical point
36
lnp
lnp
lnp
GDI Predictor-Corrector Implementation Given initial condition and slope
(= –h/Z), predict new (p,T) pair.
Evaluate slope at new state condition…
…and use to correct estimate of new (p,T) pair
37
GDI Simulation Algorithm
Estimate pressure and temperature from predictor Begin simultaneous NpT simulation of both phases at the
estimated conditions As simulation progresses, estimate new slope from ongoing
simulation data and use with corrector to adjust p and T Continue simulation until the iterations and the simulation
averages converge Repeat for the next state point
Each simulation yields a coexistence point.Particle insertions are never attempted.
38
Gibbs-Duhem Integration in the Molecular Simulation API
U ser 's P erspe ctiv e o n the M o lecu la r S im u la tion A P I
S pa ce
In te gra to r
C o ntro lle rG D I
M ete r B ou nda ry C on fig u ra tion
P ha se S p ec ies P o te n tia l D isp lay D ev ice
S im u la tion
39
GDI Sources of Error
Three primary sources of error in GDI method
1
Stochastic error
lnp
2
Uncertainty in slopes due to uncertainty in simulation averages
Quantify via propagation of error using confidence limits of simulation averages
Finite step of integrator
• Smaller step• Integrate series with
every-other datum• Compare predictor and
corrector values
Stability
• Stability can be quantified
• Error initial condition can be corrected even after series is complete
1
2
1
2True curve
?
Incorrect initial condition
40
GDI Applications and Extensions
Applied to a pressure-temperature phase equilibria in a wide variety of model systems• emphasis on applications to solid-fluid coexistence
Can be extended to describe coexistence in other planes• variation of potential parameters
inverse-power softness
stiffness of polymers
range of attraction in square-well and triangle-well
variation of electrostatic polarizability
• as with free energy methods, need to identify and measure variation of free energy with potential parameter
• mixturesA U
41
Semigrand Ensemble Thermodynamic formalism for mixtures
Rearrange
Legendre transform
• Independent variables include N and 2
• Dependent variables include N2
must determine this by ensemble average
ensemble includes elements differing in composition at same total N
Ensemble distribution
1 1 2 2Ud Pd d dVdA N N
1 1 2 2 1 2
1 2 2
( ) ( )dA d N N dN
d
Ud Pd
N dNUd Pd
V
V
1 2 1 2dN dN
2 2
1 2 2
( )dY d A N
dN N dUd PdV
2 2 23
( , , )1 12 !
, ,N N
NE p r N NN N
h NN e e
r p
42
GDI/GE with the Semigrand Ensemble
Governing differential equation (pressure-composition plane)
2
2 ,
ln
T
xp
Z
0.10
0.09
0.08
0.07
0.06
Pre
ssur
e
1.00.80.60.40.20.0
Mole Fraction of Species 2
Gibbs Ensemble Gibbs-Duhem Integration
11 1 11 1
12 1 12 0.75
22 1 22 1
Simple LJ Binary
43
GDI with the Semigrand Ensemble Freezing of polydisperse hard spheres
• appropriate model for colloids
Integrate in pressure-polydispersity plane
Findings• upper polydisersity bound to freezing
• re-entrant melting1.4
1.3
1.2
1.1
1.0
0.9
Den
sity
0.70.60.50.40.30.20.10.0
Polydispersity
c1 = 1
c2 = 1
solid
fluid
22 / 2
( / )sat
dp m
d V N
Composition(Fugacity)
Diameter
m2
44
Other Views of Coexistence Surface Dew and bubble lines Residue curves Azeotropes
• semigrand ensemble
• formulate appropriate differential equation
• integrate as in standard GDI methodright-hand side involves partial molar properties
,
1
,
1
,
1
,
1
,
1
,
1
)(
PP
azeo
sat
PP
azeo XY
d
dP
P
Y
P
XYX
d
d
)( VL
VL
azeo
sat
vv
hh
d
dP
45
Tracing of Azeotropes Lennard-Jones binary, variation with intermolecular
potential• 11 = 1.0; 12 = 1.05; 22 = variable
• 11 = 1.0; 12 = 0.90; 22 = 1.0
• T = 1.10
0.0425
0.0445
0.0465
0.0485
0.0505
0.0525
0.0545
0 0.1 0.2 0.3 0.4 0.5
X2, Y2
Coe
xist
ence
pre
ssur
e, P
*
46
Summary Thermodynamic phase behavior is interesting and useful Obvious methods for evaluating phase behavior by simulation are too
approximate Rigorous thermodynamic method is tedious Gibbs ensemble revolutionized methodology
• two coexisting phases without an interface
Gibbs-Duhem integration provides an alternative to use in situations where GE fails• dense and complex fluids
• solids
Semigrand ensemble is useful formalism for mixtures GDI can be extended in many ways