NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Sample Models/Chemistry & Physics/Chemical Reactions/Acids and Bases

(back to the library)

Strong Acid

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This model demonstrates how chemists and biologists measure the pH of a solution. The value of pH, like many other chemical measurements, emerges from the interactions and relative ratios of the composite molecules within a solution.


Specifically, pH is a measurement of the amount of hydronium ions (H+ or H3O+) that are present in a solution. Hydronium ions are generated when an acid molecule donates a proton to a water molecule. Bases have the opposite effect on water -- they take a hydrogen from a water molecule and generate hydroxide ions (OH-). These two reactions are listed below. Note the balance of charge and conversion of atoms. H-A denotes a strong acid and B denotes a strong base.

> H<sub>2</sub>O + H-A —> H<sub>3</sub>O<sup>+</sup> + A<sup>-</sup> > B + H<sub>2</sub>O —> OH<sup>-</sup> + H-B<sup>+</sup>

It is important to note that this model simulates a strong acid and a strong base interacting. Acids and bases that are classified as strong dissociate completely in water. That means that all the H-A is converted to hydronium ions and all of the B is protonated, so that concentration of the original acid is equal to the concentration of hydronium ion. pH meters are capable of detecting how many hydronium ions or hydroxide ions are present in a solution. The formula for measuring pH is listed below. One can also calculate the pOH in a similar manner. [] indicates concentration in MOLARITY.

> pH = -log [H+] > pOH = -log [OH-]

Hydronium ions and hydroxide ions are oppositely charged and react readily together. When they react, a hydrogen atom is transferred and two water molecules are generated in the process. Chemists often titrate acids and bases together to determine how stable the pH of a particular acid or base is. This experiment is done by taking a known amount of acid and adding various amounts of base to it. The titration curve is generated by plotting the pH against the volume of base added.


Decide how much acid should be present at the start of the simulation with the VOL-ACID slider and press SETUP. Turtles will be distributed randomly across the world. BLUE turtles represent water molecules and GREEN turtles represent hydronium ions. A set amount of water molecules is added each time to the solution.

Press GO. The turtles will move randomly across the world and the pH of the solution will be plotted over time and displayed in the pH monitor.

To observe the effect of adding base to the solution, set the volume of base to be added with the VOL-BASE slider and press ADD-BASE to add the red base molecules.

To perform a titration experiment, set the sliders to desired values and press GO. While the model is running, press ADD-BASE. This will add VOL-BASE to the acid in the world. Wait for the pH to stabilize as you would in a real experiment and then press RECORD-PH. A point is then plotted on the curve with each addition of base so that the user can observe how the value of pH is related to the amount of base added to the solution.


Observe the shape of the titration curve, especially where the slope approaches one. Can you explain this phenomenon?

What are the minimum and maximum values of pH in this model? Can you think of a way to alter their values?

Why are there no acid molecules in the simulation? Similarly, why aren't A and H-B shown in the model?


Plot a titration curve using various settings of VOL-BASE. How does this affect the titration curve? Is it more advisable to use large or small amounts of base? Should you use constant amounts of base?

Hit ADD-BASE a few times and observe the pH vs. time plot. Do you feel this is a useful plot for experiments? What does it tell you?

Can you alter the pH of the solution without adding base to the solution?


The code currently generates two water molecules every time a hydronium and hydroxide molecule collide. Alter the code to generate behavior for hydroxide and water collision, according to the chemical equation above. How does this change the model?

What if only one water molecule were generated and the hydroxide molecule were destroyed when the two collided? How would this affect the pH?

Add a button to add more acid to the solution at any point in time, can you use it to adjust the pH to a target value?


Notice that in the calculate-pH procedure the model makes use of the count primitive and some math to convert the number of turtles in the world into concentrations like those seen in the laboratory.


Thanks to Mike Stieff for his work on this model.


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 2001 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit 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

This model was created 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.

(back to the NetLogo Models Library)