Flag secondary particles which are the same kind of the one initiating the collision

Dear Andre,

Thank you for your timely responses.

  1. I’m currently working on a biasing technique using the USIMBS user routine. In this technique, the particle weights rely on the preceding particle track. However, a challenge arises when an interaction spawns a different type of particle, introducing a discontinuity that I need to rectify. My approach to address this is by flagging particles when this discontinuity occurs. Doing so will allow me to detect these processes within the USIMBS routine and achieve accurate renormalization.

  2. While my current test emphasizes em particles for the sake of simplicity, I intend to broaden the scope to encompass all particles in due course. However, for other particles, I recognize that I can leverage STUPRF. The distinction being, STUPRF is invoked for each secondary, whereas STUPRE is called at every interaction.

  3. Upon reviewing my code, I’ve observed that the way I’ve implemented the STUPRE routine results in inconsistent outcomes. A case in point is the Rayleigh scattering interaction: in both STUPRE and MDSTCK, the final state comprises an electron and lacks a photon, whereas in MGDRAW, the final state has a photon. I also noticed a difference in the secondary energies between [STUPRE&MDSTCK] and MGDRAW.

Below, the first integer is the number of secondaries, the second one is the code of the initial particle and the third one is the code of the final state particle. The last number is the kinetic energy. You will notice that only the MGDRAW routine provides the correct final state.

>  STUPRE Rayleigh                            1           7           3   1.9361811555252762E-006     
>  MDSTCK Rayleigh                            1           7           3   1.9361811555252762E-006     
>  MGDRAW Rayleigh                            1           7           7   6.6306973014815596E-005

As per your request, I’ve attached a simplified example of the .inp and .f files to this email. Despite its simplicity, it sufficiently highlights the discrepancies observed with MGDRAW, STUPRE and MDSTCK.

benchmark.inp (1.9 KB)
mdstck.f (2.6 KB)
mgdraw.f (12.5 KB)
stupre.f (4.9 KB)