diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 2fc02e5645..7c491fdf23 100755 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -374,7 +374,7 @@ void FixBondCreate::post_integrate() int *mask = atom->mask; int *type = atom->type; - neighbor->build_one(list->index,1); + neighbor->build_one(list,1); inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index b23e32620c..12cb8e639c 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -231,7 +231,7 @@ void FixBondSwap::post_integrate() type = atom->type; x = atom->x; - neighbor->build_one(list->index,1); + neighbor->build_one(list,1); inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 2435d3d7a1..226d351272 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -179,7 +179,7 @@ void FixPeriNeigh::setup(int vflag) // build full neighbor list, will copy or build as necessary - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 39c0ecb07a..9e97182d99 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -268,7 +268,7 @@ void FixQEq::init_list(int id, NeighList *ptr) void FixQEq::setup_pre_force(int vflag) { - neighbor->build_one(list->index); + neighbor->build_one(list); deallocate_storage(); allocate_storage(); diff --git a/src/SNAP/compute_sna_atom.cpp b/src/SNAP/compute_sna_atom.cpp index b77e01c5e2..c055350a88 100644 --- a/src/SNAP/compute_sna_atom.cpp +++ b/src/SNAP/compute_sna_atom.cpp @@ -192,7 +192,7 @@ void ComputeSNAAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); const int inum = list->inum; const int* const ilist = list->ilist; diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index 7039d0dc4b..10e426a3c6 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -196,7 +196,7 @@ void ComputeSNADAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); const int inum = list->inum; const int* const ilist = list->ilist; diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index 76f3d3aa62..d1a0285bc7 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -199,7 +199,7 @@ void ComputeSNAVAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); const int inum = list->inum; const int* const ilist = list->ilist; diff --git a/src/USER-MISC/compute_ackland_atom.cpp b/src/USER-MISC/compute_ackland_atom.cpp index 2c70cf19f0..43e67ac8d2 100644 --- a/src/USER-MISC/compute_ackland_atom.cpp +++ b/src/USER-MISC/compute_ackland_atom.cpp @@ -114,7 +114,7 @@ void ComputeAcklandAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/USER-MISC/compute_basal_atom.cpp b/src/USER-MISC/compute_basal_atom.cpp index abfcaed2b3..4e9ea9e01c 100644 --- a/src/USER-MISC/compute_basal_atom.cpp +++ b/src/USER-MISC/compute_basal_atom.cpp @@ -118,7 +118,7 @@ void ComputeBasalAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 237ddce18c..c6045bfe52 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -408,7 +408,7 @@ void FixQEqReax::init_taper() void FixQEqReax::setup_pre_force(int vflag) { - neighbor->build_one(list->index); + neighbor->build_one(list); deallocate_storage(); allocate_storage(); diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index fa0d3ce4af..5e12791b0a 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -116,7 +116,7 @@ void ComputeCentroAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 91c876ad9e..90137fb7a7 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -113,7 +113,7 @@ void ComputeClusterAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index b053b9fb64..0ebd186237 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -137,7 +137,7 @@ void ComputeCNAAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_contact_atom.cpp b/src/compute_contact_atom.cpp index 492846b130..76abb8d6a1 100644 --- a/src/compute_contact_atom.cpp +++ b/src/compute_contact_atom.cpp @@ -108,7 +108,7 @@ void ComputeContactAtom::compute_peratom() // invoke neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index caa40575ae..11742737dd 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -141,7 +141,7 @@ void ComputeCoordAtom::compute_peratom() // invoke full neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_group_group.cpp b/src/compute_group_group.cpp index 6051075998..a26e72e2e4 100644 --- a/src/compute_group_group.cpp +++ b/src/compute_group_group.cpp @@ -211,7 +211,7 @@ void ComputeGroupGroup::pair_contribution() // invoke half neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index 61ab0cd0d2..51985846a7 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -155,7 +155,7 @@ int ComputePairLocal::compute_pairs(int flag) // invoke half neighbor list (will copy or build if necessary) - if (flag == 0) neighbor->build_one(list->index); + if (flag == 0) neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index 82d85d4bec..d5cc0d73d4 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -346,7 +346,7 @@ int ComputePropertyLocal::count_pairs(int allflag, int forceflag) // invoke half neighbor list (will copy or build if necessary) - if (allflag == 0) neighbor->build_one(list->index); + if (allflag == 0) neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index ca194dc86a..62dbd3b8af 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -186,7 +186,7 @@ void ComputeRDF::compute_array() // invoke half neighbor list (will copy or build if necessary) - neighbor->build_one(list->index); + neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 5be798c586..2732ee1870 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -287,7 +287,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // build neighbor list this command needs based on earlier request NeighList *list = neighbor->lists[irequest]; - neighbor->build_one(irequest); + neighbor->build_one(list); // allocate and initialize deletion list // must be after exchange potentially changes nlocal diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 56f574fd32..1c4116ed22 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1491,31 +1491,36 @@ void Neighbor::build_topology() called by other classes ------------------------------------------------------------------------- */ -void Neighbor::build_one(int i, int preflag) +void Neighbor::build_one(class NeighList *mylist, int preflag) { + // check if list structure is initialized + if (mylist == NULL) + error->all(FLERR,"Trying to build an occasional neighbor list " + "before initialization is completed."); + // no need to build if already built since last re-neighbor // preflag is set by fix bond/create and fix bond/swap // b/c they invoke build_one() on same step neigh list is re-built, // but before re-build, so need to use ">" instead of ">=" if (preflag) { - if (lists[i]->last_build > lastcall) return; + if (mylist->last_build > lastcall) return; } else { - if (lists[i]->last_build >= lastcall) return; + if (mylist->last_build >= lastcall) return; } - lists[i]->last_build = update->ntimestep; + mylist->last_build = update->ntimestep; // update stencils and grow atom arrays as needed // only for relevant settings of stencilflag and growflag // grow atom array for this list to current size of perpetual lists - if (lists[i]->stencilflag) { - lists[i]->stencil_allocate(smax,style); - (this->*stencil_create[i])(lists[i],sx,sy,sz); + if (mylist->stencilflag) { + mylist->stencil_allocate(smax,style); + (this->*stencil_create[mylist->index])(mylist,sx,sy,sz); } - if (lists[i]->growflag) lists[i]->grow(maxatom); + if (mylist->growflag) mylist->grow(maxatom); // build list I, turning off atom binning // binning results from last re-neighbor should be used instead @@ -1523,7 +1528,7 @@ void Neighbor::build_one(int i, int preflag) // leading to errors or even a crash binatomflag = 0; - (this->*pair_build[i])(lists[i]); + (this->*pair_build[mylist->index])(mylist); binatomflag = 1; } diff --git a/src/neighbor.h b/src/neighbor.h index a0271a5e01..51add41c1b 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -78,7 +78,7 @@ class Neighbor : protected Pointers { void setup_bins(); // setup bins based on box and cutoff virtual void build(int topoflag=1); // create all neighbor lists (pair,bond) virtual void build_topology(); // create all topology neighbor lists - void build_one(int, int preflag=0); // create a single neighbor list + void build_one(class NeighList *list, int preflag=0); // create a single neighbor list void set(int, char **); // set neighbor style and skin distance void modify_params(int, char**); // modify parameters that control builds bigint memory_usage();