Fixed calculation of anisotropy energy