Sunday, January 20, 2008

SoftwareChemistry

Last time we explored the development of quantum mechanics in the early part of the 20th century and saw how it led to the concept that the wavelike characteristics of particles could be expressed in terms of a complex wavefunction ψ(x) consisting of real and imaginary parts. We saw that, at first, physicists had a hard time figuring out what these complex wavefunctions really meant. Then in 1928, Max Born came up with the idea that the wavefunction solutions to Schrödinger’s equation could be thought of as probability waves, and that the probability of finding a particle at some point along the x-axis could be obtained by multiplying the particle’s wavefunction by its complex conjugate ψ(x)*ψ(x) at each point along the x-axis. This was a key insight. In classical mechanics, we also use equations to figure things out, but in all cases, we try to manipulate the equations to solve for the desired quantity that we are interested in. We always try to end up with an equation that looks like:

E  =   ½mv²

which is the classical equation for the kinetic energy of a particle. Then all we have to do is the old “plug ‘n chug” to get the kinetic energy E by plugging in the mass m and velocity v of the particle into the above formula. But in Born’s interpretation of the wavefunction, we did not do that to obtain the position of a particle. Instead, we performed a mathematical operation on the wavefunction ψ(x) itself by multiplying it by its complex conjugate ψ(x)*ψ(x), and we did not get an exact answer either, just an exact probability. Some additional mathematical thought shows that the wavefunction is the whole deal, meaning that everything that can be known about a particle, such as its position, energy, momentum, and angular momentum, is encapsulated within the wavefunction itself, and to obtain values for these quantities you have to perform strange mathematical operations upon the wavefunction. For example, going back to the time-independent Schrödinger equation for a particle moving along the x-axis:

-ħ²  d²ψ(x)   +   V(x) ψ(x)  =  E ψ(x)
──  ──────
2m     dx²

We see that if we define a mathematical operation H as:

H  =  -ħ²  d²       +   V(x)
          ──   ───
          2m   dx²

then we can rewrite the Schrödinger equation simply as:

H ψ(x) = E ψ(x)

The wavefunctions ψ(x) that satisfy the above equation are called eigenfunctions and the corresponding measured values of E are called eigenvalues. “Eigen” roughly means “characteristic” in German (you may have noticed that nearly all of the early 20th-century physicists I have mentioned in this blog were Germans, and that is where this terminology came from). So for the solutions to Schrödinger’s equation for a particle in a box, the eigenfunctions are:
                 ____
ψn(x) = √ 2/L    sin(nπx/L)

n = 1, 2, 3, ...

and the eigenvalues are:

En = n²h²
        ─────
         8mL²

n = 1, 2, 3, ...

where:
m = mass of the particle (electron in this case)
L = width of the box
h = Planck’s constant
n = quantum number

In general, the way you solve problems in quantum mechanics is to first solve Schrödinger’s equation for the problem at hand to obtain the desired wavefunctions (eigenfunctions). Then you apply mathematical operators to the eigenfunctions to obtain eigenvalues, which are the quantized answers you are seeking for your problem:

O ψ(x) = o ψ(x)

where O is some mathematical operator and o is a measured quantized value.

The above analysis can be applied to the hydrogen atom using Dirac’s equation, which is Schrödinger’s equation augmented by special relativity to take into account the fact that the electron orbiting the proton of a hydrogen atom is moving at a relativistic velocity. The result is a series of eigenfunction wavefunctions with associated eigenvalues, both defined by quantum numbers n, l, m, and s. The quantum number n defines the energy levels of the electron in the hydrogen atom and the l and m quantum numbers define the angular momentum of the electron as it orbits around the proton in the nucleus. The quantum number s is the strange quantum number that defines the inherent angular momentum of the electron itself, even though the electron is currently depicted as a fundamental particle with a dimension of zero and should not have any intrinsic angular momentum from a classical perspective. The result is that the electron in a hydrogen atom can exist as a series of electron wavefunctions (eigenfunctions) which are 3-dimensional “probability clouds” about the central proton of the hydrogen atom.

