Understanding the rigorous bridge between atomistic and coarse-grained simulations

I am currently reading this paper by Noid et. al. on the rigorous bridge between atomistic and coarse-grained simulations.

In the paper, he defined a linear map from the atomistic coordinates and momenta $$\mathbf{r}^n, \mathbf{p}^n$$ to the coarse-grained coordinates $$\mathbf{R}^N, \mathbf{P}^N$$. He then defined the Hamiltonian for both frames of reference, $$h\, (\text{all-atom}),H \,(\text{CG})$$.

The part of the paper I don't understand is when they evaluate the forces on the CG model (equations 22-26). They write, $$\begin{eqnarray} \tag{1} \mathbf{F}_I(\mathbf{R}^N) &= -\frac{\partial U (\mathbf{R}^N)}{\partial \mathbf{R}_I} \\ \tag{2} &= \frac{k_BT}{z(\mathbf{R}^N)}\frac{\partial z(\mathbf{R}^n)}{\partial \mathbf{R}_I} \end{eqnarray}$$

$$\tag{3} \frac{k_BT}{z(\mathbf{R}^N)} \int d\mathbf{r}^n e^{-u(\mathbf{r}^n)/k_BT}\prod_{J\neq I} \delta (M_{RJ}(r^n)-\mathbf{R}_J)\frac{\partial}{\partial \mathbf{R}_I}\delta \left( \sum _{i\in \mathcal{I}_I } c_{Ii}\mathbf{r}_i-\mathbf{R}_I\right)$$

This is the part that confuses me. I know that:$$\mathbf{R}_I = \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i\tag{4}\label{4}$$ So shouldn't $$\frac{\partial X}{\partial \mathbf{R}_I} = \sum _{i\in \mathcal{I}_I} \frac{\partial X}{\partial \mathbf{r}_i} \frac{\partial \mathbf{r}_i}{\mathbf{R}_I} = \sum _{i\in \mathcal{I}_I}\frac{\partial X}{\partial \mathbf{r}_i}\frac{1}{c_{Ii}}\tag{5}$$ be the case? However, equation 23 simply states that $$\frac{\partial}{\partial \mathbf{R}_I} \delta \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right) = -\frac{1}{c_{Ik}} \frac{\partial }{\partial \mathbf{r}_k} \delta \left(\sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I\right)\tag{6}\label{6}$$

How does this equation work?

Furthermore, I don't understand how they perform integration by parts on the higher-dimensional integral they have here, and arrive at the equation that they do. I would greatly appreciate it if someone could help me reach equation 26 from equation 22 in the paper.

I appreciate any advice that you may have!!

Before working through the equations, I'll try to explain the logic behind what they are doing. It helps to think of think of their process backwards and assume they want an expression like equation 26: $$\mathbf{F}_I(\mathbf{R}^N)=\langle\mathcal{F}_I(\mathbf{r}^n)\rangle_{\mathbf{R}^N} \tag{7}\label{7}$$ where the left-hand side is the coarse-grained forces and the left is some average of the atomistic forces in the form described in equation 28 of the paper: $$\langle \mathcal{F}_I(\mathbf{r}^n)\rangle_{\mathbf{R}^N}=\frac{\int d\mathbf{r}^n e^{-u(\mathbf{r}^n)/k_BT} \delta (\mathbf{M}_{\mathbf{R}}(r^n)-\mathbf{R}^N)\mathcal{F}_I(\mathbf{r}^n)}{\int d\mathbf{r}^n e^{-u(\mathbf{r}^n)/k_BT} \delta (\mathbf{M}_{\mathbf{R}}(r^n)-\mathbf{R}^N)}\tag{8}\label{8}$$ As written, equation 22 already has this denominator, which is simply $$z(\mathbf{R}^N)$$. One way to get the numerator in the correct form would be if we could move the derivative that is acting on the delta function to instead act on the exponential. This would bring down a factor proportional to $$\frac{\partial u(\mathbf{r}^n)}{\partial \mathbf{r}^n}$$ and allow the product of individual delta functions of each $$\mathbf{M}_{\mathbf{R}_{I}}$$ to be rewritten as a single delta function of the vector $$\mathbf{M}_{\mathbf{R}}$$. We could make this move via integration by parts, but we want to be moving an atomistic derivative ($$\frac{\partial}{\partial \mathbf{r}_i}$$ ) rather than a coarse-grained derivative ($$\frac{\partial}{\partial \mathbf{R}_I}$$).
The expression for equation 23 (your equation \ref{6}) isn't obtained directly from the chain rule. Your equation \ref{4} is incorrect, as its not $$\mathbf{R}_I$$ that is a function of $$\mathbf{r}_i$$, but rather the mapping operator $$\mathbf{M}_{\mathbf{R}_{I}}$$, which in the integral we constrain to be equal to $$\mathbf{R}_I$$ through the Dirac deltas. This subtle point means that $$\mathbf{R}_I$$ is constant with respect to differentiation by $$\mathbf{r}_i$$ and vice versa. To obtain equation 23, we compare the derivatives, which can be individually evaluated using the chain rule: \begin{align}\frac{\partial}{\partial \mathbf{R}_I} \delta \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right)&=\delta' \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right)\frac{\partial}{\partial \mathbf{R}_I}\left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right)\\&=-\delta' \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right)\end{align}\tag{9}\label{9} \begin{align}\frac{\partial}{\partial \mathbf{r}_k} \delta \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right)&=\delta' \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right)\frac{\partial}{\partial \mathbf{r}_k}\left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right)\\&=c_{Ik}\delta' \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right) \end{align}\tag{10}\label{10}
where we can see that a factor of $$-\frac{1}{c_{Ik}}$$ is need to make equation \ref{10} equal to equation \ref{9}.
So this gives us an atomistic derivative, but getting to equation 26 requires one more tiny correction. If we just proceeded from here, partial integration would lead to the derivative being applied to the exponential, but also to all the other dirac deltas that depend on $$\mathbf{r}_k$$. To fix this issue, they ensure that the derivative they are taking applies to only one coarse-grained site/dirac delta by defining the set $$\mathcal{S}_I$$ of atoms specific to site $$I$$ and corresponding coefficients (given in equation 24 of the paper) such that $$\sum_{j\in S_I}d_{Ij}=1\tag{11}$$ This allows us to rewrite the relation in equation 23 as equation 25: $$\frac{\partial}{\partial \mathbf{R}_I} \delta \left( \sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I \right) = -\sum_{j\in S_I}\frac{d_{Ij}}{c_{Ij}} \frac{\partial }{\partial \mathbf{r}_j} \delta \left(\sum _{i\in \mathcal{I}_I} c_{Ii}\mathbf{r}_i - \mathbf{R}_I\right)\tag{12}$$
Shifting this sum of derivatives to the exponential via partial integration puts the numerator in a form matching equation 28 (equation \ref{8} here) with (equation 27 in the paper) $$\mathcal{F}_I(\mathbf{r}^n)=\sum_{j\in S_I}\frac{d_{Ij}}{c_{Ij}}\mathbf{f}_j(\mathbf{r}^n)\tag{13}$$ where $$\mathbf{f}_j(\mathbf{r}^n)=-\frac{\partial u(\mathbf{r}^n)}{\partial \mathbf{r}_j}$$.