Hello!
I calculated the image distances of two center mass of the specified atoms
in truncated octahedron box by using ptraj. Because ptraj can not
calculate the imaged distance correctly when the non-imaged distance is
greater than two time box size, I implemented the algorithm which GROMOS
use to calculate the image distance in truncated octahedron box. But some
of the imaged distances calculated by this new program are very small (<
1.0 A). I give out the code below and look forward some advices.
...
/*the origin is set at Ri , (X,Y,Z) is the new coordinates of the atom j
X = Xj - Xi
Y = Yj - Yi
Z = Zj - Zi
/*The atom j is moved into the positive quadrant with respect to an origin
at 0*/
if ( X < 0 ) X = -X;
if ( Y < 0 ) Y = -Y;
if ( Z < 0 ) Z = -Z;
while ( X > box[0] ) X = X - box[0];
while ( Y > box[1] ) Y = Y - box[1];
while ( Z > box[2] ) Z = Z - box[2];
/*The atom j is moved into the truncated octahedraon box with respect to
an center at (box[0]/2,box[1]/2,box[2]/2)
if ( fabs(X-box[0]/2.0)+fabs(Y-box[1]/2.0)+fabs(Z-box[2]/2.0) >
0.75*box[0] ) {
X=X-((X-box[0]/2.0>=0)?1:-1)*box[0]/2.0;
Y=Y-((Y-box[1]/2.0>=0)?1:-1)*box[1]/2.0;
Z=Z-((Z-box[2]/2.0>=0)?1:-1)*box[2]/2.0;
}
/*The atom j is moved into the truncated octahedraon box with respect to
an center at the origin)
X=X-box[0]/2.0;
Y=Y-box[1]/2.0;
Z=Z-box[2]/2.0;
return(X*X+Y*Y+Z*Z);
===========================================
Jun Wang, Ph.D.
Dept Molecular Biology & Biochemistry
University of California, Irvine, CA 92697
Phone: (949) 824-9562
Email: jwang20.uci.edu
===========================================
Received on Sun Sep 23 2007 - 06:07:17 PDT