Vectorized the energy calculation.
add speed tests to compute the energy
symbolic to fortran energy grad and hessian. grad done, lack tests