Linked-cell - static protein + buffer gas:

I have a simulation involving a static protein hit by a gas (He for example). I want to calculate the LJ potential between the gas and the protein atoms using the linked-cell algorithm. My problem is that the neighbors are not being scanned correctly. Below the piece of my code where I am trying to identify the neighbors:

We have the gas (He) coordinates: mc[0] = x, mc[1] = y and mc[2] = z.

With this we can obtain the cell index for the gas:

/* Translate the vector cell index, mc, to a scalar cell index */

c = mc[0]*lcyz+mc[1]*lc[2]+mc[2];

And then scan the neighbor cells:

/* Skip this cell if empty */

if (head[c] == EMPTY) continue;

/* Scan the neighbor cells (including itself) of cell c */

for (mc1[0]=mc[0]-1; mc1[0]

Similar questions and discussions