First of all, many thanks to the creator of this module! I am using it for an investigation and it works very nice.
I think I found a bug regarding the propagating charges and I was wondering if this could be changed:
In line 907 of InteractivePropagationModule.cpp Draft: New Module: InteractivePropagationModule by gkunkler · Pull Request #53 · allpix-squared/allpix-squared · GitHub, charge is a reference. This causes the first charge group from propagating_charges to be overwritten by the propagating_charges[i] on line 1052. This will result in the first charge group being identical to the final charge group. In my case, since I had charge_per_step = 100, it resulted in the first group having the same amount of ‘left-over’ charge carriers as the last group.
A possible fix could be to leave the reference out (no &). I tested this with a local repo and this indeed fixed the issue.
Somehow Github did not allow me to post a review / comment in the pull request, so that is why I am informing you via this forum. I hope the issue is clear and if you have any questions, feel free to reach out!
First of all, I apologize for the very late reply, and thank you for reporting the issue so clearly.
The InteractivePropagation module is not maintained by the Allpix Squared core team, but was developed in my research group. The original author has since left the group, and the draft pull request you linked is no longer under active development. I have taken over the continued development and maintenance of the module here:
I have now checked both the current master branch and my active development branch. Your diagnosis was correct for the version you examined: declaring charge as a reference allowed later assignments to overwrite the first element of propagating_charges, causing the first charge group to become a copy of the final group.
In both current branches, charge is instead declared as an independent value rather than a reference. The specific bug you reported is therefore no longer present.
The module remains experimental research code and is still under active development, and I am currently working on improving the numerical treatment during the earliest stage of propagation, when charge groups originating from the same energy deposition initially occupy the same position. The development version introduces configurable Coulomb softening and refinement of the first propagation timestep. This improves the numerical stability of the initial Coulomb-force calculation, although it can also increase the computation time considerably. I am still testing the convergence and determining suitable settings.
Thank you again for identifying and reporting the problem. If you are still using the module, I would be very interested to hear about your application and results, as well as any further issues you encounter.
I also try to keep the fork aligned with the current Allpix Squared codebase, including its C++20 toolchain and recent versions of Geant4 and the other dependencies, so a rebuild may be in order.