[gmx-users] Water out of box? Negative Z-Coordinates

GtrAngus maps99 at online.de
Tue Apr 1 15:23:31 CEST 2014


Many thanks to both of you! :)

I am not that familiar with C-Code and gromacs. Maybe you could take a look
at it, that this would be correct for me? Does this code also work for none
cubic boxes?

// Here begins the actual analysis
static int analyze_frame(t_topology *top, t_trxframe *fr, t_pbc *pbc,
              int nr, gmx_ana_selection_t *sel[], void *data)
{
    const rvec *pos = fr->x; 	// positions
    const int numAtoms = fr->natoms;	// number of all atoms
    const rvec box = { fr->box[XX][XX],	fr->box[YY][YY], fr->box[ZZ][ZZ] };
// box size

    // Do I have to change something in the next four lines according to my
code above?
    matrix transp,invbox;
    rvec tmp;
    transpose(frame.box,transp);
    m_inv(transp,invbox);

    for (int i=0; i<numAtoms; i++)
    {
      mvmul(invbox,fr.x[i],tmp); // Same question for the next five lines
      tmp[0] -= floor(tmp[0]);
      tmp[1] -= floor(tmp[1]);
      tmp[2] -= floor(tmp[2]);
      mvmul(transp,tmp,fr.x[i]);
    } 
}

After this code, do I have to work with the tmp or can I use my position
vector pos? E.g. z-coordinate of particle i is just

pos[i][ZZ];

Or the box size is

box[ZZ];

That is easy to understand for me and I would like to keep it that simple.
So if it changes the name e.g. from pos to pos2 would be nice :)

Many thanks to you Tsjerk Wassenaar!

--
View this message in context: http://gromacs.5086.x6.nabble.com/Water-out-of-box-Negative-Z-Coordinates-tp5015506p5015541.html
Sent from the GROMACS Users Forum mailing list archive at Nabble.com.


More information about the gromacs.org_gmx-users mailing list