Finish border treatment.
This commit is contained in:
parent
7d0c47da72
commit
9e7cbf5687
128
src/main.c
128
src/main.c
@ -814,83 +814,82 @@ void setupBorders()
|
|||||||
/* Setup ghost atoms */
|
/* Setup ghost atoms */
|
||||||
if (x[i] < Cutneigh) { /* left plane */
|
if (x[i] < Cutneigh) { /* left plane */
|
||||||
ADDGHOST(+1,0,0);
|
ADDGHOST(+1,0,0);
|
||||||
/* Nghost++; */
|
|
||||||
/* BorderMap[Nghost] = i; */
|
|
||||||
/* PBCx[Nghost] = +1; PBCy[Nghost] = 0; PBCz[Nghost] = 0; */
|
|
||||||
|
|
||||||
/* treat edges and corners */
|
/* treat edges and corners */
|
||||||
if (z[i] < Cutneigh) { /* bottom left edge */
|
if (z[i] < Cutneigh) { /* bottom left edge */
|
||||||
Nghost++;
|
ADDGHOST(+1,0,+1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = +1; PBCy[Nghost] = 0; PBCz[Nghost] = +1;
|
|
||||||
|
|
||||||
if (y[i] < Cutneigh) { /* bottom left front corner */
|
if (y[i] < Cutneigh) { /* bottom left front corner */
|
||||||
Nghost++;
|
ADDGHOST(+1,+1,+1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = +1; PBCy[Nghost] = +1; PBCz[Nghost] = +1;
|
|
||||||
}
|
}
|
||||||
} else if (y[i] >= (yprd-Cutneigh) && z[i] < Cutneigh) { /* bottom left back corner */
|
} else if (y[i] >= (yprd-Cutneigh) && z[i] < Cutneigh) { /* bottom left back corner */
|
||||||
Nghost++;
|
ADDGHOST(+1,-1,+1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = +1; PBCy[Nghost] = -1; PBCz[Nghost] = +1;
|
|
||||||
} else if (z[i] >= (zprd-Cutneigh)) { /* top left edge */
|
} else if (z[i] >= (zprd-Cutneigh)) { /* top left edge */
|
||||||
Nghost++;
|
ADDGHOST(+1,0,-1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = +1; PBCy[Nghost] = 0; PBCz[Nghost] = -1;
|
|
||||||
|
|
||||||
if (y[i] < Cutneigh) { /* bottom left front corner */
|
if (y[i] < Cutneigh) { /* bottom left front corner */
|
||||||
Nghost++;
|
ADDGHOST(+1,+1,-1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = +1; PBCy[Nghost] = +1; PBCz[Nghost] = -1;
|
|
||||||
}
|
}
|
||||||
} else if (y[i] >= (yprd-Cutneigh) && z[i] >= (zprd-Cutneigh)) { /* top left back corner */
|
} else if (y[i] >= (yprd-Cutneigh) && z[i] >= (zprd-Cutneigh)) { /* top left back corner */
|
||||||
Nghost++;
|
ADDGHOST(+1,-1,-1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = +1; PBCy[Nghost] = -1; PBCz[Nghost] = -1;
|
|
||||||
}
|
}
|
||||||
} else if (x[i] >= (xprd-Cutneigh)) { /* right plane */
|
} else if (x[i] >= (xprd-Cutneigh)) { /* right plane */
|
||||||
Nghost++;
|
ADDGHOST(-1,0,0);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = -1; PBCy[Nghost] = 0; PBCz[Nghost] = 0;
|
|
||||||
|
|
||||||
/* treat corners */
|
/* treat edges and corners */
|
||||||
if (y[i] < Cutneigh && z[i] < Cutneigh) { /* bottom right front corner */
|
if (z[i] < Cutneigh) { /* bottom right edge */
|
||||||
Nghost++;
|
ADDGHOST(-1,0,+1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = -1; PBCy[Nghost] = +1; PBCz[Nghost] = +1;
|
if (y[i] < Cutneigh) { /* bottom right front corner */
|
||||||
|
ADDGHOST(-1,+1,+1);
|
||||||
|
}
|
||||||
} else if (y[i] >= (yprd-Cutneigh) && z[i] < Cutneigh) { /* bottom right back corner */
|
} else if (y[i] >= (yprd-Cutneigh) && z[i] < Cutneigh) { /* bottom right back corner */
|
||||||
Nghost++;
|
ADDGHOST(-1,-1,+1);
|
||||||
BorderMap[Nghost] = i;
|
} else if (z[i] >= (zprd-Cutneigh)) { /* top right edge */
|
||||||
PBCx[Nghost] = -1; PBCy[Nghost] = -1; PBCz[Nghost] = +1;
|
ADDGHOST(-1,0,-1);
|
||||||
} else if (y[i] < Cutneigh && z[i] >= (zprd-Cutneigh)) { /* top right front corner */
|
|
||||||
Nghost++;
|
if (y[i] < Cutneigh) { /* top right front corner */
|
||||||
BorderMap[Nghost] = i;
|
ADDGHOST(-1,+1,-1);
|
||||||
PBCx[Nghost] = -1; PBCy[Nghost] = +1; PBCz[Nghost] = -1;
|
}
|
||||||
} else if (y[i] >= (yprd-Cutneigh) && z[i] >= (zprd-Cutneigh)) { /* top right back corner */
|
} else if (y[i] >= (yprd-Cutneigh) && z[i] >= (zprd-Cutneigh)) { /* top right back corner */
|
||||||
Nghost++;
|
ADDGHOST(-1,-1,-1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = -1; PBCy[Nghost] = -1; PBCz[Nghost] = -1;
|
|
||||||
}
|
}
|
||||||
} else if (y[i] < Cutneigh) { /* front plane */
|
} else if (y[i] < Cutneigh) { /* front plane */
|
||||||
Nghost++;
|
ADDGHOST(0,+1,0);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = 0; PBCy[Nghost] = +1; PBCz[Nghost] = 0;
|
if (z[i] < Cutneigh) { /* bottom front edge */
|
||||||
|
ADDGHOST(0,+1,+1);
|
||||||
|
} else if (z[i] >= (zprd-Cutneigh)) { /* top front edge */
|
||||||
|
ADDGHOST(0,+1,-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x[i] < Cutneigh) { /* left front edge */
|
||||||
|
ADDGHOST(+1,+1,0);
|
||||||
|
} else if (x[i] >= (xprd-Cutneigh)) { /* right front edge */
|
||||||
|
ADDGHOST(+1,-1,0);
|
||||||
|
}
|
||||||
} else if (y[i] >= (yprd-Cutneigh)) { /* back plane */
|
} else if (y[i] >= (yprd-Cutneigh)) { /* back plane */
|
||||||
Nghost++;
|
ADDGHOST(0,-1,0);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = 0; PBCy[Nghost] = -1; PBCz[Nghost] = 0;
|
if (z[i] < Cutneigh) { /* bottom back edge */
|
||||||
|
ADDGHOST(0,-1,+1);
|
||||||
|
} else if (z[i] >= (zprd-Cutneigh)) { /* top back edge */
|
||||||
|
ADDGHOST(0,-1,-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x[i] < Cutneigh) { /* left back edge */
|
||||||
|
ADDGHOST(-1,+1,0);
|
||||||
|
} else if (x[i] >= (xprd-Cutneigh)) { /* right back edge */
|
||||||
|
ADDGHOST(-1,-1,0);
|
||||||
|
}
|
||||||
} else if (z[i] < Cutneigh) { /* bottom plane */
|
} else if (z[i] < Cutneigh) { /* bottom plane */
|
||||||
Nghost++;
|
ADDGHOST(0,0,+1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = 0; PBCy[Nghost] = 0; PBCz[Nghost] = +1;
|
|
||||||
} else if (z[i] >= (zprd-Cutneigh)) { /* top plane */
|
} else if (z[i] >= (zprd-Cutneigh)) { /* top plane */
|
||||||
Nghost++;
|
ADDGHOST(0,0,-1);
|
||||||
BorderMap[Nghost] = i;
|
|
||||||
PBCx[Nghost] = 0; PBCy[Nghost] = 0; PBCz[Nghost] = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// increase by one to make it the count
|
// increase by one to make it the ghost count
|
||||||
Nghost++;
|
Nghost++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,15 +1260,15 @@ void printAtomState()
|
|||||||
double min = -Cutneigh;
|
double min = -Cutneigh;
|
||||||
double max = xprd + Cutneigh;
|
double max = xprd + Cutneigh;
|
||||||
|
|
||||||
for (int i=0; i<nall; i++) {
|
/* for (int i=0; i<nall; i++) { */
|
||||||
printf("%d %f %f %f\n", i, x[i], y[i], z[i]);
|
/* printf("%d %f %f %f\n", i, x[i], y[i], z[i]); */
|
||||||
|
|
||||||
if ( x[i] < min || x[i] > max ||
|
/* if ( x[i] < min || x[i] > max || */
|
||||||
y[i] < min || y[i] > max ||
|
/* y[i] < min || y[i] > max || */
|
||||||
z[i] < min || z[i] > max) {
|
/* z[i] < min || z[i] > max) { */
|
||||||
printf("OOB!!\n");
|
/* printf("OOB!!\n"); */
|
||||||
}
|
/* } */
|
||||||
}
|
/* } */
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
@ -1284,9 +1283,9 @@ int main (int argc, char** argv)
|
|||||||
thermoSetup(¶m, &thermo);
|
thermoSetup(¶m, &thermo);
|
||||||
adjustVelocity(¶m, &thermo);
|
adjustVelocity(¶m, &thermo);
|
||||||
setupBorders();
|
setupBorders();
|
||||||
/* updateBorders(); */
|
updateBorders();
|
||||||
printAtomState();
|
/* printAtomState(); */
|
||||||
exit(EXIT_SUCCESS);
|
/* exit(EXIT_SUCCESS); */
|
||||||
buildNeighborlist(&neighbor);
|
buildNeighborlist(&neighbor);
|
||||||
thermoCompute(0, ¶m, &thermo);
|
thermoCompute(0, ¶m, &thermo);
|
||||||
computeForce(&neighbor, ¶m);
|
computeForce(&neighbor, ¶m);
|
||||||
@ -1297,6 +1296,7 @@ int main (int argc, char** argv)
|
|||||||
updateBorders();
|
updateBorders();
|
||||||
|
|
||||||
if(!((n + 1) % neighbor.every)) {
|
if(!((n + 1) % neighbor.every)) {
|
||||||
|
printf("Reneighbor at %d\n",n);
|
||||||
updateAtomLocations();
|
updateAtomLocations();
|
||||||
setupBorders();
|
setupBorders();
|
||||||
updateBorders();
|
updateBorders();
|
||||||
@ -1310,7 +1310,7 @@ int main (int argc, char** argv)
|
|||||||
if(thermo.nstat) {
|
if(thermo.nstat) {
|
||||||
thermoCompute(n + 1, ¶m, &thermo);
|
thermoCompute(n + 1, ¶m, &thermo);
|
||||||
}
|
}
|
||||||
printf("x[0] = %f\n", x[0]);
|
printf("x = %f %f %f\n", x[0], y[0], z[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
thermoCompute(-1, ¶m, &thermo);
|
thermoCompute(-1, ¶m, &thermo);
|
||||||
|
Loading…
Reference in New Issue
Block a user