We suggest a method of derivation of the long-wave action of the model spin
Hamiltonians using the non-linear partial differential equations of motions of
the individual spins. According to the Vainberg's theorem the set of these
equations are (formal) potential if the symmetry analysis for the Frechet
derivatives of the system is true. The case of Heisenberg (anti)ferromagnets is
considered. It is shown the functional whose stationary points are described by
the equations coincides with the long-wave action and includes the non-trivial
topological term (Berry phase)