[gmx-developers] pbc.c: put_atoms_in_triclinic_box
Berk Hess
gmx3 at hotmail.com
Wed Dec 10 14:22:39 CET 2003
>I would like to make a suggestion for replacing the function
>put_atoms_in_triclinic_box in pbc.c, because the current one, which I
>find a bit hard to understand, produces a shift between the box and the
>atoms. The following puts all of the atoms in the triclinic box:
Whether or not it produces a shift depends on definitions.
Currently all put_atom_in_?_box routines keep the center of the box at
the center. And the center is defined as a half times the diagonal of the
box matrix.
So this can be changed easily and consistenly by changing the center
definition.
>void put_atoms_in_triclinic_unitcell(matrix box, int natoms, rvec x[])
>{
> matrix S,T;
> int i,j;
>
> transpose(box, S);
> m_inv(S,T);
> for(i=0; i<natoms; i++)
> {
> mvmul(T, x[i], x[i]);
> x[i][0] = trunc(x[i][0]);
> x[i][1] = trunc(x[i][1]);
> x[i][2] = trunc(x[i][2]);
> mvmul(S, x[i], x[i]);
> }
>}
This will not work. You don't want trunc, you want the remainder.
But again, the routine should not be changed, only the calc_box_center
routine.
We can discuss which definition is better/more useful.
In rasmol there seems to be a shift, but other programs might work
differently.
Berk.
_________________________________________________________________
Talk with your online friends with MSN Messenger http://messenger.msn.nl/
More information about the gromacs.org_gmx-developers
mailing list