Based on developments in the theory of variational and Hamiltonian control systems by Crouch and van der Schaft (1987), this paper answers two questions: given an input-output differential equation description of a nonlinear system, what is the adjoint variational system in input-output differential form and what are the conditions for the system to be Hamiltonian, i.e., such that the variational and the adjoint variational systems coincide? This resulting set of conditions is then used to generalize classical conditions such as the well-known Helmholtz conditions for the inverse problem in classical mechanics