Like the particle in a box, which only had one quantum number - n, the quantum numbers for the hydrogen atom n, l, m, and s are just eigenvalues for the eigenfunction solutions to the Dirac or Schrödinger equation. For example, Figure 2 of Quantum Software shows the eigenfunction solutions for Schrödinger’s equation for the particle in a box for the eigenvalues n = 1, 2, and 3. These quantum numbers are hard to grasp mentally because our common sense is based upon our experiences with relatively large objects, so we do not have any quantum mechanical intuition. A helpful, but somewhat misleading, model is to relate the quantum numbers of the hydrogen atom to a classical system like the Earth orbiting the Sun. Such a model has its limitations, but I would bet that most physicists secretly harbor it deep down in their subconscious minds. The chief difference is that for the classical Earth-Sun system, the items below can take on continuous values, while their quantum counterparts can only take on fixed quantized values.

n - The approximate distance of the electron from the proton nucleus of hydrogen, like the distance of the Earth from the Sun. Now all the electron wavefunctions of the hydrogen atom are actually spread out over the entire Universe, so no matter where your hydrogen atom might be, there is a small chance that its electron is in Peoria. However, the most likely location of the electron will be close in near the proton nucleus of its hydrogen atom. The larger n is, the further out will be the electron’s maximum probability of existence.

l – The total amount of angular momentum of the electron, like the angular momentum of the Earth orbiting the Sun.

m – The direction in which the angular momentum vector points, like an arrow perpendicular to the orbital plane of the Earth’s orbit about the Sun

s – The inherent spin angular momentum of the electron, like the Earth spinning on its axis.

To make matters more confusing, chemists use the term “orbital” for these eigenfunctions or wavefunctions, probably because they too need to relate the quantum electron-proton system of hydrogen to a classical Earth-Sun system, in order to try to make sense of it all. The terms orbital, eigenfunction, or wavefunction all mean the same thing, they are just 3-dimensional probability clouds, so for the sake of clarity going forward, I will simply refer to these eigenfunctions as wavefunctions or orbitals.

The rules for the quantum numbers fall out of the solutions to Schrödinger’s equation for the hydrogen atom and go like this, for any given energy level n, there can be one or more wavefunctions or orbitals based upon the following rules:

For any n:
l = n – 1
m = the range of integers from –l to +l, like -2, -1, 0, +1, +2
s = ± ½

The first energy level has only one wavefunction or orbital:

n = 1
l = 0 because n – 1 = 0
m = 0 because the range of -l to +l = -0 to +0 = 0
s = ± ½

Chemists call this wavefunction the 1s orbital, which can hold 2 electrons, one with spin-up ↑ and one with spin-down ↓, and is denoted as 1s2. Notice that because l = 0, the 1s orbital has no quantized angular momentum, which is rather strange. You would think that electrons orbiting a proton should have some angular momentum, they certainly would according to Newtonian mechanics, but the 1s2 electrons do not have any.

The second energy level has 4 wavefunctions or orbitals:

1.    n = 2,   l = 0,   m = 0,   s= ± ½

Chemists call this the 2s orbital, which again, can hold 2 electrons, one with spin-up ↑ and one with spin-down ↓, denoted by 2s2. Again, because l = 0 the 2s orbital has no quantized angular momentum. The other 3 orbitals do have some quantized angular momentum because l = 1:

2.    n = 2,   l = 1,   m = -1,   s= ± ½
3.    n = 2,   l = 1,   m = 0,   s= ± ½
4.    n = 2,   l = 1,   m = +1,   s= ± ½

Chemists call these three orbitals the 2p orbitals, each of which can also hold 2 electrons, one with spin-up ↑ and one with spin-down ↓. The 2p orbitals are denoted by 2px, 2py,2pz, corresponding to m = -1, m = 0, and m = +1.

Figure 1 – The n=1 and n=2 Orbitals (Eigenfunctions or Wavefunctions) for the hydrogen atom (click to enlarge)

