diff --git a/src/particle_data.cpp b/src/particle_data.cpp index 8f4db5a8a9..7f1f9f4564 100644 --- a/src/particle_data.cpp +++ b/src/particle_data.cpp @@ -3,6 +3,7 @@ #include "openmc/geometry.h" #include "openmc/nuclide.h" #include "openmc/photon.h" +#include "openmc/settings.h" #include "openmc/tallies/derivative.h" #include "openmc/tallies/filter.h" #include "openmc/tallies/tally.h" @@ -18,8 +19,10 @@ ParticleData::ParticleData() zero_delayed_bank(); - // Every particle starts with no accumulated flux derivative. - if (!model::active_tallies.empty()) { + // Every particle starts with no accumulated flux derivative. Note that in + // event mode, we construct the particle once up front, so have to run this + // even if the current batch is inactive. + if (!model::active_tallies.empty() || settings::event_based) { flux_derivs_.resize(model::tally_derivs.size()); zero_flux_derivs(); }