Skip to content

Commit

Permalink
Merge pull request #1 from timattox/new-neighbor
Browse files Browse the repository at this point in the history
USER-DPD workaround for neighbor list issues
  • Loading branch information
stanmoore1 authored Dec 9, 2016
2 parents 43c459b + 586514e commit 0f3b254
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
23 changes: 19 additions & 4 deletions src/USER-DPD/fix_shardlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "random_mars.h"
#include "memory.h"
#include "domain.h"
Expand Down Expand Up @@ -139,6 +140,23 @@ int FixShardlow::setmask()

/* ---------------------------------------------------------------------- */

void FixShardlow::init()
{
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->fix = 1;
neighbor->requests[irequest]->ssa = 1;
}

/* ---------------------------------------------------------------------- */

void FixShardlow::init_list(int id, NeighList *ptr)
{
list = ptr;
}

/* ---------------------------------------------------------------------- */

void FixShardlow::pre_exchange()
{
memset(atom->ssaAIR, 0, sizeof(int)*atom->nlocal);
Expand Down Expand Up @@ -410,7 +428,6 @@ void FixShardlow::initial_integrate(int vflag)
int nghost = atom->nghost;

int airnum;
class NeighList *list; // points to list in pairDPD or pairDPDE
class RanMars *pRNG;

// NOTE: this logic is specific to orthogonal boxes, not triclinic
Expand All @@ -431,12 +448,10 @@ void FixShardlow::initial_integrate(int vflag)
// Allocate memory for v_t0 to hold the initial velocities for the ghosts
v_t0 = (double (*)[3]) memory->smalloc(sizeof(double)*3*nghost, "FixShardlow:v_t0");

// Define pointers to access the neighbor list and RNG
// Define pointers to access the RNG
if(pairDPDE){
list = pairDPDE->list;
pRNG = pairDPDE->random;
} else {
list = pairDPD->list;
pRNG = pairDPD->random;
}
inum = list->inum;
Expand Down
4 changes: 4 additions & 0 deletions src/USER-DPD/fix_shardlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ namespace LAMMPS_NS {

class FixShardlow : public Fix {
public:
class NeighList *list; // The SSA specific neighbor list

FixShardlow(class LAMMPS *, int, char **);
~FixShardlow();
int setmask();
virtual void init();
virtual void init_list(int, class NeighList *);
virtual void setup(int);
virtual void initial_integrate(int);
void setup_pre_exchange();
Expand Down
2 changes: 0 additions & 2 deletions src/USER-DPD/pair_dpd_fdt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,9 @@ void PairDPDfdt::init_style()

splitFDT_flag = false;
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->ssa = 0;
for (int i = 0; i < modify->nfix; i++)
if (strcmp(modify->fix[i]->style,"shardlow") == 0){
splitFDT_flag = true;
neighbor->requests[irequest]->ssa = 1;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/USER-DPD/pair_dpd_fdt_energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,9 @@ void PairDPDfdtEnergy::init_style()

splitFDT_flag = false;
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->ssa = 0;
for (int i = 0; i < modify->nfix; i++)
if (strcmp(modify->fix[i]->style,"shardlow") == 0){
splitFDT_flag = true;
neighbor->requests[irequest]->ssa = 1;
}

bool eos_flag = false;
Expand Down
2 changes: 2 additions & 0 deletions src/neighbor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ void Neighbor::init_pair()
for (i = 0; i < nrequest; i++) {
if (!requests[i]->fix && !requests[i]->compute) continue;
for (j = 0; j < nrequest; j++) {
if (requests[i]->ssa != requests[j]->ssa) continue;

// Kokkos flags must match
if (requests[i]->kokkos_device != requests[j]->kokkos_device) continue;
if (requests[i]->kokkos_host != requests[j]->kokkos_host) continue;
Expand Down

0 comments on commit 0f3b254

Please sign in to comment.