Diprotic Acid

Diprotic Acid preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Mike Stieff (Author)

Tags

chemical reactions 

Tagged by Reuven M. Lerner over 11 years ago

chemistry 

Tagged by Tim Denton almost 13 years ago

chemistry and physics 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 664 times • Downloaded 75 times • Run 0 times
Download the 'Diprotic Acid' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This is the fourth model of the Acid-Base subsection of the Connected Chemistry models. It is best explored after the Strong Acid, Weak Acid, and Buffer models. In this model, we have yet another variant on determining the pH of a solution. This model depicts a diprotic acid, or an acid which can donate two atoms of hydrogen to a base.

HOW IT WORKS

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 atom from a water molecule and generate hydroxide ions (OH-). The chemical reaction is shown below (for more detailed explanations about pH and acid-base reactions, please check the three aforementioned models).

              Ka1      +      -  Ka2      +    2-
H A  +  2H O  -->   H O  + H-A   -->  2H O  + A
 2        2          3                  3

We can see that the first proton is donated to water to make a hydronium ion. After the initial acid is consumed, the second proton is donated to form a second molecule of hydronium ion. It is important to note that the Ka of the first proton is much greater than the second Ka. This is because the loss of the first proton generates a negatively charged anion. It is very difficult for bases which have a negative charge or a high electron density to come in close proximity to this anion and pull off the second proton. Because of this, the first proton is most often consumed before the second proton can be donated. The pH for the reaction is determined using the Henderson-Hasselbach equation in two separate instances. While the original acid (H2A) is present, the pH is determined by:

pH = pK1 + log ([H-A-] / [H2A])

Once the weak acid is depleted, the pH is then determined by:

pH = pK2 + log ([A2-] / [H-A-])

The model uses a short-cut equation to approximate the pH of the solution. The equation, which can be used for each pK value of a polyprotic acid, transforms the above two equations into the following, respectively.

pH = 0.5 * (pK1 + log [HA]) pH = 0.5 * (pK2 + log [A])

HOW TO USE IT

Decide how much acid should be present at the start of the simulation with the STARTING-ACID slider and press SETUP. Turtles will distribute randomly across the view. BLUE turtles represent water molecules, GREEN turtles represent hydronium ions, YELLOW turtles are acid molecules, and finally MAGENTA turtles are conjugate base molecules. A set amount of water molecules is added each time to the solution. In this model we are using the Ka of acetic acid, which means that approximately 1% of the original acid turtles are dissociated into one conjugate base molecule and one hydronium molecule.

Press GO. The turtles will move randomly across the view and the pH of the solution will be plotted over time on the pH Curve and displayed in the pH monitor. Also, you will see the counts of all the molecules present in the solution in the Molecule Counts plot

Observe the effect of adding base to the solution by setting the volume of base with the BASE-ADDED slider and pressing ADD BASE.

When the pH remains at a steady value, press RECORD-PH, which will plot the pH versus the amount of bases added on the titration curve.

THINGS TO NOTICE

Run a titration and observe the curve. Is there anything unique about its shape?

Look for light blue (cyan) anions in the solution. How much base does it take before you start seeing them? Is this surprising?

Pay attention to how the molecules interact. Which molecules react with each other?

THINGS TO TRY

Compare the titration curve of the diprotic acid with that of a buffer. Do you see any similarities? How can you alter the code to test if this diprotic acid acts as a buffer?

Increase the dissociation percentage so that more hydronium ions are generated at setup. What does this do to the pH? Is the Henderson-Hasselbach equation still valid with a large Ka?

Notice that the code requires hydroxide molecules to first react with hydronium molecules on a patch before they react with acid molecules. Can you explain why this is? Reverse the code and observe the effect on the system.

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

EXTENDING THE MODEL

Alter the code so that base turtles only react with hydronium molecules. What effect is observed? What additional changes do you need to make so that the pH continues to rise with the addition of base?

Substitute the short-cut equation for calculating pH with the full equation. Are the values similar?

Try substituting the various pKa values below into the Henderson-Hasselbach equation and observe their effect on the titration curve. What affect does this have on the pH?

