In molecular mechanics, the energy is often written as a sum of bonds, angles and torsion energies, and an electrostatic term, e.g.
$V = \sum_{bonds} K_r (r-r_{eq})^2 +\sum_{angles}K_{\theta}(\theta -\theta_0)^2 +\sum_{dihedrals}V_n/2 [1+cos(n\phi -\gamma)] + \sum_{i<j}[\frac{A_{ij}}{R_{ij}^{12}} + \frac{B_{ij}}{R_{ij}^{6}} + \frac{q_1 q_2}{\epsilon R_{ij}}]$
While this is pretty easy to evaluate, the nuclear energy derivatives (gradient) are more complex because they need to be written in the Cartesian coordinate system.
This reference:
First and second derivative matrix elements for the stretching, bending, and torsional energy, Kenneth J. Miller, Robert J. Hinde, and Janet Anderson, Journal of Computational Chemistry, vol 10, 63-76, 1989, https://www.onlinelibrary.wiley.com/doi/abs/10.1002/jcc.540100107
Outlines the mathematics for calculating the nuclear energy derivatives for the bonds, angles and torsions but it's rather complicated.
For example, I don't understand Table V.
Are there any open-source codes which implement this at a high-level?
I'd like to use this code to supplement the text and for educational purposes so the easier the code the better