Many studies of systems using molecular dynamics are often simulated with some constraint on the center of mass. As shown by Polson et.al$^1$ the ratio of the kinetic partition function of the constrained to the unconstrained system has a neat analytical representation (see equation 6 in their paper).
The solution comes down to solving the following integral $$ Q^{CM}_K=\int d\vec{\textbf{p}}^N \exp(-\beta\sum_{i=1}^N\frac{\vec{\textbf{p}}^2_i}{2 m_i}) \ \delta\Big(\sum_{i=1}^N \vec{\textbf{p}}_i - \vec{\textbf{0}}\Big) $$ Physically $Q^{CM}_K$ represents the kinetic partition function of system where the total momentum of the system is constrained to $\vec{\textbf{0}}$. Solving an integral with a delta function in 1D is straightforward. The 3D argument inside the delta function seems to be a bit problematic at first. However the problem can be solved by generalizing the above equation in the following way (follows Uline et.al$^2$) $$ Q^{CM}_K(N,V,T,\vec{\textbf{P}})=\int d\vec{\textbf{p}}^N \exp(-\beta\sum_{i=1}^N\frac{\vec{\textbf{p}}^2_i}{2 m_i}) \ \delta\Big(\sum_{i=1}^N \vec{\textbf{p}}_i - \vec{\textbf{P}}\Big) $$ where $\vec{\textbf{P}}$ is some general constraint on the total momentum. The volume of the system ($V$) does not formally affect the value of the above integral but we write it here just for completeness. We can now Fourier transform the equation with respect to $\vec{\textbf{P}}$ to yield $$ \widetilde{Q}^{CM}_K(N,V,T,\vec{\textbf{k}})=\frac{1}{(2\pi)^{d/2}}\int d\vec{\textbf{p}}^N \exp(-\beta\sum_{i=1}^N\frac{\vec{\textbf{p}}^2_i}{2 m_i}) \ \int d\vec{\textbf{P}} \exp(-i\vec{\textbf{k}}.\vec{\textbf{P}}) \ \delta\Big(\sum_{i=1}^N \vec{\textbf{p}}_i - \vec{\textbf{P}}\Big) \\ =\frac{1}{(2\pi)^{d/2}}\int d\vec{\textbf{p}}^N \exp(-\beta\sum_{i=1}^N\frac{\vec{\textbf{p}}^2_i}{2 m_i}) \ \exp(-i\vec{\textbf{k}}.\sum_{i=1}^N\vec{\textbf{p}}_i) $$ where $d$ is the dimensionality of the problem and the resulting transform is now separable. Each integral is a Gaussian and the result is $$ \widetilde{Q}^{CM}_K=\frac{1}{(2\pi)^{d/2}} \Big(\frac{2\pi}{\beta}\Big)^{dN/2} \exp\Big(-\frac{\vec{\textbf{k}}^2}{2 \beta}\sum_{i=1}^N m_i\Big) \prod_{i=1}^N m_i^{d/2} $$ which can now be Fourier inverted to yield $$ Q^{CM}_K(N,V,T,\vec{\textbf{P}})=\Big(\frac{2\pi}{\beta}\Big)^{d(N-1)/2} \frac{1}{(\sum_{i=1}^N m_i)^{d/2}} \ \exp\Big(-\frac{\beta \ \vec{\textbf{P}}^2}{2\sum_{i=1}^N m_i}\Big)\prod_{i=1}^N m_i^{d/2} $$
For the case when the total momentum of the system is constrained to zero (zero center of mass velocity) the value of the exponential term is 1.
1. Polson, J.M., Trizac, E., Pronk, S., and Frenkel, D. J. Chem. Phys., 112, 2000. Link
2. Uline, M.J., Siderius D.W., and Corti D.S. J. Chem. Phys., 128, 2008. Link