Notice that the 1s and 2s orbitals, with no quantized angular momentum because l = 0 for them, have spherically-shaped orbitals or wavefunctions. Again, these orbitals or wavefunctions are just probability clouds as depicted in the speckle plots of Figure 1. The 2p orbitals do have some quantized angular momentum because l = 1 for these orbitals. As we shall see, this is a key point, the 2p orbitals, and all orbitals with non-zero quantized angular momentum (meaning l > 0), have a 3-dimensional shape with preferred directions for electron existence, rather than being spherically-shaped orbitals like the 1s and 2s orbitals, with no preferred direction for electron existence. The 2p orbitals, on the other hand, each consist of two lobes that bulge in the x, y, and z directions, all oriented 900 to each other. So as you can see from the speckle plots of the 2p orbitals in Figure 1, the electrons of the 2p orbital have preferred zones of existence pointing in different directions, whereas the 1s and 2s orbitals do not. This is key to the formation of molecules with a 3-dimensional shape, like the organic molecules in living things. In fact, if it were not for the quantized angular momentum of electrons, carbon-based organic molecules would not have complex 3-dimensional shapes, and you would not be here contemplating the marvels of the quantum mechanics of electrons!

This is all very impressive, but as you can see, the math gets pretty heavy even for the simple hydrogen atom, which consists of a single electron orbiting a nucleus consisting of a single proton. The problem is that the next atom in the periodic table, helium, presents even greater mathematical challenges. In fact, nobody has ever exactly solved the Schrödinger equation for the helium atom, much less Dirac’s equation, because helium has a nucleus composed of two protons and two neutrons, and consequently, has two electrons orbiting its nucleus. The problem is that the two electrons interact with each other, and this complication requires that some approximations be made in order to solve Schrödinger’s equation for helium and the other 92 naturally occurring elements in the periodic table. Physicists call these approximations chemistry.

Yes, from the perspective of physics, the entire science of chemistry is just an approximate extension of the effective theory of quantum mechanics. This might sound a bit arrogant, especially since, like an old married couple, the chemists had to nag the physicists for more than 100 years before the physicists finally came up with the brilliant insight that atoms really did exist after all. In retaliation, chemists call quantum mechanics P-chem (physical chemistry). Most medical doctors do not start out in pre-med programs as physics majors, but many doctors do have a pre-med major in chemistry or biology. So if you are ever aggravated by one of your caregivers, just tell them that lately, your P-chem has been bothering you. There is a good chance that you will trigger a devastating Post-Traumatic Stress Disorder flashback.

To extend quantum mechanics to chemistry, we are faced with the daunting challenge of trying to find the wavefunctions for the electrons orbiting a molecule instead of orbiting the single nucleus of a single atom. Recall that a molecule is simply a combination of two or more atoms that are chemically bound together. In a molecule, we end up with multiple electrons orbiting multiple atomic nuclei containing protons and neutrons, all interacting with each other via the electromagnetic force between the electrons and protons. The wavefunctions of electrons orbiting the molecular nuclei are known as molecular orbitals, just as the wavefuntions of the electrons orbiting the nucleus of a single atom are called atomic orbitals. The concept of molecular orbitals was first introduced by Friedrich Hund and Robert S. Mulliken in 1927 and 1928, very shortly after the development of quantum mechanics by Heisenberg and Schrödinger in 1926. The first simple approximation for the solution of molecular orbitals was introduced in 1929 by Sir John Lennard-Jones as a linear combination of the atomic orbitals of the individual constituent atoms of the molecule. What Lennard-Jones did was to mix the wavefunctions of the individual atoms together to come up with the combined molecular orbitals of the electrons in molecules, like mixing together yellow paint with blue paint to come up with green paint. Figure 2 depicts the resulting molecular orbitals surrounding the atomic nuclei of a molecule. This figure is a little misleading, in that if the wavefunctions of the electron probability clouds surrounding a single atom were blown up to the size of a football stadium, the protons and neutrons of the atomic nucleus would be about the size of shelled peanuts on the 50-yard line.

Figure 2 - Molecular orbitals surrounding atomic nuclei (click to enlarge)

