NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo Models Library:
Sample Models/Chemistry & Physics/Chemical Reactions

(back to the library)

Chemical Equilibrium

[screen shot]



This model shows how a simple chemical system comes to different equilibrium states depending on the concentrations of the initial reactants. Equilibrium is the term we use to describe a system in which there are no macroscopic changes. This means that the system "looks" like nothing is happening. In fact, in all chemical systems atomic-level processes continue but in a balance that yields no changes at the macroscopic level.

This model simulates two simple reactions of four molecules. The reactions can be written:

text A + B =======&gt; C + D


text C + D =======&gt; A + B

This can also be written as a single, reversible reaction:

text A + B &lt;=======&gt; C + D

A classic real-life example of such a reaction occurs when carbon monoxide reacts with nitrogen dioxide to produce carbon dioxide and nitrogen monoxide (or, nitric oxide). The reverse reaction (where carbon dioxide and nitrogen monoxide react to form carbon monoxide and nitrogen dioxide) is also possible. While all substances in the reaction are gases, we could actually watch such a system reach equilibrium as nitrogen dioxide (NO<sub>2</sub>) is a visible reddish colored gas. When nitrogen dioxide (NO<sub>2</sub>) combines with carbon monoxide (CO), the resulting products -- nitrogen monoxide (NO) and carbon dioxide (CO<sub>2</sub>) -- are colorless, causing the system to lose some of its reddish color. Ultimately the system comes to a state of equilibrium with some of the "reactants" and some of the "products" present.

While how much of each "reactant" and "product" a system ends up with depends on a number of factors (including, for example, how much energy is released when substances react or the temperature of the system), this model focuses on the concentrations of the reactants.


In the model, blue and yellow molecules can react with one another as can green and pink molecules. At each tick, each molecule move randomly throughout the world encountering other molecules. If it meets a molecule with which it can react (for example a yellow molecule meeting a blue, or a pink meeting a green, a reaction occurs. Because blue and yellow molecules react to produce green and pink molecules, and green and pink molecules react to produce blue and yellow molecules, eventually a state of equilibrium is reached.

To keep molecules from immediately reacting twice in a row, each molecule has a "ready-timer." After a reaction, this timer is set to 2, and over two ticks, the timer is decremented back to zero, allowing the molecule to react again.


The YELLOW-MOLECULES and BLUE-MOLECULES sliders determine the starting number of yellow and blue molecules respectively. Once these sliders are set, pushing the SETUP button creates these molecules and distributes them throughout the world.

The GO button sets the simulation in motion. Molecules move randomly and react with each other, changing color to represent rearrangement of atoms into different molecular structures. The system soon comes into equilibrium.

Four monitors show how many of each kind of molecule are present in the system. The plot MOLECULE AMOUNTS shows the number of each kind of molecule present over time.


You may notice that the number of product molecules is limited by the smallest amount of initial reactant molecules. Notice that there is always the same number of product molecules since they are formed in a one-to-one correspondence with each other.


How do different amounts of the two reactants affect the final equilibrium? Are absolute amounts important, is it the difference between the amounts, or is it a ratio of the two reactants that matters?

Try setting the YELLOW-MOLECULES slider to 400 and the BLUE-MOLECULES slider to 20, 40, 100, 200, and 400 in five successive simulations. What sort of equilibrium state do you predict in each case? Are certain ratios predictable?

What happens when you start with the same number of YELLOW-MOLECULES and BLUE-MOLECULES? After running the model, what is the relationship between the count of these two types of molecules?


What if the forward and reverse reaction rates were determined by a variable instead of initial concentrations? You could compare such a simulation with the one in this model and see if concentration and reaction rates act independently of each other, as measured by the final equilibrium state.

You could also extend the program by allowing the user to introduce new molecules into the simulation while it is running. How would the addition of fifty blue molecules affect a system that was already at equilibrium?


The line if any? turtles-here with [ color = reactant-2-color ] uses a combination of the any? and turtles-here commands to check to see if there are any other turtles of a specific type occupying the same path. This is both a succinct and easily readable way to achieve this behavior.


Enzyme Kinetics Simple Kinetics 1



For the model itself:

Please cite the NetLogo software as:


Copyright 1998 Uri Wilensky.






(back to the NetLogo Models Library)