Question about quaternion calculation


I was just trying to understand the quaternion calculation procedure in lammps. I just did not understand how it works to convert the lab fixed frame to the body frame? Basically how this quaternion (with Euler’s angle generation w.r.t. simulation box coordinates ) is calculated in lammps? Please elaborate.


Tuhin Samanta

Take a look at molecule.cpp (in the LAMMPS "src" subdirectory). If
memory serves me correction, that file contains code to calculate the
principle axis of inertia of a molecule and convert them into a

The following link is probably not relevant, but I include it anyway.

Note that Euler angles and quaternions are different things.
LAMMPS does not use Euler angles to represent
orientations of a body. The code Andrew mentioned as well as
fix_rigid.cpp have the calls to do quaternion operations.
Most of the methods are in math_extra.cpp/h. A description
of the quaternion equations can be found in Allen & Tildesley
as I recall. I also have a nice PDF write-up someone here
at Sandia did years ago. I can email you that if you send me
your email address (send it to me personally rather than
advertise it on the mail list).