Serial md code
#ifndef CELLSH
#define CELLSH
#include "atom.h"
#include "system.h"
#include "forces.h"
static inline int compute_super_cell_index(int x, int y, int z, int minc[], int nc[])
{
return ((z-minc[2])*nc[1]+(y-minc[1]))*nc[0]+(x-minc[0]);
}
static inline int super_cell_index_2_cx(int c, int minc[], int nc[])
{
return (c%(nc[0]))+minc[0];
}
static inline int super_cell_index_2_cy(int c, int minc[], int nc[])
{
return ((c/nc[0])%(nc[1]))+minc[1];
}
static inline int super_cell_index_2_cz(int c, int minc[], int nc[])
{
return (c/(nc[0]*nc[1]))+minc[2];
}
/* Setup cell structure */
void cellDivide(atom_t atoms[], system_t *sys);
/* Function to find pairs with particles in neighboring cells given a cell. */
void findPairsFromOtherCells(interaction_pairs_t* p, system_t* sys,
int ai, int cax, int cay, int caz, int nneighbor_cells);
/* Function to find pairs with particles in neighboring cells given a
set of ghost particles.. */
void findGhostPairsFromCells(interaction_pairs_t* p, int ghost_count, atom_t* ghost_atoms, int ghost_offset, system_t* sys);
/* The function 'findPairsFromCells collects the pairs of particles in
the same or neighboring cells. Output are p->npairs, p->pairi[],
p->pairj[] and p->dj{x,y,z}[], where i=p->pairi[k] and
j=p->pairj[k] are neighbors (k=0..*npairs-1), and the integer
values *dj{x,y,z} indicate if the neighborship is realized through
the boundary conditions, such that the neighbor position for
particle j should be taken as atom[j].rx + djx*Lx (and similar for
y and z). */
void findPairsFromCells(interaction_pairs_t* p, system_t* sys);
#endif