Add a function to eliminate center-of-mass motion after #2. The arguments may be the kinetic terms and the coordinate transformation matrix $\pmb{A}$:
$$\begin{pmatrix}
\pmb{r}'_1 \\\
\pmb{r}'_2 \\\
\pmb{r}'_3 \\\
\end{pmatrix}
=
\begin{pmatrix}
A_{11} A_{12} A_{13}\\\
A_{21} A_{22} A_{23}\\\
A_{31} A_{32} A_{33}\\\
\end{pmatrix}
\begin{pmatrix}
\pmb{r}_1 \\\
\pmb{r}_2 \\\
\pmb{r}_3 \\\
\end{pmatrix}.$$
Add a function to eliminate center-of-mass motion after #2. The arguments may be the kinetic terms and the coordinate transformation matrix$\pmb{A}$ :