diff --git a/src/mmc_core.cl b/src/mmc_core.cl index 0bc30ba..4c797b5 100644 --- a/src/mmc_core.cl +++ b/src/mmc_core.cl @@ -1704,8 +1704,12 @@ __device__ void onephoton(unsigned int id, __local float* ppath, __constant MCXP savedebugdata(&r, id, reporter, gdebugdata, gcfg); } - for (oldeid = 0; oldeid < GPU_PARAM(gcfg, srcnum); oldeid++) { - energyesc[oldeid] += r.weight * ppath[GPU_PARAM(gcfg, reclen) + oldeid]; + if (GPU_PARAM(gcfg, srcnum) == 1) { + *energyesc += r.weight; + } else { + for (oldeid = 0; oldeid < GPU_PARAM(gcfg, srcnum); oldeid++) { + energyesc[oldeid] += r.weight * ppath[GPU_PARAM(gcfg, reclen) + oldeid]; + } } }