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

Tsjerk Wassenaar tsjerkw at gmail.com
Tue Apr 1 08:52:31 CEST 2014


>
> Amendment: you need to provide a .tpr if you want trjconv to do anything
> useful.  The trajectory has no knowledge of what defines periodicity.


That is not true. A .tpr is only needed for connectivity to make molecules
whole. Everything else depends just on the simulation cell, which is stored
with every frame.

For what it's worth, an easy way to put all atoms in the unit cell is in
your C-code (so you don't need trjconv for that) is

matrix transp,invbox;
rvec tmp;
transpose(frame.box,transp);
m_inv(transp,invbox);
for (i=0; i<fr.natoms; i++)
{
  mvmul(invbox,fr.x[i],tmp);
  tmp[0] -= floor(tmp[0]);
  tmp[1] -= floor(tmp[1]);
  tmp[2] -= floor(tmp[2]);
  mvmul(transp,tmp,fr.x[i]);
}

This transforms the unit cell to a cubic unit lattice, in which the integer
part indicates the unit cell and the fraction the relative position in the
unit cell. Removing the integer part puts the particle in the cell starting
at (0,0,0).

Cheers,

Tsjerk


More information about the gromacs.org_gmx-users mailing list