Hamiltonian generator