to $i<j$. All such pairs contribute to the electrostatic energy while those which satisfy $r_{ij} < r_{l2}$ contribute to the Lennard-Jones energy. There obviously is scope for additional optimization here. For example, the inner atom loop can be skipped if the second residue belongs to a single fragment which matches the fragment of a particular atom in the first residue.

Because of the way in which the cutoffs are applied, the result for the energy is independent of the assignment of atoms to residues for energy terms which use a per-atom cutoff. In addition, [*differences*]{} in the non-bonded energies are independent of the assignment of atoms to fragments. The energies for assemblies of 3 or more molecules can be expressed in terms of the energies of 1 or 2 molecules. These provide useful checks on the implementation.

In some contexts it is useful also to define a “steric” energy term which is infinite if any atoms overlap (with some definition of a “hard” atom radius) and is zero otherwise. This provides a rapid check of new configurations—particularly when trying to “insert” a molecule during a grand canonical simulation [@adams75] or when switching systems using the wormhole method [@karney05a]. A conservative 