weak acidpK1pK2
carbonic6.510.2
oxalic1.274.27
glycine2.349.60
maleic2.006.20

RELATED MODELS

Strong Acid Weak Acid Buffer

NETLOGO FEATURES

Notice that in the calculate-pH procedure the model makes use of the count primitive to convert the number of turtles in the world into concentrations that are often used in the chemistry laboratory.

CREDITS AND REFERENCES

Thanks to Mike Stieff for his work on this model.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Stieff, M. and Wilensky, U. (2005). NetLogo Diprotic Acid model. http://ccl.northwestern.edu/netlogo/models/DiproticAcid. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2005 Uri Wilensky.

CC BY-NC-SA 3.0

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.

Comments and Questions

Click to Run Model

breed [acids acid]           ;; acid molecules (yellow)
breed [hydroxides hydroxide] ;; base molecules (red)
breed [hydroniums hydronium]  ;; hydronium ions (green)
breed [waters water]         ;; water molecules (blue)
breed [con-bases con-base]   ;;first conjugate base molecules (magenta)
breed [con-base2s con-base2] ;;second conjugate base molecules (cyan)

globals
  [
   pH pOH                                         ;;variables for calculating pH
   mmolH mmolOH mmolA mmolA2 mmolHA               ;;variables for calculating amount of molecules
   Hconc OHconc Aconc HAconc A2conc volume        ;;variables for calculating concentrations
  ]

turtles-own [partner]                                  ;;variable to control reactions

to setup
  clear-all
  set-default-shape waters "water"
  set-default-shape hydroniums "hydronium"
  set-default-shape hydroxides "hydroxide"
  set-default-shape acids "acid"
  set-default-shape con-bases "conbase"
  set-default-shape con-base2s "conbase2"
  ;;creates variable amount of acid
  create-acids starting-acid
  ;;initializes the amount of dissociated acid
  ask acids
    [
     if ((random 100) > (99 - Ka1))
      [
       hatch-hydroniums 1 [fd 3]
       set breed con-bases
      ]
    ]
  ;;initializes the amount of dissociated conjugate base
  ask con-bases
    [
     if ((random 100) > (99 - Ka2))
      [
       hatch-hydroniums 1 [fd 3]
       set breed con-base2s
      ]
    ]
  if see-starting-water?
    [ create-waters (100 - (count hydroniums)) ]
  calculate-ions    ;;used to calculate pH
  set-colors    ;;assigns colors
  set mmolOH 0
  ;; calculates overall number of molecules (total volume)
  set volume count turtles
  ;;randomizes position and headings
  ask turtles [setxy random-xcor random-ycor]
  reset-ticks
  plot-molecules
  plot-ph
end 

to go ;;main turtle procedure
  collide
  set-colors
  ask turtles [fd 1]
  calculate-ions
  tick
  if (ticks > 30) [plot-pH plot-molecules]
end 

to collide ;;turtle procedure - tells molecules how to find other molecules
  ;; hydroxide molecules will react with all proton donor molecules in the model
  if (count hydroxides > 0)
    [
     ask hydroxides
       [
        if any? hydroniums-here [set partner one-of hydroniums-here react-bases]
        if any? acids-here [set partner one-of acids-here react-bases]
        if any? con-bases-here [set partner one-of con-bases-here react-bases]
       ]
    ]

  ;; acid molecules always have a chance to dissociate to hydroniums depending on their
  if (count acids > 0)
    [
     ask acids
       [
        if ((random 100) > (99 - Ka1))
          [if any? waters-here [set partner one-of waters-here react-acids]]
       ]
    ]

  ;; conjugate base molecules always have a chance to dissociate to hydroniums depending on their Ka
  if count con-bases > 0
    [
      ask con-bases
        [
         if ((random 100) > (99 - Ka2))
           [if any? waters-here [set partner one-of waters-here react-bases]]
        ]
    ]

  ;; hydroniums molecules always have a chance to recombine with conjugate base to form acid
  if count hydroniums > 0
    [
     ask hydroniums
          [
           if ((random 100) > Ka1)
             [if any? con-bases-here [set partner one-of con-bases-here react-acids]]
          ]
    ]

  ;; hydroniums molecules can also recombine with the second conjugate base to form conjugate base
  if count hydroniums > 0
    [
     ask hydroniums
            [
             if ((random 100) > Ka2)
               [if any? con-base2s-here [ set partner one-of con-base2s-here react-acids ]]
            ]
    ]