The electrons in a molecule are subject to two additional constraints. First of all, they cannot violate the Pauli exclusion principle that each electron has to have a unique combination of quantum numbers. Secondly, the electrons will arrange themselves in molecular orbitals to minimize their free energy in accordance with the second law of thermodynamics. Thus, the second law causes the electrons to fill the molecular orbitals with the lowest energy levels first, and the Pauli exclusion principle prevents the electrons from all occupying the same orbital with the lowest energy level. The result is that the electrons pile up into a hierarchy of molecular orbitals, just as they do in the atomic orbitals of an atom.

We have already seen that the second law of thermodynamics can be expressed in many ways, and here is another. Recall that the second law states that the total amount of entropy (disorder) in the Universe must always increase whenever a change is made. Entropy is a measure of the depreciation of the Universe. Another expression of the second law is that systems naturally tend to minimize their free energy, the energy available to do work. Here is an old bar trick that illustrates this effect. Take out a book of paper matches and rip out one of the matches. Now offer to buy the next round of beers if anybody in your party can drop the match from a height of one foot onto the bar and have the match land on an edge. After several failed attempts, make the following counter-offer. Turn to one of your companions and offer to buy the next round of beers if you cannot successfully drop the match from a height of one foot onto the bar and have it land on an edge. However, if you do succeed, then your companion must buy the next round. Now take the match and simply fold it into a “V” shape. When you drop the match, it will naturally land on an edge. What is happening here is that the match is seeking a state of maximum entropy and minimum free energy. For the folded match, the state of minimum free energy is when the match is on an edge, while for the unfolded match, the state of minimum free energy is when the match is lying flat. Note that a flat match will not stand on its edge because, by falling over, it can release potential energy into kinetic energy. On the other hand, the folded match lying on its edge cannot fall over to a lower state of free energy.

As they taught you in high school, atoms like to combine into molecules by sharing electrons in covalent bonds. This is accomplished through shared molecular orbitals between atoms. The first atomic orbital of atoms 1s2 can hold 2 electrons, the next atomic orbital can hold 8 electrons, 2 in the 2s2 orbital and 6 in the 2px2, 2py2, and 2pz2 orbitals, and so forth down through the rest of the periodic table. So for hydrogen H, we can have two hydrogen atoms combine into a molecule of diatomic hydrogen by having each atom of hydrogen share its single electron with the other hydrogen atom to form H2 displayed as:

H─H

What happens from a molecular orbital point of view is that the 1s atomic orbitals of each hydrogen atom combine to form a sigma σ molecular bond which has a lower energy than the two 1s atomic orbitals combined together, so this σ bond holds the two hydrogen atoms together as a diatomic hydrogen molecule. There is also a σ* molecular orbital at a higher energy level than the 1s atomic orbitals. The σ molecular bond has lower energy because the two electrons of the hydrogen molecule have a high probability of being located between the two positively charged protons of the hydrogen nuclei to which they are attracted. On the other hand, for the σ* molecular orbital, the two hydrogen electrons spend most of their time further away from the two positively charged protons of the hydrogen molecule, which takes more potential energy and puts the σ* molecular orbital at a higher energy level than the σ bond.

Figure 3 – The Molecular Orbitals of a Diatomic Hydrogen Molecule (click to enlarge)

For the remainder of this post, let’s focus on carbon C, because the carbon atom is the basis for nearly all the molecules used by living things, and, in fact, the chemists have honored carbon with its own branch of chemistry called organic chemistry, because organic chemistry so dominates the field due to its biological and commercial significance. Carbon has a nucleus containing six protons and usually six neutrons and thus has 6 electrons. The first two electrons fit into the first atomic orbital of carbon 1s2, leaving four electrons left over for molecular bonding. These four electrons are called valence electrons. Remember, carbon will try to share four additional electrons with its four valence electrons to reach the magic number of 8 electrons to completely fill its 2p orbital.

Figure 4 – Carbon Tries To Share 4 Additional Electrons To Complete Its 2p Shell (click to enlarge)

