Obtaining molecule COM in body frame coordinate system

Dear LAMMPS users,
I’m not exactly sure of where to post this and that’s why I’m posting in the general discussion. So, I’m studying anisotropic diffusion of the COM of an organic molecule and as a result need to convert the COM in the world frame to body frame. My understanding is that compute com/chunk calculates in world frame, but I can’t find a compute in LAMMPS that does this in body frame.

As a result, I’m planning to post process by calculating the moment of inertia of the molecules in LAMMPS, obtain the eigenvector (corresponding to the biggest eigenvalue) and calculate the angle that this eigenvector makes with the simulation box’s x-axis. This angle will then be fed into my rotation matrix (for rotation in x-y plane)

Where I need clarification with is this:

  1. When LAMMPS calculate moment of inertia, does it translate the origin to the COM of the molecules?
  2. If it does, how can one obtain this displacement vector?
  3. Is there a more efficient way to do this whole coordinate transformation in LAMMPS?

Thanks a lot.

A quick look at the code confirms (as we would expect) that compute inertia/chunk calculates the inertia tensor relative to the centre of mass of the chunk, and in the frame of the box (or world).

I am not aware of any inbuilt LAMMPS functions for calculating the principal frame from this tensor, but it should not be too difficult for you to “roll your own” (e.g. 3d - Analytical expression for the eigenvectors of a 3x3 real, symmetric matrix? - Signal Processing Stack Exchange)

Thank you very much for your response. I really appreciate it.