ReactionEquilibrium:Background:Reaction Equilibrium Atom Dynamics
The simulation is initialized with the atoms in an arrangement that ensures they don't overlap, each with a randomly chosen velocity. Upon commencement of the simulation, the atoms begin to move in a free-flight trajectory (gravity is irrelevant, so don't look for them to "fall"). Each one moves until it encounters another atom. Then, if neither is already associated with a third atom, they will undergo a favorable energetic interaction, lowering the system energy. To maintain the total energy, the speed of both atoms will increase to produce a compensating increase in kinetic energy. They continue toward each other at this higher velocity until their repulsive cores hit. Then they bounce off each other like marbles, abruptly changing their trajectories. As they now separate they will at some point encounter the end of their attractive region, and most likely will dissociate from each other. They continue at a diminished velocities of total magnitude equal to the total they had before they first encountered each other.
In general, when two atoms are bound and on a trajectory away from each other, one of two things can happen when they reach the end of their attractive regions. If they have enough kinetic energy---sufficient to "climb out" of the potential wells---they will separate and move on at reduced velocities, as described above. However, if their kinetic energies don't sum to an amount greater than the binding energy, when they hit the edge of the well they will bounce back toward each other as if tied together by a string. They can oscillate back and forth this way indefinitely, bouncing between the repulsive core and the edge of the attractive region. This is not unlike the behavior of real, bound atoms. The main difference here is that all of the force they exert on each other is packed into discrete instants of time when they're at the core or well-edge separations; in real systems the forces are a bit softer and longer lasting, but not that much so (keep in mind that in both cases we are casting a system governed by quantum mechanics into a rather crude classical analog).
According to this description, two atoms that are unbound will remain unbound, because any binding encounter always leaves them with sufficient kinetic energy to subsequently separate. Likewise, bound atoms will never separate, because they will never gain enough kinetic energy to overcome the binding energy. The only way either situation can change is if another atom comes in to take away the binding energy at the instant the two atoms find each other, or through a collision provides sufficient energy for bound atoms to separate.
All of the above assumes there is no mechanism for energy transfer other than atomic collisions. This module permits the simulation to be run adiabatically---such that the system conserves its total energy---or isothermally, such that it maintains its temperature at a set value. In the latter, an artificial trick is used in the simulation to impose the temperature atom velocities are occasionally and randomly reset to a value consistent with the Boltzmann distribution of velocities at the set temperature. As a consequence, atoms that collide will be able to stick together if they happen also to incur a "Boltzmann kick" at the same time, because the thermostat may remove a bit of the kinetic energy they gain when they enter their attractive regions.
Regardless, at higher densities encounters between three atoms happen often, and atoms will associate and dissociate with reasonable frequency. All of this back-and-forth trading of partners is decided "locally", meaning that the outcome of each encounter depends only on the instantaneous properties of the atoms involved. It doesn't depend on what other atoms are doing, or on how many atoms in the system are or are not presently bound to another. Yet all of these local decisions add up to an average behavior that can be characterized by thermodynamics. The average number of free atoms and dimers can be predicted (at least approximately) using the formalism of the equilibrium constant and free energy of reaction, which in turn can be computed from the properties of the atoms and dimers viewed in isolation.