# When is a Divergence-Free Vector Field on the Tangent Bundle of a Riemannian Manifold Hamiltonian?

Starting with a closed, connected Riemannian manifold $(M^n, g)$, using the "product Euclidean metric" to form an associated Riemannian metric $\tilde{g}(p,v)((v_1,w_1),(v_2,w_2))) =$ $g(p)(v_1,v_2) + \langle w_1|w_2\rangle$ on $TM$ (which is naturally a symplectic manifold with natural symplectic form $\omega$), and using the definition of the divergence of a vector field on $TM$ from divergence of a vector field on a manifold, when is a divergence-free vector field on $TM$ Hamiltonian? That is, when is it the case that a divergence-free vector field $X$ on $TM$ admits a smooth function $H: TM \to \mathbb{R}$ with $dH(Y) = \omega(X,Y)$ for all smooth vector fields $Y$ on $TM$?

Is this only true when $TM$ with the associated product Euclidean metric is Kähler? (Note this post https://mathoverflow.net/questions/26776/k%C3%A4hler-structure-on-cotangent-bundle.)

Also, is the converse true: with the same setup, if $X$ is Hamiltonian, is it divergence-free?

Any assistance you can provide is appreciated.