# [gmx-users] how to calculate the normal of plane for Tryptophan or how to get the comparison matrix in g_rms

Sat Oct 15 21:12:25 CEST 2011

```Have you thought about using the cross product. If you took the cross product of the unit vector in the direction of every atom starting from atom 1 then moved on to starting from atom 2 and so on you would have a set of vectors normal to every group of three atoms. If you then normalised them and defined one to be pointing upwards you could then ensure using dot products that they all pointed the same way, a condition like if a.b <0 b=-b would probably work you could then take the mean of the vectors. This should give an average normal vector to the plane of the molecule.

If you’re going to be doing this a lot I would suggest removing the inherent double counting (r12=-r21).

You could also think about weighting normal vectors in the averaging, for instance you could do it based on the sine of the angle between the vectors which generated them, or the mass of the atoms (H’s will more out of plane than carbons typically)

Richard

On 15/10/2011 15:45, "xiaodong huang" <xiaodonghuang2060 at gmail.com> wrote:

I send this message yesterday, but I myself donot see this message, so, I send it again, very sorry for the spam.
Dear gmxer's
I am simulating a protein, want to calculate the normal of plane for Tryptophan residue amino acid in that protein.
We need to take into account that, in simulation, atoms of TRP vibrate all the time, and they are not always on the same plane:
If they were on the same plane in my simulation, to calculate the normal would be rather straighforward.
As those atoms are not on the same plane, I think my calculation should be something like least square fitting. I look at g_rms command,
and plan to calculate the normal in following steps:
1. create a Tryptophan with ideal configuration, where all 8 C atom and N atom (except CB atom) should be in the same plane,
I put these 9 atoms in xy plane, and the normal of this TRP molecule is just z axis
2.I then calculate the rms between the TRP residue in my simulation and that ideal TRP molecule
3.If I know the rotate matrix (e.g. how to rotate the TRP in my simulation in the least-squares fitting of rms calculation), then I
just rotate z axis (0,0,1) back ( in other words, multiple z axis (0,0,1) with the inverse of that rotate matrix) to get the plane normal
for TRP in my simulation.
So, I am wondering how to know the the rotate matrix when g_rms do the least-squares fitting? Is that in the comparison matrix
dumped by the -bin option? If so, how to read the rotate matrix from that binary file produced by -bin option?
Or, if there is other way that I can calculate plane normal for TRP?
Thank you so much for your kind help.
yours
xiaodong
school of chem, ANU

________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20111015/dd0b3abc/attachment.html>
```