particles in a box Extent of Reaction
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 simulation tracks changes in:
- Extent of Reaction
- Total Chemical Potential
- Chemical Potential of reactants and products
- Free Energy of the system
HOW IT WORKS
Extent of Reaction
The model systematically evaluates all possible Extent of Reaction values, ranging from 0 (all reactants) to 1 (all products), using a step size of 0.001.
For each extent value, molecules are distributed between the two states (green and red) based on a probability equal to the extent of reaction. Given the particle counts in each state (nA and nB), the model calculates:
- Gibbs Free Energy Change
ΔG = ΔG° + RT ln(nB/nA)
- Chemical Potential of Green Particles
µA = µA° + RTln(nA)
- Chemical Potential of Red Particles
µB = µB° + RTln(nB)
- Total Chemical Potential of the System
µTotal = µA * nA + µB * nB
ADJUSTABLE PARAMETERS
- number-of-particles: Defines the total count of molecules in the system. Fewer molecules result in greater fluctuations in energy distribution due to statistical uncertainty.
- entropy2 (ΔS°): Standard entropy difference (S° reactant - S° product). The sector width represents this difference.
- enthalpy2 (ΔH°): Standard enthalpy difference (H° reactant - H° product). The sector height represents this difference.
- temperature (T): Determines the spread of energy states. Higher T allows more molecules to populate high-energy states.
THINGS TO NOTICE
- As the reaction progresses, reactant chemical potential decreases while product chemical potential increases. Equilibrium (ΔG = 0) occurs when µA and µB become equal—this corresponds to the reaction reaching its minimum free energy.
- Standard free energy (ΔG°) remains constant throughout reaction progression. It depends solely on ΔH° and ΔS° of the two compartments:
ΔG° = ΔH° − TΔS°
.
THINGS TO TRY
- Modify box shape (entropy and enthalpy variations):
Despite shape changes, chemical potentials and free energy consistently follow the same pattern. - Investigate temperature effects:
Higher T alters equilibrium, favoring states with greater entropy influence.
KEY TAKEAWAY
In chemical reactions, Extent of Reaction is a crucial state variable. It continuously adjusts the chemical potential of reactants and products. At a specific extent, the system reaches a minimum in total chemical potential, marking the equilibrium state where reaction progression naturally stabilizes.
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 [ tick-Δ ;; how much we advance the tick counter this time through max-tick-Δ ;; the largest tick-Δ is allowed to be avg-speed-init avg-energy-init ;; initial averages avg-speed avg-energy ;; current averages fast medium slow lost-particles ;; current counts percent-medium percent-slow ;; percentage of current counts percent-fast percent-lost-particles ;; percentage of current counts 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 cero cero1 initialState avance1 uA; potencial A uB; potencial B uAo; potencial A standard uBo; potencial B standard G G2 ] breed [ particles particle ] breed [ flashes flash ] flashes-own [birthday] particles-own [ speed 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 entropy2 1 - entropy1 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 ;make-particles ;update-variables reset-ticks set a 1 set cero 0 set avance1 avance set-plot-y-range 10000 10001 end to go set avance1 avance set initialState 1 - avance1 while [initialState > 0.01] [ ; if avance1 > 0.5 [stop] clear-turtles make-particles ; ask particles [ bounce ] update-variables update-plots ; display set a a + 1 set initialState initialState - 0.001 set avance1 1 - initialState if single = true [stop] ] if a > 1 [stop] end to update-variables set uAo -1 * ΔG0 set ΔG0 ΔH - temperature * ΔS ;calculo Δ G cero teórica set uBo 0 set uAo -1 * ΔG0 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 set cero 0 ; potenciales químicos set uA uAo + R * temperature * ln (Kin1 + 0.01) set uB uBo + R * temperature * ln (Kin2 + 0.01) set G (Kin1 * uA + Kin2 * uB) set G2 0 * uBo + 1 * uAo + avance1 * (uBo - uAo) + R * temperature * ( avance1 ) * ln ( avance1 + 1e-5 ) + R * temperature * (1 - avance1) * ln ( 1 - avance1) set G2 G2 * 5 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 ; set energy 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 ; set energy enthalpy2 + 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 ; set avg-energy sum [energy] of particles end ; Copyright 1997 Uri Wilensky. ; See Info tab for full copyright and license.
There are 2 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
particles in a box Extent of Reaction.png | preview | Preview for 'particles in a box Extent of Reaction' | 3 months ago, by Luis Mayorga | Download |
This model does not have any ancestors.
This model does not have any descendants.