Analytic elastic coefficients in molecular calculations: Finite strain, non-affine displacements, and many-body interatomic potentials