particles in a box Chemical Equilibrium
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
Visualizing the dynamic distribution of molecules between two states with different free energy
This model simulates molecules in a thermal bath that can switch between two states. The states differ in standard enthalpy (H°) and entropy (S°). The height difference represents ΔH°, while the width of each sector represents ΔS°. This two-sector box visually represents a single-molecule reaction such as:
1-propanol ⇌ 2-propanol
HOW IT WORKS
Stochastic Energy
Molecules gain energy stochastically based on the Boltzmann probability, simulating energy "injection" from a thermal bath. Molecules jump to different heights based on their current state and the Boltzmann-weighted probability of energy absorption. If a molecule reaches a height higher than the energy step between states, the probability of transitioning depends on the relative widths of the two sectors.
Energy Allocation (Boltzmann’s Law)
- Energy levels follow the Boltzmann probability:
p = exp(-ΔE / (R*T))
where ΔE is the energy difference. - Energy jumps follow:
ΔE = -ln(random) * R*T
(whererandom
is a uniform number between 0 and 1.)
In this box model, entropy is represented by sector width, while energy (enthalpy) is represented by height. In reality, reactants and products exist in the same physical space, but here they are represented in separate sectors, each with an energy level determined by its height and a population following Boltzmann's distribution.
ADJUSTABLE PARAMETERS
- number-of-particles: Total number of molecules in the box. Fewer molecules show larger fluctuations in average energy (demonstrating statistical uncertainty).
- entropy2 (ΔS°): Standard entropy difference (S° reactant - S° product). The sector width reflects this difference.
- enthalpy2 (ΔH°): Standard enthalpy difference (H° reactant - H° product). The sector height reflects this difference.
- temperature (T): Governs energy spread. Higher T allows more molecules to populate high-energy states.
- avance (reaction progress): Defines the initial distribution of molecules between the two compartments (0 = all reactants, 1 = all products).
THINGS TO NOTICE
A fundamental law of thermodynamics states that a system evolves to minimize its Gibbs free energy (G):
G = H – T*S
For a system at constant pressure and temperature, the equilibrium state is determined by minimizing G, balancing energy (H) and entropy (S).
Reaction Equilibrium
Green particles ⇌ Red particles
At equilibrium, standard Gibbs free energy change (ΔG°) relates to entropy and enthalpy gradients:
ΔG° = ΔH° − TΔS°
The reaction quotient adjusts Gibbs free energy:
ΔG = ΔG° + RT ln(Reactants / Products)
At equilibrium (ΔG = 0), we get:
ΔG° = -RT ln(K)
where K is the equilibrium constant:
K = (Products at equilibrium) / (Reactants at equilibrium)
.
THINGS TO TRY
- Observe reaction movement toward equilibrium: Regardless of initial conditions, the system evolves to minimize G.
- Explore temperature effects: Higher T favors the entropy-dominant state, while lower T favors lower-energy states.
- Adjust ΔS° and ΔH°: See how entropy and enthalpy changes affect equilibrium positioning.
KEY TAKEAWAY
This model visually demonstrates how molecules distribute between two compartments following Boltzmann statistics, mirroring a chemical reaction.
The relationship between free energy, entropy, and enthalpy naturally emerges from the stochastic movement of particles. Reaction equilibrium, progress, and temperature dependence arise from statistical mechanics principles.
CALCULATING SECTOR WIDTHS BASED ON ΔS°
Sector widths correspond to the entropy difference (ΔS°), as entropy influences the probability of a molecule being in a given state. Since Boltzmann’s entropy definition is:
S = R ln(W)
,
where W represents the number of available microstates, we define probabilities for the two sectors:
p₁ = W₁ / Wₜ
p₂ = W₂ / Wₜ
,
where Wₜ = W₁ + W₂ accounts for all possible configurations.
The entropy difference between compartments is determined by:
ΔS = R ln(W₂) - R ln(W₁) = R ln(W₂ / W₁)
.
Rewriting in terms of probabilities:
ln((1 - p₁) / p₁) = ΔS / R
.
Solving for p₁:
p₁ = 1 / (1 + exp(ΔS / R))
.
Since R is the gas constant (R = k_B × Avogadro’s number), in kcal/(mol·K), we can calculate p₁ and p₂ directly from the entropy difference.
Thus, the relative sector widths in the NetLogo model follow the Boltzmann distribution, reflecting how entropy influences state occupancy at equilibrium.
COPYRIGHT AND LICENSE
Copyright 1997 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.
This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2002.
Comments and Questions
globals [ box-edge1 box-edge2 leftbox-edge rightbox floor1 floor2 entropy1 ; entropy2 ; temperature R yboltz enthalpy1 ; enthalpy2 ; scale Eafloor initialstate ; particles in initially in state 1 ΔG ΔG0 ΔG0e -ΔG0e ΔS ΔH Kin1 Kin2 K tracer a ] breed [ particles particle ] breed [ flashes flash ] flashes-own [birthday] particles-own [ mass energy ;; particle info last-collision state ] to setup clear-all set-default-shape particles "circle" set-default-shape flashes "plane" set R 1.9858775 / 1000 ;constante de gases en kcal/mol/K ; set entropy1 0.3 set entropy1 1 - entropy2 set enthalpy1 0 ifelse enthalpy1 <= enthalpy2 [set floor1 0 set floor2 enthalpy2 * scale] ; scale 1kcal= scale y coordenate [set floor2 0 set floor1 -1 * scale * enthalpy2] ; scale 1kcal=scale y coordinate set Eafloor max (list floor1 floor2) + Ea * scale ; set initialstate 0.1 set box-edge2 (max-pxcor) set box-edge1 min-pxcor + (entropy1 * max-pxcor * 2) set ΔH enthalpy2 - enthalpy1 set ΔS R * ln (entropy2 / entropy1) ;calculo entropía set ΔG0 ΔH - temperature * ΔS ;calculo Δ G cero teórica make-box set initialstate 1 - avance make-particles update-variables reset-ticks set a 1 end to go ask particles [ bounce ] update-variables update-plots display set a a + 1 if single = true [stop] ; if a > 1 [stop] end to update-variables set ΔG0 ΔH - temperature * ΔS ;calculo Δ G cero teórica set Kin1 count turtles with [state = 1] set Kin2 count turtles with [state = 2] set K count turtles with [state = 2] / (count turtles with [state = 1] + 0.0000000000000001) set ΔG0e (- R * temperature * ln (K + 1E-10)) set -ΔG0e -1 * ΔG0e set ΔG R * temperature * ln (K + 1E-10) + ΔG0 end to bounce ;; particle procedure ifelse state = 1 [ set yboltz floor1 - scale * ln (random-float 1) * R * temperature if yboltz >= Eafloor [set xcor min-pxcor + random (max-pxcor - min-pxcor)] ] [ set yboltz floor2 - scale * ln (random-float 1) * R * temperature if yboltz >= Eafloor [set xcor min-pxcor + random (max-pxcor - min-pxcor)] ] ifelse yboltz > max-pycor [set ycor max-pycor] [set ycor yboltz] ifelse (xcor >= min-pxcor and xcor < box-edge1) [set state 1 set color green] [set state 2 set color red] end ;;; ;;; drawing procedures to make-box ; white the part of the box that is inactive ifelse floor1 <= floor2 [ ask patches with [ (pxcor > box-edge1) and (pycor < floor2) ] [ set pcolor white ] ] [ ask patches with [ (pxcor < box-edge1) and (pycor < floor1) ] [ set pcolor white ] ] ; limite superior ask patches with [ pycor > max-pycor - 5 ] [ set pcolor blue ] ; limite inferior ask patches with [ (pycor < floor1 + 5 and pycor > floor1 ) and (pxcor <= box-edge1) ] [ set pcolor yellow ] ask patches with [ (pycor < floor2 + 5 and pycor > floor2) and (pxcor >= box-edge1) ] [ set pcolor yellow ] ; limite izquierdo ask patches with [ (pxcor < min-pxcor + 5) and (pycor >= floor1) ] [ set pcolor yellow ] ; limite derecho ask patches with [ (pxcor > max-pxcor - 5) and (pycor >= floor2) ] [ set pcolor yellow ] ; limite central ask patches with [ (pxcor < box-edge1 + 3 and pxcor > box-edge1 - 3) and (pycor <= Eafloor) ] [ set pcolor yellow ] end ;;; ;; creates initial particles to make-particles create-particles number-of-particles [ set size 6 ifelse random-float 1 < initialstate [ set xcor min-pxcor + random (box-edge1 - min-pxcor) set yboltz floor1 - scale * ln (random-float 1) * R * temperature ifelse yboltz > max-pycor [set ycor max-pycor] [set ycor yboltz] ] [ set xcor box-edge1 + random (box-edge2 - box-edge1) set yboltz floor2 - scale * ln (random-float 1) * R * temperature ifelse yboltz > max-pycor [set ycor max-pycor] [set ycor yboltz] ] ifelse (xcor >= min-pxcor and xcor < box-edge1) [set state 1 set color green] [set state 2 set color red] ;;random-position ] set K count turtles with [state = 2] / (count turtles with [state = 1] + 0.00000000000000000000001) set ΔG0e (- R * temperature * ln (K + 0.0000000000001)) set ΔG R * temperature * ln (K + 0.0000000000001) + ΔG0 end ; Copyright 1997 Uri Wilensky. ; See Info tab for full copyright and license.
There are 4 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
particles in a box Chemical Equilibrium.png | preview | Preview for 'particles in a box Chemical Equilibrium' | 3 months ago, by Luis Mayorga | Download |
This model does not have any ancestors.
This model does not have any descendants.