Adjust kernels to work with MxN loops
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
parent
85e7954932
commit
5fd2d422ee
@ -61,7 +61,7 @@ double computeForceLJ(Parameter *param, Atom *atom, Neighbor *neighbor, Stats *s
|
||||
for(int k = 0; k < numneighs; k++) {
|
||||
int cj = neighs[k];
|
||||
MD_FLOAT *cjptr = cluster_pos_ptr(cj);
|
||||
for(int cii = 0; cii < atom->clusters[ci].natoms; cii++) {
|
||||
for(int cii = 0; cii < CLUSTER_DIM_M; cii++) {
|
||||
MD_FLOAT xtmp = cluster_x(ciptr, cii);
|
||||
MD_FLOAT ytmp = cluster_y(ciptr, cii);
|
||||
MD_FLOAT ztmp = cluster_z(ciptr, cii);
|
||||
@ -69,7 +69,7 @@ double computeForceLJ(Parameter *param, Atom *atom, Neighbor *neighbor, Stats *s
|
||||
MD_FLOAT fiy = 0;
|
||||
MD_FLOAT fiz = 0;
|
||||
|
||||
for(int cjj = 0; cjj < atom->clusters[cj].natoms; cjj++) {
|
||||
for(int cjj = 0; cjj < CLUSTER_DIM_N; cjj++) {
|
||||
if(ci != cj || cii != cjj) {
|
||||
MD_FLOAT delx = xtmp - cluster_x(cjptr, cjj);
|
||||
MD_FLOAT dely = ytmp - cluster_y(cjptr, cjj);
|
||||
|
@ -44,7 +44,7 @@ void initPbc(Atom* atom) {
|
||||
|
||||
/* update coordinates of ghost atoms */
|
||||
/* uses mapping created in setupPbc */
|
||||
void updatePbc(Atom *atom, Parameter *param, int updateBoundingBoxes) {
|
||||
void updatePbc(Atom *atom, Parameter *param, int firstUpdate) {
|
||||
int *border_map = atom->border_map;
|
||||
int nlocal = atom->Nclusters_local;
|
||||
MD_FLOAT xprd = param->xprd;
|
||||
@ -68,7 +68,7 @@ void updatePbc(Atom *atom, Parameter *param, int updateBoundingBoxes) {
|
||||
cluster_y(cptr, cii) = ytmp;
|
||||
cluster_z(cptr, cii) = ztmp;
|
||||
|
||||
if(updateBoundingBoxes) {
|
||||
if(firstUpdate) {
|
||||
// TODO: To create the bounding boxes faster, we can use SIMD operations
|
||||
if(bbminx > xtmp) { bbminx = xtmp; }
|
||||
if(bbmaxx < xtmp) { bbmaxx = xtmp; }
|
||||
@ -79,7 +79,13 @@ void updatePbc(Atom *atom, Parameter *param, int updateBoundingBoxes) {
|
||||
}
|
||||
}
|
||||
|
||||
if(updateBoundingBoxes) {
|
||||
if(firstUpdate) {
|
||||
for(int cii = atom->clusters[ci].natoms; cii < CLUSTER_DIM_M; cii++) {
|
||||
cluster_x(cptr, cii) = INFINITY;
|
||||
cluster_y(cptr, cii) = INFINITY;
|
||||
cluster_z(cptr, cii) = INFINITY;
|
||||
}
|
||||
|
||||
atom->clusters[ci].bbminx = bbminx;
|
||||
atom->clusters[ci].bbmaxx = bbmaxx;
|
||||
atom->clusters[ci].bbminy = bbminy;
|
||||
|
Loading…
Reference in New Issue
Block a user