Statistical Treatment of Constrained Systems in the Microcanonical Ensemble Consider a constrained classical Lagrangian $ \mathcal{L}' = \mathcal{L}(q, \dot{q}) + \lambda f(q) $ where $ \lambda $ is the lagrange multiplier for the constraint. We can get a Hamiltonian for this system by the standard Legendre transform,
\begin{align}
\mathcal{H}' = \dot{q} \frac{\partial}{\partial \dot{q}} \mathcal{L}' - \mathcal{L'} = \mathcal{H} - \lambda f(q)
\end{align}
If I were trying to get the equations of motion, I would normally treat $ \lambda $ as a normal variable and get the equations of motion as usual.
Treating it like a normal variable, the microcanonical ensemble is,
\begin{align}
\Omega(E) &= \int dq dp d\lambda~\delta \big( E - \mathcal{H} + \lambda f(q) \big)
\end{align}
But if I inject the constain by hand into the microcanonical ensemble, I would expect an integral like,
\begin{align}
\Omega(E) &= \int dq dp~\delta \big( E - \mathcal{H} \big)
~\delta \big( f(q) \big)
\end{align}
What is the connection? I assume the second integral is correct as it makes more sense to me, but how to I derive it? What about KKT type constrained dynamics like a ball falling onto a floor?
 A: In the only field where I have seen this issue treated, polymers, the approach is your second take at it, i.e. introducing delta functions in the partition function [1]. Just to give you a feel for it, the simplest model of a polymer is a freely joint chain. If $r_i$ is the position of the $i$-th joint, the first constraint is to require that the distance between two consecutive joints is a constant, $\delta\big((r_{i+1}-r_i)^2 - a^2\big)$. The second one is that the motion of each joint shall be perpendicular to the link in the frame of the opposite joint, $\delta\big((p_{i+1}-p_i)\cdot(r_{i+1}-r_i)\big)$. Then the partition function is written
$$Z = \int \Pi_i dr_i dp_i \delta\big((r_{i+1}-r_i)^2 - a^2\big) \delta\big((p_{i+1}-p_i)\cdot(r_{i+1}-r_i)\big)\exp\left(-\beta\frac{p^2}{2m}\right)$$
Caveat: I do not make the claim that the problem is always treated that way, as I am not a specialist in this area, but working in the field of crystallography, I have some exposure to protein physics, and this is the only approach I have been exposed to.
[1] Martial Mazars. Statistical physics of the freely jointed chain. Phys. Rev. E, 53:6297–6319, Jun 1996.
A: In Section VI of Non-Hamiltonian molecular dynamics: Generalizing Hamiltonian phase space principles to non-Hamiltonian systems, a statistical treatment of Holonomic constraints is given. In section II.D, the microcanonical ensemble is described as,
\begin{align}
f(x) = \prod_k \delta \big\{ \Lambda_k(q, p) - C_k \big\}
\end{align}
where $ \Lambda_k $ is a conserved quantity and $ C_k $ is the value we are controlling (like $ E $).
Then, Holonomic constraints are just another conserved quantity.