This makes carbon very unique in that it can form very complex organic molecules since each carbon atom can bind to up to four additional atoms. For example, methane can be depicted as:

     H
      |
H─C─H
      |
     H

Carbon can also form very long molecules by chaining together many carbon atoms along a carbon backbone:

      H  H  H  H  H  H  H  H
      |    |   |   |    |    |   |   |
H─C─C─C─C─C─C─C─C─OH
      |    |   |   |    |    |   |   |
      H  H  H  H  H  H  H  H

Similarly, nitrogen N has a nucleus composed of seven protons and seven neutrons and consequently has seven electrons. Again, two electrons fit into its lowest atomic orbital leaving five left over for bonding. Thus nitrogen would like to share three additional electrons to get to the magic number of 8 for its second orbital. Oxygen O has a nucleus of 8 protons and 8 neutrons with 8 surrounding electrons. After two electrons fill its lowest atomic orbital, there are six electrons left over, leaving oxygen looking for two additional electrons.

When we combine carbon, hydrogen, oxygen, and nitrogen together we can form complex organic molecules like the amino acid serine:

      H  H  O
      |    |   ||
H─N─C─C─OH
           |
          OH

Notice that in serine, carbon has managed to share two electrons with one of the oxygen atoms in a double bond. Serine has a carbon backbone of only two carbon atoms, but as you can imagine, it is possible to form very complicated and very large organic molecules by hanging all sorts of side group atoms off a very long carbon chain backbone.

This is all accomplished through Lennard-Jones’ concept of hybridized molecular orbitals. For example, carbon’s four valence electrons can occupy four sp3 hybridized molecular orbitals formed by mixing together the s and px, py, and pz atomic orbitals of carbon. This yields a tetrahedral-shaped set of sp3 hybridized molecular orbitals for carbon, and this is the most common molecular orbital configuration for carbon.

Figure 5 – The sp3 Hybridized Orbitals Are a Combination of s and p Atomic Orbitals (click to enlarge)

Methane is formed by pairing up the single electron in the 1s atomic orbital of four hydrogen H atoms with the four sp3 orbitals of carbon C, forming σ bonds between the carbon C and hydrogen H atoms.

Figure 6 – Methane Forms a Tetrahedral Shape Because of sp3 Hybridized Carbon Orbitals (click to enlarge)

One of the misconceptions that can easily arise when you study chemistry is that when you look at all the chemical formulas and molecular models in your coursework, your eye is naturally drawn to the symbols for the atomic elements such as C, H, N, and O. This naturally makes you think of atomic nuclei, composed of protons and neutrons, binding together via their valence electrons to form molecules. As we have seen above, this is a bit of a distortion. Chemistry is really all about electrons in molecular orbitals. The atomic nuclei of atoms are really just dead weight, providing positive charge via their protons, but not really performing anything chemically significant beyond that. So when you look at a chemical formula or model for a molecule, you should really think of it as a collection of electron wavefunctions surrounding some highly concentrated positive charge in the nuclei of the atoms. The electrons really do all the work in chemistry, creating the microscopic chemical behaviors of substances, such as their chemical reactivity, acidity, and ability to oxidize other substances, and also the macroscopic characteristics of substances such as their melting and vaporization temperatures, specific heat, color, rigidity, ductility, and tensile strength. Most of everyday life is just electrons doing their thing in different quantum states; with the protons and neutrons of atomic nuclei just along for the ride.

Carbon can also form a hybridized orbital called sp2, which takes on a triangular shape and also an sp hybridized orbital which has a linear shape. The sp2 and sp orbitals lead to another kind of molecular bond called a π bond via a π molecular orbital. In Figure 7, we see the molecular bonding for ethane, ethene, and ethyne, which highlights this kind of π bonding. In ethane, each carbon atom forms σ bonds with three hydrogen atoms and also with the other carbon atom in ethane, using its four valence electrons in sp3 orbitals, as we have already seen with methane. In ethene, there are only two hydrogen atoms for each carbon atom to bind with, so there is a double bond between the carbon atoms denoted as:

