A recent force-fatigue parameterized mathematical model, based on the seminal contributions of V. Hill to describe muscular activity, allows to predict the muscular force response to external electrical stimulation (FES) and it opens the road to optimize the FES-input to maximize the force response to a pulse train, to track a reference force while minimizing the fatigue for a sequence of pulse trains or to follow a reference joint angle trajectory to produce motion in the non-isometric case. In this article, we introduce the geometric frame to analyze the dynamics and we present Pontryagin types necessary optimality conditions adapted to digital controls, used in the experiments, vs permanent control and which fits in the optimal sampled-data control frame. This leads to Hamiltonian differential variational inequalities, which can be numerically implemented vs direct optimization schemes.