# [gmx-users] calculating com-com distances.

Fernando C fernando.cesar.lf at gmail.com
Fri Apr 17 03:14:50 CEST 2009

```Tsjerk, your good reference helped me to understand the set_pbc and pbc_dx
functions from g_dist... I changed few lines of it and my problem was
solved. Thank you.

Cheers. Fernando.

2009/4/14 Tsjerk Wassenaar <tsjerkw at gmail.com>

> Hi Fernando,
>
> Just bear in mind that these lattice vectors are just translation
> vectors. You can add them to or subtract them from the positional
> vectors of the com. That way you'll get a number of points which you
> can use to calculate the distances the regular way. To see where you
> went wrong, consider that a vector of the triclinic unit cell may have
> more than one non-zero component. You considered only one non-zero
> component, based upon the rectangular brick representation. But from
> Pythagoras theorem it follows that doing so will make you miss part of
> the true distance and come to an underestimate of it.
> There is a niftier solution to the smallest distance, which will work
> regardless of the separation between particles/coms in the infinite
> system. It's in my thesis (Chapter 3, Appendix C, page 68):
>
> http://dissertations.ub.rug.nl/faculties/science/2006/t.a.wassenaar/?FullItemRecord=ON
>
> Hope it helps,
>
> Tsjerk
>
> On 4/14/09, Fernando C <fernando.cesar.lf at gmail.com> wrote:
> > Hi Tsjerk and all list!
> >
> >  > You have to use the three vectors from the tricilinic representation
> >  > to obtain the correct distance in the periodic system. Check PBC in
> >  > Chapter 3 of the manual.
> >
> >
> >  I used the length values from rectangular box because I'd want believe
> that
> > my problem would be solved easily; I wouldn't want to fall in question of
> > calculate positions and distances in triclinic cells. But here I am:
> could
> > anybody explain to me the algorithm of how such things are calculated?
> >
> >  Thanks again!
> >
> >  Fernando.
> >
> >
> >
> >
> >
> >  --
> >  And Noel Gallagher said: Gromacs is gonna live forever!
> >
> > 2009/4/13 Tsjerk Wassenaar <tsjerkw at gmail.com>
> > >
> > > Hi Fernando,
> > >
> > >
> > > > I've obtained the vectors for the rectangular box in g_energy,
> > > > using Box_XX, Box_YY and Box_ZZ options; I didn't use the vectors of
> the
> > > > skewed box.)
> > >
> > > You have to use the three vectors from the tricilinic representation
> > > to obtain the correct distance in the periodic system. Check PBC in
> > > Chapter 3 of the manual.
> > >
> > > Cheers,
> > >
> > > Tsjerk
> > >
> > > --
> > > Tsjerk A. Wassenaar, Ph.D.
> > > Junior UD (post-doc)
> > > Biomolecular NMR, Bijvoet Center
> > > Utrecht University
> > > 3584 CH Utrecht
> > > The Netherlands
> > > P: +31-30-2539931
> > > F: +31-30-2537623
> > > _______________________________________________
> > > gmx-users mailing list    gmx-users at gromacs.org
> > > http://www.gromacs.org/mailman/listinfo/gmx-users
> > > Please search the archive at http://www.gromacs.org/search before
> posting!
> > > Please don't post (un)subscribe requests to the list. Use the
> > > www interface or send it to gmx-users-request at gromacs.org.
> > > Can't post? Read
> > http://www.gromacs.org/mailing_lists/users.php
> > >
> >
> >
> > _______________________________________________
> >  gmx-users mailing list    gmx-users at gromacs.org
> >  http://www.gromacs.org/mailman/listinfo/gmx-users
> >  Please search the archive at http://www.gromacs.org/search before
> posting!
> >  Please don't post (un)subscribe requests to the list. Use the
> >  www interface or send it to gmx-users-request at gromacs.org.
> > http://www.gromacs.org/mailing_lists/users.php
> >
>
>
> --
> Tsjerk A. Wassenaar, Ph.D.
> Junior UD (post-doc)
> Biomolecular NMR, Bijvoet Center
> Utrecht University
> 3584 CH Utrecht
> The Netherlands
> P: +31-30-2539931
> F: +31-30-2537623
> _______________________________________________
> gmx-users mailing list    gmx-users at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-users
> Please search the archive at http://www.gromacs.org/search before posting!
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.