C=C

What happens is that each of the carbon atoms has three of their four valence electrons in sp2 hybridized orbitals bound to the 1s orbitals of the two hydrogen atoms and also with the other carbon atom, forming σ bonds with all. The last valence electron of each carbon remains in a lobe-shaped atomic p orbital of each carbon atom. These two p orbital electrons form a π bond between the carbon atoms via a π molecular orbital, which is much weaker than the σ bonds between the carbon atoms. Chemists say that the electrons in the π bond are “delocalized”, meaning they are kind of floating above and below the plane of the carbon atoms. This is just the chemists’ way of expressing the quantum weirdness of electrons not knowing exactly where they are.

Ethyne is even stranger. Each carbon has two valence electrons in linearly shaped sp hybridized orbitals. One valence electron is bound to a hydrogen atom and the other valence electron is bound to the other carbon atom via σ bonds. The remaining two valence electrons of each carbon are in p orbitals of the carbon atoms and form two π bonds between the carbons. Thus there are three bonds between the carbon atoms, one σ bond, and two π bonds. Chemists denote a triple bond as:

C≡C

Figure 7 – Ethene and Ethyne Form σ and π Bonds (click to enlarge)

The key point is that it is the quantized angular momentum of electrons that is the chief element of chemistry. Because the electron wavefunctions or orbitals of carbon with quantized angular momentum have complex 3-dimensional shapes, organic molecules also have complex 3-dimensional shapes. And because carbon can combine with so many different atoms and has four valence electrons, organic molecules can become huge affairs with very complicated 3-dimensional shapes. When we study softwarebiology, we will see that large complex organic molecules with very complicated 3-dimensional structures are key to living things. These large organic molecules have very complicated molecular orbitals with strange shapes that can fit together like a lock and key to perform biological functions.

The fitting together of organic molecules is accomplished via the electromagnetic force. Remember that plots of molecular orbitals are just the probability clouds or wavefunctions of the molecular electrons. When you plot the electron probability cloud for a molecule, frequently you will find that the electrons have a higher probability of being found near one part of the molecule compared to the other parts. This part of the molecule will then have a net negative charge, while the other portions will have a net positive charge. Such molecules are called polar molecules, and the positive portion of a polar molecule will be attracted to the negative portion of other polar molecules. In Figure 8, we see polar water molecules attracting each other. The molecular electrons of a water molecule have a higher probability of being near the oxygen atom, compared to the two hydrogen atoms of the molecule, so water molecules have a net negative charge near the oxygen side of the molecule and a net positive charge near the hydrogen side of the molecule. The negative oxygen portions of water molecules are attracted to the positive hydrogen portion of water molecules, forming what are known as hydrogen bonds. These hydrogen bonds in water form a weak lattice of water molecules even when water is in a liquid state. This highly polar nature of water is what gives water very high melting and boiling point temperatures because the water molecules like to stick together due to the electromagnetic attraction between molecules. The electrical attraction between water molecules allows water molecules to come together in a crystal lattice (ice) at a much higher temperature than a non-polar molecule of a similar weight. Similarly, the electrical stickiness of water molecules prevents them from boiling away unless they are jiggled by a lot of thermal energy. The polar nature of water and its tendency to form a lattice of water molecules bound together by hydrogen bonds is very important in biology. In SoftwareBiologywe will see that this is a necessary condition for the formation of cellular membranes.

Figure 8 – Water Molecules Are Polar and the Positive Parts Attract the Negative Parts (click to enlarge)

Notice that the bonding angle between the oxygen atom and the two hydrogen atoms is 104.45 0 and that all three do not line up in a straight line. Again this is due to the strange geometry of the molecular orbitals of water, like the sp3 molecular orbitals of methane. This geometry all goes back to the strange lobe-like probability cloud, or wavefunction, of the p orbital of electrons that have an angular momentum quantum number of l = 1. If the wavefunction for the p orbital electrons did not have this lobe-like shape, water molecules would be linear and would not be polar molecules because the negative oxygen atom would be sandwiched between to positive hydrogen atoms, and we would not be here marveling at water molecules because life in this Universe would probably be impossible.

