diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index cf7a9ecb9d..c6b74b6857 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -327,16 +327,24 @@ void FixEfield::post_force(int vflag) modify->clearstep_compute(); if (xstyle == EQUAL) ex = qe2f * input->variable->compute_equal(xvar); - else if (xstyle == ATOM && efield) - input->variable->compute_atom(xvar,igroup,&efield[0][0],3,0); + else if (xstyle == ATOM) { + if (efield) input->variable->compute_atom(xvar,igroup,&efield[0][0],3,0); + else input->variable->compute_atom(xvar,igroup,NULL,3,0); + } if (ystyle == EQUAL) ey = qe2f * input->variable->compute_equal(yvar); - else if (ystyle == ATOM && efield) - input->variable->compute_atom(yvar,igroup,&efield[0][1],3,0); + else if (ystyle == ATOM) { + if (efield) input->variable->compute_atom(yvar,igroup,&efield[0][1],3,0); + else input->variable->compute_atom(yvar,igroup,NULL,3,0); + } if (zstyle == EQUAL) ez = qe2f * input->variable->compute_equal(zvar); - else if (zstyle == ATOM && efield) - input->variable->compute_atom(zvar,igroup,&efield[0][2],3,0); - if (estyle == ATOM && efield) - input->variable->compute_atom(evar,igroup,&efield[0][3],4,0); + else if (zstyle == ATOM) { + if (efield) input->variable->compute_atom(zvar,igroup,&efield[0][2],3,0); + else input->variable->compute_atom(zvar,igroup,NULL,3,0); + } + if (estyle == ATOM) { + if (efield) input->variable->compute_atom(evar,igroup,&efield[0][3],4,0); + else input->variable->compute_atom(evar,igroup,NULL,4,0); + } modify->addstep_compute(update->ntimestep + 1); diff --git a/src/compute_atom_molecule.cpp b/src/compute_atom_molecule.cpp index 533d80362f..4442a72255 100644 --- a/src/compute_atom_molecule.cpp +++ b/src/compute_atom_molecule.cpp @@ -327,9 +327,9 @@ void ComputeAtomMolecule::compute_one(int m) maxatom = atom->nmax; memory->destroy(scratch); memory->create(scratch,maxatom,"atom/molecule:scratch"); - peratom = scratch; } + peratom = scratch; input->variable->compute_atom(vidx,igroup,peratom,1,0); nstride = 1; } diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index fabf33038e..844a8d118a 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -355,8 +355,10 @@ void FixAveAtom::end_of_step() // evaluate atom-style variable // final argument = 1 sums result to array - } else if (which[m] == VARIABLE && array) - input->variable->compute_atom(n,igroup,&array[0][m],nvalues,1); + } else if (which[m] == VARIABLE) { + if (array) input->variable->compute_atom(n,igroup,&array[0][m],nvalues,1); + else input->variable->compute_atom(n,igroup,NULL,nvalues,1); + } } // done if irepeat < nrepeat diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 0991b7c26a..c44d5b067f 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -464,6 +464,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : bin_list = NULL; vector = NULL; maxatom = 0; + if (ave == WINDOW) { memory->create(stats_list,nwindow,4,"histo:stats_list"); memory->create(bin_list,nwindow,nbins,"ave/histo:bin_list"); diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index 6863576884..014c9a773d 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -468,7 +468,10 @@ void FixStoreState::end_of_step() // evaluate atom-style variable } else if (which[m] == VARIABLE) - input->variable->compute_atom(n,igroup,&values[0][m],nvalues,0); + if (values) + input->variable->compute_atom(n,igroup,&values[0][m],nvalues,0); + else + input->variable->compute_atom(n,igroup,NULL,nvalues,0); } } diff --git a/src/velocity.cpp b/src/velocity.cpp index f27aa57058..043a36690d 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -463,14 +463,20 @@ void Velocity::set(int narg, char **arg) } else { if (xstyle == EQUAL) vx = input->variable->compute_equal(xvar); - else if (xstyle == ATOM && vfield) - input->variable->compute_atom(xvar,igroup,&vfield[0][0],3,0); + else if (xstyle == ATOM) { + if (vfield) input->variable->compute_atom(xvar,igroup,&vfield[0][0],3,0); + else input->variable->compute_atom(xvar,igroup,NULL,3,0); + } if (ystyle == EQUAL) vy = input->variable->compute_equal(yvar); - else if (ystyle == ATOM && vfield) - input->variable->compute_atom(yvar,igroup,&vfield[0][1],3,0); + else if (ystyle == ATOM) { + if (vfield) input->variable->compute_atom(yvar,igroup,&vfield[0][1],3,0); + else input->variable->compute_atom(yvar,igroup,NULL,3,0); + } if (zstyle == EQUAL) vz = input->variable->compute_equal(zvar); - else if (zstyle == ATOM && vfield) - input->variable->compute_atom(zvar,igroup,&vfield[0][2],3,0); + else if (zstyle == ATOM) { + if (vfield) input->variable->compute_atom(zvar,igroup,&vfield[0][2],3,0); + else input->variable->compute_atom(zvar,igroup,NULL,3,0); + } for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) {