diff --git a/lammps/force_lj.c b/lammps/force_lj.c index f876d06..e6b6ec0 100644 --- a/lammps/force_lj.c +++ b/lammps/force_lj.c @@ -132,7 +132,7 @@ double computeForceLJHalfNeigh(Parameter *param, Atom *atom, Neighbor *neighbor, for(int i = 0; i < Nlocal; i++) { neighs = &neighbor->neighbors[i * neighbor->maxneighs]; - int numneighs = neighbor.numneigh[i]; + int numneighs = neighbor->numneigh[i]; MD_FLOAT xtmp = atom_x(i); MD_FLOAT ytmp = atom_y(i); MD_FLOAT ztmp = atom_z(i); diff --git a/lammps/includes/neighbor.h b/lammps/includes/neighbor.h index 949d515..86df386 100644 --- a/lammps/includes/neighbor.h +++ b/lammps/includes/neighbor.h @@ -31,6 +31,7 @@ typedef struct { int* neighbors; int maxneighs; int* numneigh; + int halfneigh; } Neighbor; extern void initNeighbor(Neighbor*, Parameter*); diff --git a/lammps/main.c b/lammps/main.c index acf4963..bde9abb 100644 --- a/lammps/main.c +++ b/lammps/main.c @@ -72,7 +72,7 @@ void init(Parameter *param) param->dtforce = 0.5 * param->dt; param->every = 20; param->proc_freq = 2.4; - param->halfneigh = 0; + param->halfneigh = 1; } double setup( diff --git a/lammps/neighbor.c b/lammps/neighbor.c index 549ddbc..cac2b1f 100644 --- a/lammps/neighbor.c +++ b/lammps/neighbor.c @@ -232,7 +232,7 @@ void buildNeighbor(Atom *atom, Neighbor *neighbor) for(int m = 0; m < bincount[jbin]; m++) { int j = loc_bin[m]; - if ( j == i ){ + if ( (j == i) || (neighbor->halfneigh && (j < i))) { continue; }