Because organic molecules can be polar and quite large with very complicated 3-dimensional structures, they can form large intermeshing affairs, that fit together like a lock and key. Because the shapes of the organic molecules have to be just so and the charge patterns just right for organic molecules to fit together like a lock and key, they offer a bit of specificity – only certain organic molecules can fit into a locking position with another. In SoftwareBiology, we will see this is a key requirement for living things.

Figure 9 – Only Organic Molecules of the Correct Shape Can Fit Together in a Locking Position (click to enlarge)

So here is the strange thing. If electrons did not have quantized angular momentum, all atomic orbitals would be spherically-shaped like the 1s and 2s orbitals in Figure 1, and the most complicated molecule you could make would be a very long linear molecule with σ bonds between atoms, like the diatomic hydrogen molecule of Figure 3. Clearly, living things could not exist in such a universe. Living things need large complex 3-dimensional molecules in order to exist. This is an example of the weak Anthropic Principle in action, which will be covered in a future posting on SoftwareBiology.

I have been focusing on molecules composed of carbon, hydrogen, oxygen, and nitrogen atoms because these are the atoms of life and will come in handy when we switch our focus to the biological aspects of softwarephysics. Fully 96% of your body weight is due to carbon, hydrogen, oxygen, and nitrogen atoms with the remaining 4% coming from traces of other atoms such as sulfur (S) and phosphorous (P).

High School Chemistry is Vindicated
The end result of all this quantum mechanics is to confirm all of the chemistry you learned in high school which was empirically discovered by chemists in the 19th century. Chemistry is all about electrons and the electromagnetic force between the electrons and protons. This is rather strange since the electrons in an atom represent an insignificant amount of the mass of an atom. Protons have 1836 times as much mass as electrons, and neutrons are just slightly more massive than protons, with a mass that is equal to 1.00138 times that of a proton. Thus, a 200-pound man consists of about 100 pounds of protons, 100 pounds of neutrons, but only about 0.87 ounces of electrons! Yet all of your interactions with the Universe are performed with this small mass of electrons. Everything you see, hear, smell, taste, and feel results from the interactions of less than one ounce of electrons. And all of the biochemical reactions that keep you alive, and even your thoughts at this very moment are all accomplished with this small mass of electrons! This all stems from the fact that, although electrons are very light relative to protons and neutrons, for some unknown reason, they pack a whopping amount of electrical charge. In fact, the light electrons have the same amount of electrical charge as the much heavier protons, just with the opposite sign, so it is the electromagnetic force that really counts in chemistry, not the electrons themselves. In that regard, chemistry can really be considered to be the study of the electromagnetic force, and not the study of matter, since electrons are nearly massless particles.

Softwarechemistry
Let us adopt the physicist’s perspective, in which all of chemistry can be seen as simply an extension of the effective theory of quantum mechanics. With that in mind, let us explore the corresponding implications for softwarechemistry.

Recall that the individual characters in a sample line of source code:

discountedTotalCost = (totalHours * ratePerHour) - costOfNormalOffset;

are each defined by 8 quantized bits, with each bit in one of two quantum states “1” or “0”, which can also be characterized as ↑ or ↓.

C = 01000011 = ↓ ↑ ↓ ↓ ↓ ↓ ↑ ↑
H = 01001000 = ↓ ↑ ↓ ↓ ↑ ↓ ↓ ↓
N = 01001110 = ↓ ↑ ↓ ↓ ↑ ↑ ↑ ↓
O = 01001111 = ↓ ↑ ↓ ↓ ↑ ↑ ↑ ↑

