svenreiche / Genesis-1.3-Version4

Time-dependent, 3D Code to simulate the amplification process of a Free-electron Laser.
GNU General Public License v3.0
53 stars 26 forks source link

FIX: calculate npart with stride after clearing it #138

Closed ken-lauer closed 7 months ago

ken-lauer commented 7 months ago

Context

Closes #134

Details

Based on my observation in https://github.com/svenreiche/Genesis-1.3-Version4/issues/134#issuecomment-1879235500, I think that npart with the new stride option was being calculated erroneously. It looks as though iteration 0 passed without issue, but iteration 1 and beyond would increase linearly with npart since npart was never reset prior to the for loop.

Does this look like the right fix, @svenreiche?

svenreiche commented 7 months ago

Thanks Ken for finding this bug.

Yes, npart is only initialized outside the loop over the slices.