Distances with respect to principal axis

GROMACS version: 2021.2
GROMACS modification: No

Dear GROMACS developers and users,

Is it possible to compute the following distances using GROMACS?

(A) Perpendicular distance of a point from the principal axis of a group of atom positions

(B) Vertical movement of a point along the principal axis of a group of atom positions

Please refer to the attached figure for reference. Kindly feel free to suggest alternative tools that can be used for these calculations.



Hey everyone,

Please let me know how can I save the 3D (x-y-z) coordinates of the centre of mass of an atom group mentioned in the index file. Thank you very much.


you can try gmx traj together with the option -com gmx traj — GROMACS 2022 documentation

1 Like

Thank you very much! It worked perfectly.

Is it also possible to align the molecule along the z-axis after the simulation with GROMACS? The option is not there with gmx trjconv.

Another alternative I looked into was obtaining the end terminal 3D coordinates of the central (primary) axis along the length of the molecule (please refer to the figure in the original question) to calculate the perpendicular distance of a point from it. The centre of mass (or centre of geometry) should ideally lie in the middle of such an axis.