We may then think of each character in the above line of code as an atom in an organic molecule. Thus, each variable in the line of code becomes an organic molecule in a chemical reaction with the other variables or organic molecules in the line of code and ultimately produces a macroscopic software effect. The 8 quantized bits for each character are the equivalent of the spins of 8 electrons in 8 electron shells that may be either in a spin-up↑ or spin-down ↓ state. And the chemical characteristics of each character (atom) are determined by the arrangements of the spin-up ↑ or spin-down ↓ state of the bits (electrons) in the character. The characters (atoms) in each variable come together to form an organic molecule, in which the spins of all the associated characters form molecular orbitals for the variable, giving the variable its ultimate softwarechemical characteristics. As a programmer, your job is to assemble characters (atoms) into variables (molecules) that interact in lines of code to perform the desired functions of the software under development.

Living things have evolved very reliable methods to do the same thing. Just take a look at any college textbook on biochemistry. In it, you will find very complicated flow charts of biosynthetic and metabolic pathways that put to shame the multithreaded logic found in a typical java EJB. And the fact that these pathways are constantly being run in a multithreaded manner, trillions upon trillions of times, within each of the 100 trillion cells in your body, just boggles the mind. For example, Figure 10 depicts the famous Krebs cycle. In 1937, Hans Krebs proposed the Krebs cycle for organisms that have an oxygen-based metabolism. The Krebs cycle is a programming loop that controls the breakdown of proteins, fats and carbohydrates into smaller molecules. The loop results in the liberation of carbon dioxide and electrons that are used to form high-energy phosphate bonds in the form of adenosine triphosphate (ATP) - the chemical energy reservoir of cells. Krebs discovered how certain individual reactions are linked to each other in a do-loop and how energy is released by this process for use by the cell for all its activities. He proposed the steps in this loop in 1937 and was awarded the 1953 Nobel Prize in Physiology or Medicine for this work.

The Krebs cycle is like a processing loop that transforms the value of a share of IBM stock into physical cash coming out of an ATM. The share of IBM stock begins as a set of bits stored somewhere in cyberspacetime on the computers run by your online stock broker. When you sell the share of stock, the bits storing the share of stock are debited from your account and some bits over in the IBM portion of cyberspacetime are deleted too. The resulting cash value is credited to the money market bits of your online stock broker account. From there the cash value bits can be transferred to your local bank, and ultimately, you can punch in some numbers into an ATM and out pops some physical cash that can be used to buy a cup of coffee. In this example, the share of IBM stock is like an energy-rich carbohydrate molecule and the cash popping out of the ATM is like a molecule called ATP, which is the biochemical energy equivalent of cash. In a capitalistic economic system, money is the equivalent of energy in a biochemical sense, since, as everybody knows, it makes the world go round. There is an old joke in thermodynamics that energy is the ability to do work, while money is the ability not to do work.

Figure 10 – The Krebs cycle.

Your body uses the energy in ATP to build the complex organic molecules necessary to perform the functions of life. Taking simple atoms and producing complex organic molecules from them is clearly a violation of the second law of thermodynamics because we are taking disordered atoms and creating highly ordered organic molecules from them. As a programmer, you are well aware of the equivalent problem of assembling characters into lines of code that actually work. The only way around this problem is to degrade the low entropy chemical energy in carbohydrates and fats into disordered heat energy, and that is what your body does. Using the Krebs cycle, your body converts the chemical energy stored in carbohydrates and fats into chemical energy stored in ATP. The cells in your body then degrade the low entropy chemical energy stored in ATP into heat energy in order to create complex organic molecules. In this way, the second law is not violated. Your body heat is a way for your body to excrete entropy while increasing its internal information content at the same time in the form of information-rich organic molecules. The moment you die, your body begins to cool off, and you begin to disintegrate as the second law of thermodynamics runs wild.

I will close with that sobering thought in mind. Next time, as promised, we will continue on with exploring the really strange implications of quantum mechanics, in an effort to combat the objection that equating the characters in a line of code with physical atoms is a bit of a stretch. You will learn that thanks to 20th-century physics, there really isn’t much tangible stuff left in the physical Universe, so equating the bits of information in source code in the Software Universe with physical atoms in the physical Universe, is really not such a stretch after all.

Comments are welcome at scj333@sbcglobal.net

To see all posts on softwarephysics in reverse order go to:
https://softwarephysics.blogspot.com/

Regards,
Steve Johnston