New formulation of the discrete element method