From 068898765ab5f03b49fc7f4e7361f185a40cf449 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 13 May 2016 15:10:26 -0400 Subject: [PATCH] second round of making per-atom allocations consistent. now all sections that dimension per-atom local arrays to atom->nmax will also *test* for atom->nmax and thus we avoid potential segfaults in all cases where atom->nlocal or atom->nlocal+atom->nghost are 0. it doesn't make sense to test for these if the arrays are dimensioned to atom->nmax afterwards anyway. --- src/CORESHELL/compute_temp_cs.cpp | 2 +- src/MC/fix_atom_swap.cpp | 4 ++-- src/MC/fix_gcmc.cpp | 2 +- src/MISC/fix_efield.cpp | 2 +- src/REPLICA/verlet_split.cpp | 2 +- src/SNAP/compute_snad_atom.cpp | 2 +- src/SNAP/compute_snav_atom.cpp | 2 +- src/USER-EFF/compute_temp_deform_eff.cpp | 2 +- src/USER-EFF/compute_temp_region_eff.cpp | 2 +- src/USER-EFF/fix_langevin_eff.cpp | 6 +++--- src/USER-MISC/compute_temp_rotate.cpp | 4 ++-- src/USER-MISC/fix_ave_spatial_sphere.cpp | 4 ++-- src/USER-SMD/fix_smd_setvel.cpp | 2 +- src/USER-VTK/dump_custom_vtk.cpp | 2 +- src/VORONOI/compute_voronoi_atom.cpp | 4 ++-- src/compute_chunk_atom.cpp | 2 +- src/compute_cluster_atom.cpp | 2 +- src/compute_reduce.cpp | 2 +- src/compute_reduce_region.cpp | 2 +- src/compute_temp_deform.cpp | 2 +- src/compute_temp_partial.cpp | 2 +- src/compute_temp_profile.cpp | 2 +- src/compute_temp_ramp.cpp | 2 +- src/compute_temp_region.cpp | 2 +- src/dump_custom.cpp | 2 +- src/dump_image.cpp | 2 +- src/fix_addforce.cpp | 2 +- src/fix_ave_chunk.cpp | 2 +- src/fix_ave_histo.cpp | 2 +- src/fix_ave_histo_weight.cpp | 4 ++-- src/fix_ave_spatial.cpp | 4 ++-- src/fix_heat.cpp | 2 +- src/fix_langevin.cpp | 4 ++-- src/fix_move.cpp | 2 +- src/fix_setforce.cpp | 2 +- src/neighbor.cpp | 6 +++--- 36 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index b10a9256b8..d0ff5d290d 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -309,7 +309,7 @@ void ComputeTempCS::vcm_pairs() int nlocal = atom->nlocal; - if (nlocal > maxatom) { + if (atom->nmax > maxatom) { memory->destroy(vint); maxatom = atom->nmax; memory->create(vint,maxatom,3,"temp/cs:vint"); diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index 689aa0a168..41a54a64ff 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -584,7 +584,7 @@ void FixAtomSwap::update_semi_grand_atoms_list() int nlocal = atom->nlocal; double **x = atom->x; - if (nlocal > atom_swap_nmax) { + if (atom->nmax > atom_swap_nmax) { memory->sfree(local_swap_atom_list); atom_swap_nmax = atom->nmax; local_swap_atom_list = (int *) memory->smalloc(atom_swap_nmax*sizeof(int), @@ -639,7 +639,7 @@ void FixAtomSwap::update_swap_atoms_list() int *type = atom->type; double **x = atom->x; - if (nlocal > atom_swap_nmax) { + if (atom->nmax > atom_swap_nmax) { memory->sfree(local_swap_iatom_list); memory->sfree(local_swap_jatom_list); atom_swap_nmax = atom->nmax; diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 3d025e12fd..18917a74a9 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -2190,7 +2190,7 @@ void FixGCMC::update_gas_atoms_list() tagint *molecule = atom->molecule; double **x = atom->x; - if (nlocal > gcmc_nmax) { + if (atom->nmax > gcmc_nmax) { memory->sfree(local_gas_list); gcmc_nmax = atom->nmax; local_gas_list = (int *) memory->smalloc(gcmc_nmax*sizeof(int), diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index d729b9b74a..2151a05092 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -254,7 +254,7 @@ void FixEfield::post_force(int vflag) // reallocate efield array if necessary - if (varflag == ATOM && nlocal > maxatom) { + if (varflag == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(efield); memory->create(efield,maxatom,4,"efield:efield"); diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index 5985c756ad..80d8f58f0d 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -444,7 +444,7 @@ void VerletSplit::rk_setup() // grow f_kspace array on master procs if necessary if (master) { - if (atom->nlocal > maxatom) { + if (atom->nmax > maxatom) { memory->destroy(f_kspace); maxatom = atom->nmax; memory->create(f_kspace,maxatom,3,"verlet/split:f_kspace"); diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index 8767ca1745..2164b31029 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -179,7 +179,7 @@ void ComputeSNADAtom::compute_peratom() // grow snad array if necessary - if (ntotal > nmax) { + if (atom->nmax > nmax) { memory->destroy(snad); nmax = atom->nmax; memory->create(snad,nmax,size_peratom_cols, diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index cbe53821b8..29431f29a9 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -182,7 +182,7 @@ void ComputeSNAVAtom::compute_peratom() // grow snav array if necessary - if (ntotal > nmax) { + if (atom->nmax > nmax) { memory->destroy(snav); nmax = atom->nmax; memory->create(snav,nmax,size_peratom_cols, diff --git a/src/USER-EFF/compute_temp_deform_eff.cpp b/src/USER-EFF/compute_temp_deform_eff.cpp index 12c72479cb..40e8e529c0 100644 --- a/src/USER-EFF/compute_temp_deform_eff.cpp +++ b/src/USER-EFF/compute_temp_deform_eff.cpp @@ -264,7 +264,7 @@ void ComputeTempDeformEff::remove_bias_all() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/deform/eff:vbiasall"); diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index 1035a3e31b..c0cd56f3a8 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -237,7 +237,7 @@ void ComputeTempRegionEff::remove_bias_all() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/region:vbiasall"); diff --git a/src/USER-EFF/fix_langevin_eff.cpp b/src/USER-EFF/fix_langevin_eff.cpp index f2ca444de2..9584623fc3 100644 --- a/src/USER-EFF/fix_langevin_eff.cpp +++ b/src/USER-EFF/fix_langevin_eff.cpp @@ -104,7 +104,7 @@ void FixLangevinEff::post_force_no_tally() error->one(FLERR,"Fix langevin/eff variable returned negative temperature"); tsqrt = sqrt(t_target); } else { - if (nlocal > maxatom2) { + if (atom->nmax > maxatom2) { maxatom2 = atom->nmax; memory->destroy(tforce); memory->create(tforce,maxatom2,"langevin/eff:tforce"); @@ -241,7 +241,7 @@ void FixLangevinEff::post_force_tally() // reallocate flangevin and erforcelangevin if necessary - if (atom->nlocal > maxatom1) { + if (atom->nmax > maxatom1) { memory->destroy(flangevin); memory->destroy(erforcelangevin); maxatom1 = atom->nmax; @@ -279,7 +279,7 @@ void FixLangevinEff::post_force_tally() error->one(FLERR,"Fix langevin/eff variable returned negative temperature"); tsqrt = sqrt(t_target); } else { - if (nlocal > maxatom2) { + if (atom->nmax > maxatom2) { maxatom2 = atom->nmax; memory->destroy(tforce); memory->create(tforce,maxatom2,"langevin/eff:tforce"); diff --git a/src/USER-MISC/compute_temp_rotate.cpp b/src/USER-MISC/compute_temp_rotate.cpp index 8fd2b774ae..b948738e00 100644 --- a/src/USER-MISC/compute_temp_rotate.cpp +++ b/src/USER-MISC/compute_temp_rotate.cpp @@ -112,7 +112,7 @@ double ComputeTempRotate::compute_scalar() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/rotate:vbiasall"); @@ -175,7 +175,7 @@ void ComputeTempRotate::compute_vector() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/rotate:vbiasall"); diff --git a/src/USER-MISC/fix_ave_spatial_sphere.cpp b/src/USER-MISC/fix_ave_spatial_sphere.cpp index 77a5d48960..dd89d38779 100644 --- a/src/USER-MISC/fix_ave_spatial_sphere.cpp +++ b/src/USER-MISC/fix_ave_spatial_sphere.cpp @@ -605,7 +605,7 @@ void FixAveSpatialSphere::end_of_step() int *mask= atom->mask; int nlocal= atom->nlocal; - if (nlocal > maxatom) { + if (atom->nmax > maxatom) { maxatom= atom->nmax; memory->destroy(bin); memory->create(bin,maxatom,"ave/spatial/sphere:bin"); @@ -684,7 +684,7 @@ void FixAveSpatialSphere::end_of_step() else values_one[bin[i]][m] += array[i][jm1]; } } else if(which[m] == VARIABLE) { - if (nlocal > maxvar) { + if (atom->nmax > maxvar) { maxvar = atom->nmax; memory->destroy(varatom); memory->create(varatom,maxvar,"ave/spatial:varatom"); diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index 30ebbeb332..568ffb7977 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -257,7 +257,7 @@ void FixSMDSetVel::post_force(int vflag) { // reallocate sforce array if necessary - if (varflag == ATOM && nlocal > maxatom) { + if (varflag == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(sforce); memory->create(sforce, maxatom, 3, "setvelocity:sforce"); diff --git a/src/USER-VTK/dump_custom_vtk.cpp b/src/USER-VTK/dump_custom_vtk.cpp index 8db751e291..0e4bc45976 100644 --- a/src/USER-VTK/dump_custom_vtk.cpp +++ b/src/USER-VTK/dump_custom_vtk.cpp @@ -266,7 +266,7 @@ int DumpCustomVTK::count() // grow choose and variable vbuf arrays if needed int nlocal = atom->nlocal; - if (nlocal > maxlocal) { + if (atom->nmax > maxlocal) { maxlocal = atom->nmax; memory->destroy(choose); diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index a2d492743f..f4f48fd5e8 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -319,7 +319,7 @@ void ComputeVoronoi::buildCells() if (!input->variable->atomstyle(radvar)) error->all(FLERR,"Variable for voronoi radius is not atom style"); // prepare destination buffer for variable evaluation - if (nlocal > rmax) { + if (atom->nmax > rmax) { memory->destroy(rfield); rmax = atom->nmax; memory->create(rfield,rmax,"voronoi/atom:rfield"); @@ -378,7 +378,7 @@ void ComputeVoronoi::checkOccupation() **x = atom->x; // prepare destination buffer for variable evaluation - if (nall > lmax) { + if (atom->nmax > lmax) { memory->destroy(lnext); lmax = atom->nmax; memory->create(lnext,lmax,"voronoi/atom:lnext"); diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index 166546233b..4d9a5f2275 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -988,7 +988,7 @@ void ComputeChunkAtom::assign_chunk_ids() } } else if (which == VARIABLE) { - if (nlocal > maxvar) { + if (atom->nmax > maxvar) { maxvar = atom->nmax; memory->destroy(varatom); memory->create(varatom,maxvar,"chunk/atom:varatom"); diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index ade4ce5d87..c81785f215 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -104,7 +104,7 @@ void ComputeClusterAtom::compute_peratom() // grow clusterID array if necessary - if (atom->nlocal+atom->nghost > nmax) { + if (atom->nmax > nmax) { memory->destroy(clusterID); nmax = atom->nmax; memory->create(clusterID,nmax,"cluster/atom:clusterID"); diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index 47d85332be..a56770569f 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -574,7 +574,7 @@ double ComputeReduce::compute_one(int m, int flag) // evaluate atom-style variable } else if (which[m] == VARIABLE) { - if (nlocal > maxatom) { + if (atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(varatom); memory->create(varatom,maxatom,"reduce:varatom"); diff --git a/src/compute_reduce_region.cpp b/src/compute_reduce_region.cpp index c098942c75..c867a0190c 100644 --- a/src/compute_reduce_region.cpp +++ b/src/compute_reduce_region.cpp @@ -200,7 +200,7 @@ double ComputeReduceRegion::compute_one(int m, int flag) // evaluate atom-style variable } else if (which[m] == VARIABLE) { - if (nlocal > maxatom) { + if (atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(varatom); memory->create(varatom,maxatom,"reduce/region:varatom"); diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index 980973da5e..c8b8200770 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -251,7 +251,7 @@ void ComputeTempDeform::remove_bias_all() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/deform:vbiasall"); diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index 12a5dd7119..9df8e8b580 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -215,7 +215,7 @@ void ComputeTempPartial::remove_bias_all() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/partial:vbiasall"); diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index 1e57693d7d..bc61c44458 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -516,7 +516,7 @@ void ComputeTempProfile::bin_assign() { // reallocate bin array if necessary - if (atom->nlocal > maxatom) { + if (atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(bin); memory->create(bin,maxatom,"temp/profile:bin"); diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index 9b4ee133a0..af6a730c9d 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -257,7 +257,7 @@ void ComputeTempRamp::remove_bias_all() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/ramp:vbiasall"); diff --git a/src/compute_temp_region.cpp b/src/compute_temp_region.cpp index 74ffd130f6..f8e0317fe9 100644 --- a/src/compute_temp_region.cpp +++ b/src/compute_temp_region.cpp @@ -226,7 +226,7 @@ void ComputeTempRegion::remove_bias_all() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxbias) { + if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; memory->create(vbiasall,maxbias,3,"temp/region:vbiasall"); diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 68097e543d..1e7356d0a1 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -386,7 +386,7 @@ int DumpCustom::count() // grow choose and variable vbuf arrays if needed int nlocal = atom->nlocal; - if (nlocal > maxlocal) { + if (atom->nmax > maxlocal) { maxlocal = atom->nmax; memory->destroy(choose); diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 2ab9e84467..b9ff534c66 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -901,7 +901,7 @@ void DumpImage::create_image() // communicate choose flag for ghost atoms to know if they are selected // if bcolor/bdiam = ATOM, setup bufcopy to comm atom color/diam attributes - if (nall > maxbufcopy) { + if (atom->nmax > maxbufcopy) { maxbufcopy = atom->nmax; memory->destroy(chooseghost); memory->create(chooseghost,maxbufcopy,"dump:chooseghost"); diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 0ffa7751cd..2b5c682266 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -251,7 +251,7 @@ void FixAddForce::post_force(int vflag) // reallocate sforce array if necessary - if ((varflag == ATOM || estyle == ATOM) && nlocal > maxatom) { + if ((varflag == ATOM || estyle == ATOM) && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(sforce); memory->create(sforce,maxatom,4,"addforce:sforce"); diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index ff6210d215..8390e8bbad 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -721,7 +721,7 @@ void FixAveChunk::end_of_step() // evaluate atom-style variable } else if (which[m] == VARIABLE) { - if (nlocal > maxvar) { + if (atom->nmax > maxvar) { maxvar = atom->nmax; memory->destroy(varatom); memory->create(varatom,maxvar,"ave/chunk:varatom"); diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 902934be0f..9123a8561f 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -754,7 +754,7 @@ void FixAveHisto::end_of_step() bin_vector(nvec,varvec,1); } else if (which[i] == VARIABLE && kind == PERATOM) { - if (atom->nlocal > maxatom) { + if (atom->nmax > maxatom) { memory->destroy(vector); maxatom = atom->nmax; memory->create(vector,maxatom,"ave/histo:vector"); diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 47901a5164..8671a38a93 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -256,7 +256,7 @@ void FixAveHistoWeight::end_of_step() weight = input->variable->compute_equal(m); } else if (which[i] == VARIABLE && kind == PERATOM) { - if (atom->nlocal > maxatom) { + if (atom->nmax > maxatom) { memory->destroy(vector); maxatom = atom->nmax; memory->create(vector,maxatom,"ave/histo/weight:vector"); @@ -385,7 +385,7 @@ void FixAveHistoWeight::end_of_step() bin_one_weights(input->variable->compute_equal(m),weight); } else if (which[i] == VARIABLE && kind == PERATOM) { - if (atom->nlocal > maxatom) { + if (atom->nmax > maxatom) { memory->destroy(vector); maxatom = atom->nmax; memory->create(vector,maxatom,"ave/histo/weight:vector"); diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index bf32065e22..2a72090741 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -585,7 +585,7 @@ void FixAveSpatial::end_of_step() int *mask = atom->mask; int nlocal = atom->nlocal; - if (nlocal > maxatom) { + if (atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(bin); memory->create(bin,maxatom,"ave/spatial:bin"); @@ -716,7 +716,7 @@ void FixAveSpatial::end_of_step() // evaluate atom-style variable } else if (which[m] == VARIABLE) { - if (nlocal > maxvar) { + if (atom->nmax > maxvar) { maxvar = atom->nmax; memory->destroy(varatom); memory->create(varatom,maxvar,"ave/spatial:varatom"); diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index 65dc960f42..0609d45efb 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -153,7 +153,7 @@ void FixHeat::end_of_step() // reallocate per-atom arrays if necessary - if (hstyle == ATOM && atom->nlocal > maxatom) { + if (hstyle == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(vheat); memory->destroy(vscale); diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 9e857339b4..ff8d4f1840 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -511,7 +511,7 @@ void FixLangevin::post_force_untemplated // reallocate flangevin if necessary if (Tp_TALLY) { - if (atom->nlocal > maxatom1) { + if (atom->nmax > maxatom1) { memory->destroy(flangevin); maxatom1 = atom->nmax; memory->create(flangevin,maxatom1,3,"langevin:flangevin"); @@ -641,7 +641,7 @@ void FixLangevin::compute_target() error->one(FLERR,"Fix langevin variable returned negative temperature"); tsqrt = sqrt(t_target); } else { - if (nlocal > maxatom2) { + if (atom->nmax > maxatom2) { maxatom2 = atom->nmax; memory->destroy(tforce); memory->create(tforce,maxatom2,"langevin:tforce"); diff --git a/src/fix_move.cpp b/src/fix_move.cpp index ca3727520c..592419cc1e 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -726,7 +726,7 @@ void FixMove::initial_integrate(int vflag) // reallocate displace and velocity arrays as necessary - if ((displaceflag || velocityflag) && nlocal > maxatom) { + if ((displaceflag || velocityflag) && atom->nmax > maxatom) { maxatom = atom->nmax; if (displaceflag) { memory->destroy(displace); diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index aff8f117c5..d73ab0db63 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -231,7 +231,7 @@ void FixSetForce::post_force(int vflag) // reallocate sforce array if necessary - if (varflag == ATOM && nlocal > maxatom) { + if (varflag == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(sforce); memory->create(sforce,maxatom,3,"setforce:sforce"); diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 84a52f0405..ed25d3a829 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1539,7 +1539,7 @@ void Neighbor::build(int topoflag) double **x = atom->x; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; - if (nlocal > maxhold) { + if (atom->nmax > maxhold) { maxhold = atom->nmax; memory->destroy(xhold); memory->create(xhold,maxhold,3,"neigh:xhold"); @@ -1574,10 +1574,10 @@ void Neighbor::build(int topoflag) // else only invoke grow() if nlocal exceeds previous list size // only for lists with growflag set and which are perpetual (glist) - if (anyghostlist && atom->nlocal+atom->nghost > maxatom) { + if (anyghostlist && atom->nmax > maxatom) { maxatom = atom->nmax; for (i = 0; i < nglist; i++) lists[glist[i]]->grow(maxatom); - } else if (atom->nlocal > maxatom) { + } else if (atom->nmax > maxatom) { maxatom = atom->nmax; for (i = 0; i < nglist; i++) lists[glist[i]]->grow(maxatom); }