5 TYPE position_y[nAtoms],
6 TYPE position_z[nAtoms],
10 TYPE delx, dely, delz, r2inv;
11 delx = position_x[i] - position_x[j];
12 dely = position_y[i] - position_y[j];
13 delz = position_z[i] - position_z[j];
14 r2inv = delx * delx + dely * dely + delz * delz;
19 int currList[maxNeighbors],
23 int dist, pos, currList_t;
24 TYPE currMax, currDist_t;
25 pos = maxNeighbors - 1;
26 currMax = currDist[pos];
27 if (distIJ > currMax){
30 for (dist = pos; dist > 0; dist--){
31 if (distIJ < currDist[dist]){
32 currDist[dist] = currDist[dist - 1];
33 currList[dist] = currList[pos - 1];
40 currDist[dist] = distIJ;
45 TYPE position_y[nAtoms],
46 TYPE position_z[nAtoms],
50 int totalPairs, i, j,
k;
53 for (i = 0; i <
nAtoms; i++){
58 currDist[
k] = 999999999;
64 distIJ =
distance(position_x, position_y, position_z, i, j);
74 int currList[maxNeighbors],
78 int idx, validPairs, distanceIter, neighborIter;
79 idx = 0; validPairs = 0;
80 for (neighborIter = 0; neighborIter <
maxNeighbors; neighborIter++){
81 NL[i][neighborIter] = currList[neighborIter];
89 int i, iter, j, totalPairs;
102 int neighborList[size];
105 for (i = 0; i <
nAtoms; i++)
107 position_x[i] = rand();
108 position_y[i] = rand();
109 position_z[i] = rand();
127 neighborList[i*maxNeighbors + j] = NL[i][j];
132 md_kernel(force_x, force_y, force_z, position_x, position_y, position_z, neighborList);
void insertInOrder(TYPE currDist[maxNeighbors], int currList[maxNeighbors], int j, TYPE distIJ)
int buildNeighborList(TYPE position_x[nAtoms], TYPE position_y[nAtoms], TYPE position_z[nAtoms], int NL[nAtoms][maxNeighbors])
static const uint32_t k[]
void md_kernel(TYPE force_x[nAtoms], TYPE force_y[nAtoms], TYPE force_z[nAtoms], TYPE position_x[nAtoms], TYPE position_y[nAtoms], TYPE position_z[nAtoms], int32_t NL[nAtoms *maxNeighbors])
int populateNeighborList(TYPE currDist[maxNeighbors], int currList[maxNeighbors], const int i, int NL[nAtoms][maxNeighbors])
TYPE distance(TYPE position_x[nAtoms], TYPE position_y[nAtoms], TYPE position_z[nAtoms], int i, int j)