Energy is defined in general as follows for the case I think you have in mind. We can split the Lagrangian ##L(q,\dot{q})=T(q,\dot{q})-U(q,\dot{q})## into a quadratic part (kinetic) and whatever remains, as
$$L=\frac{1}{2}\sum_{ij}c_{ij}\dot{q}_i\dot{q}_j-U(q,\dot{q}).$$
##U## is the generalised...