int usage(char *prog) {
printf("\nusage:\n");
- printf(" %s <file> <centre atom> <radius> [marked atom]\n\n",prog);
+ printf(" %s <file> <centre atom> <radius> <lc> [marked atom]\n\n",
+ prog);
return -1;
}
t_linkcell *lc;
t_3dvec dist;
double d,radius;
+ double ox,oy,oz;
int ma,ca;
+ double lac;
if(argc<4) {
usage(argv[0]);
ca=atoi(argv[2]);
radius=atof(argv[3]);
+ lac=atof(argv[4]);
ma=-1;
- if(argc==5)
- ma=atoi(argv[4]);
+ if(argc==6)
+ ma=atoi(argv[5]);
memset(&moldyn,0,sizeof(t_moldyn));
(itom->r.z+moldyn.dim.z/2)/lc->z,
n);
-
+
+ /* prepare offset */
+ ox=0.0;
+ if(itom->r.x<0) {
+ while((itom->r.x+ox)<(-lac/2.0))
+ ox+=lac;
+ }
+ else {
+ while((itom->r.x+ox)>(lac/2.0))
+ ox-=lac;
+ }
+
+ oy=0.0;
+ if(itom->r.y<0) {
+ while((itom->r.y+oy)<(-lac/2.0))
+ oy+=lac;
+ }
+ else {
+ while((itom->r.y+oy)>(lac/2.0))
+ oy-=lac;
+ }
+
+ oz=0.0;
+ if(itom->r.z<0) {
+ while((itom->r.z+oz)<(-lac/2.0))
+ oz+=lac;
+ }
+ else {
+ while((itom->r.z+oz)>(lac/2.0))
+ oz-=lac;
+ }
+
+
printf("%s %f %f %f %s %f\n",
- pse_name[itom->element],itom->r.x,itom->r.y,itom->r.z,
+ pse_name[itom->element],itom->r.x+ox,itom->r.y+oy,itom->r.z+oz,
"Green",itom->ekin);
for(j=0;j<27;j++) {
if(d<=radius) {
printf("%s %f %f %f %s %f\n",
pse_name[jtom->element],
- jtom->r.x,jtom->r.y,jtom->r.z,
+ jtom->r.x+ox,jtom->r.y+oy,jtom->r.z+oz,
(jtom->tag==ma)?"Red":pse_col[jtom->element],
jtom->ekin);
}