Given an 3x3 distance matrix in cartesian coordinates for 3 atoms, I wish to take the gradient wrt \\nabla
for i=1:natom %natom = 3 for j=i+1:natom D(