# [gmx-users] Distance between the atoms greater than Box length

Quyen V. Vu vuqv.phys at gmail.com
Tue Jun 5 03:20:17 CEST 2018

```Hi Dillip,
As Mark suggest, If you want to calculate by your own code, you can put the
condition to check which is the nearest neighbour by comparing with box
length/2

On Mon, Jun 4, 2018, 19:42 Mark Abraham <mark.j.abraham at gmail.com> wrote:

> Hi,
>
> You have a periodic cell, so in general the distance from A to the nearest
> periodic image of B is across a cell boundary. Trjconv cannot produce a
> trajectory so that all pairs of A and B will have a non-periodic distance
> that is the minimum distance. Use a tool that already understands this,
> like
>
> http://manual.gromacs.org/documentation/current/onlinehelp/gmx-distance.html
> or
> http://manual.gromacs.org/documentation/current/onlinehelp/gmx-mindist.html
> .
>
> Mark
>
> On Mon, Jun 4, 2018, 14:01 Dilip.H.N <cy16f01.dilip at nitk.edu.in> wrote:
>
> > Hello all,
> > I have extracted the trajectory of my system containing all the water
> > molecules and my box length is 2.48 ~2.5 nm.
> > The command was:
> > gmx trjconv -f nptmd.xtc -s nptmd.tpr -pbc mol -o nptmdtrjwater500.gro
> -dt
> > 60      #i have 60000 frames (30ns is the time and saved the coordinates
> > for 0.5 ps )and i have extracted a total of 500 frames trajectory (-dt 60
> > =>30000/500).
> >
> > And i have written a code which calculates the inter-atomic distance (in
> my
> > case it is inter oxygen distances). And when i calculate it (using the
> > distance formula ie.,
> > {sqrt [(x2-x1)**2+(y2-y1)**2+(z2-z1)**2]} the distance between the oxygen
> > atom of say, 7SOL and 6SOL, the distance comes to 3.4520.
> >
> > Here are the coordinates for two water coordinates as representative...
> >
> > Generated by trjconv : Glycine-Water t=   0.00000
> > xxx
> >     .
> >     .
> >     .
> >     6SOL     OW   13   2.405   0.185   1.774
> >     6SOL    HW1   14   2.452   0.097   1.782
> >     6SOL    HW2   15   2.466   0.259   1.804
> >     7SOL     OW   16   0.016   2.177   0.277
> >     7SOL    HW1   17   0.098   2.141   0.234
> >     7SOL    HW2   18  -0.064   2.126   0.245
> >     .
> >     .
> >     2.49238   2.49238   2.49238
> >
> > How is this possible ie., 3.452 nm, which is greater than the box length
> > (2.5 nm). How can the interatomic distance be greater than the box
> > length..??
> >
> > Any suggestions are appreciated.
> >
> > Thank you.
> >
> > [image: Mailtrack]
> > <
> >
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&
> > >
> > Sender
> > notified by
> > Mailtrack
> > <
> >
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&
> > >
> > 06/04/18,
> > 5:26:50 PM
> >
> > ---
> > With Best Regards,
> >
> > Dilip.H.N
> > PhD Student.
> >
> > On Mon, Jun 4, 2018 at 5:15 PM, Dilip.H.N <cy16f01.dilip at nitk.edu.in>
> > wrote:
> >
> > > Hello all,
> > > I have extracted the trajectory of my system containing all the water
> > > molecules and my box length is 2.48 ~2.5 nm.
> > >
> > > And i have written a code which calculates the inter-atomic distance
> (in
> > > my case it is inter oxygen distances). And when i calculate it (using
> the
> > > distance formula ie.,
> > > {sqrt [(x2-x1)**2+(y2-y1)**2+(z2-z1)**2]} the distance between the
> oxygen
> > > of say
> > > 6SOL     OW   13   2.405   0.185   1.774
> > >     6SOL    HW1   14   2.452   0.097   1.782
> > >     6SOL    HW2   15   2.466   0.259   1.804
> > >     7SOL     OW   16   0.016   2.177   0.277
> > >     7SOL    HW1   17   0.098   2.141   0.234
> > >     7SOL    HW2   18  -0.064   2.126   0.245
> > >
> > >
> > > ---
> > > With Best Regards,
> > >
> > > Dilip.H.N
> > > PhD Student.
> > > [image: Mailtrack]
> > > <
> >
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&
> >
> > Sender
> > > notified by
> > > Mailtrack
> > > <
> >
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&
> >
> > 06/04/18,
> > > 5:15:08 PM
> > >
> > --
> > Gromacs Users mailing list
> >
> > * Please search the archive at
> > http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> > posting!
> >
> > * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> >
> > * For (un)subscribe requests visit
> > https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> > send a mail to gmx-users-request at gromacs.org.
> >
> --
> Gromacs Users mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
>
```