A new set of formulae is developed for the derivatives of torsion angle energy terms and is introduced into the program CHARMM. These formulae, which are based on derivatives of the torsion angle itself, avoid the singularities introduced by use of the derivatives of the torsion angle cosine. The potential energy can include any differentiable function of the torsion angle and there is no need for a special treatment for cases where planar conformations are not extrema. The resulting code is simpler than the original version and yields correct derivatives in all practical situations. Because the minimum of the torsion energy can be at any angle, the functionality of the existing energy routines is generalized. © 1996 by John Wiley & Sons, Inc.