Added gradient of hamiltonian computed with inner products