end 

to set-colors ;;turtle procedure to assign graphics
  ask waters [set color blue]
  ask hydroniums [set color green]
  ask acids [set color yellow]
  ask con-bases [set color magenta]
  ask con-base2s [set color cyan]
  ask hydroxides [set color red]
end 

to react-bases ;;turtle procedure that tells base molecules how to react

;; all hydroxide molecules will instantly react with hydroniums molecules
  if [breed] of partner = hydroniums
    [set breed waters
     ask partner [ set breed waters ]]

;; hydroxide molecules have a high probability of reacting with acid molecules
  if [breed] of partner = acids
    [if ((random 100) > (99 - Ka1)) [set breed waters
                                     ask partner [set breed con-bases]]]

;; hydroxide molecules have a low probablity of reacting with conjugate base
  if [breed] of partner = con-bases
    [if ((random 100) > (99 - Ka2)) [set breed waters
                                     ask partner [set breed con-base2s]]]

;; conjugate base molecules react with water to form hydroniums and con-base2
  if [breed] of partner = waters
    [set breed con-base2s
     ask partner [set breed hydroniums]]
end 

to react-acids ;;turtle procedure that tells acid turtles how to react

;;acid molecules react with water to form hydroniums and con-base
if [breed] of partner = waters
  [set breed con-bases
   ask partner [set breed hydroniums]]

;;hydroniums molecules react with con-base to form acid and water
if [breed] of partner = con-bases
  [set breed waters
   rt random 360 fd 2
   ask partner [set breed acids]]

;;hydroniums molecules react with con-base2 to form con-base and water
if [breed] of partner = con-base2s
  [set breed waters rt random 360 fd 2
   ask partner [set breed con-bases]]
end 


;; calculates variables for determining the pH

to calculate-ions
  set mmolH count hydroniums
  set mmolOH count hydroxides
  set mmolA count con-bases
  set mmolHA count acids
  set mmolA2 count con-base2s
  set volume count turtles
  set Hconc (mmolH / volume)
  set OHconc (mmolOH / volume)
  set Aconc (mmolA / volume)
  set A2conc (mmolA2 / volume)
  set HAconc (mmolHA / volume)
  calculate-pH
end 


;; calculates the pH from the amount of the various ions in solution;
;; note that for simplicity the calculations don't take the true molar
;; concentration of water into account; instead we simply divide by
;; a factor of 1000 to bring the numbers into a reasonable range.
;; Above the endpoint, the pH is calculated as a strong acid.

to calculate-pH
  let concH 0
  let concOH 0
  set concH (count hydroniums / volume)
  set concOH (count hydroxides / volume)
  ifelse (concH = concOH)
    [ set pH 7 ]
    [ ifelse (concH > concOH)
      [ set pH (- log (concH / 1000) 10) ]
      [ set pOH (- log (concOH / 1000) 10)
        set pH 14 - pOH ] ]
end 

;; adds more base to the system

to add-base
  create-hydroxides base-added
    [
     fd 1
    ]
  set-colors
end 

;; plotting procedures

to record-pH
  set-current-plot "Titration Curve"
  set-plot-pen-interval base-added
  ; before next plotting, move along x-axis by magnitude of amount added
  plot pH
end 

to plot-pH
  set-current-plot "pH Curve"
  plot pH
end 

to plot-molecules
  set-current-plot "Molecule Counts"
  set-current-plot-pen "con-base"
  plot count con-bases
  set-current-plot-pen "acid"
  plot count acids
  set-current-plot-pen "hydroxide"
  plot count hydroxides
  set-current-plot-pen "hydronium"
  plot count hydroniums
  set-current-plot-pen "water"
  plot count waters
end 


; Copyright 2005 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Diprotic Acid Download this version

Attached files

File Type Description Last updated
Diprotic Acid.png preview Preview for 'Diprotic Acid' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.