Add code for centroid virial gradient.