of energies: interactions between atoms (the electrostatic and Lennard-Jones terms) and bond energies (stretch, bend, and torsion). Since the number of terms in non-bonded energies typically scales as $O(N^2)$ where $N$ is the total number of atoms in the system, while the number of bond terms scales as $O(N)$, we concentrate on optimizing the evaluation of the non-bonded terms. In our case where the molecules consist of rigid fragments connected by flexible bonds we need only include the bond terms contributed by the much smaller number of inter-fragment bonds. Furthermore, we need only include the energy contributed by the “free” components of such bonds. Thus, if the lengths and angles of such bonds are constrained, then we need only include the torsion energy in $E_\mathrm s(\Gamma)$.

We start by assuming that the non-bonded energy terms can be expressed as a sum over atom pairs. This applies to the electrostatic and Lennard-Jones terms in Amber [@cornell95]. However, implicit solvent models have a more complex structure and we consider these in the next section.

Suppose our molecular system consists of $N$ atoms. These atoms are grouped into $M$ molecules and we denote $M_l$ as the set of atoms making up the $l$th 