How to explain the discrepancy between RESNUCLEi and User Routine

Dear professors,
I’m recording the reaction information for isotope production (e.g. reaction position and type, parent particle) using mdstck.f and mgdraw.f. The first one could accurately detect any nuclear reactions with secondaries while its reaction type is limited to inelastic scattering, elastic scattering and low energy neutron reaction. So I add mgdraw.f to complement types like particle decay and radiative decay. I also record the dose of each isotopes using RESNUCLEi. However, a discrepancy occurs when I compare both of the results.

RESNUCLEi tells me that there are two Te124, one Te127 and one Te125m in LS and no isotopes for Te in water.
Mdstck.f and mgdraw.f(both in Te-LS001_ISOTOPE) tell me that in total there are two Te124 and one Te125 in the production.

The question is that is there any problems with my codes? If not, why didn’t I record the Te127 and why the Te125 is not the isomer state in userdump.
Thank you for your help!
Best regards,
Hechong Han
LS_tab.lis (11.3 KB)
mdstck.f (4.0 KB)
mgdraw.f (8.4 KB)
newsource.f (7.3 KB)
Te-LS.inp (3.3 KB)
usrrnc.f (1.3 KB)
water_tab.lis (7.1 KB)
muon.txt (84.2 KB)

I forgot to attach my userdump above.
Te-LS001_ISOTOPE.txt (145.0 KB)

Dear @hanhechong ,

thanks for your question. I am having a look at it.
Could you please upload the correct user routines that you are using: at the moment I get compilation errors from both mgdraw.f and mdstck.f.


Dear @dbozzato ,
Thank you for your reply. I have uploaded these new mdstck.f and mgdraw.f after I compiled them successfully using ldpmqmd. Please tell me what the error is in case it still fails.
Best regards,
Hechong Han
mdstck.f (4.0 KB)
mgdraw.f (7.5 KB)

Dear @hanhechong,

I managed to compile and have a better look to your results.

Unless needed for other reasons, I think that in your case it is cleaner to fully use mgdraw (USDRAW entry) to filter out the desired information on the isotope production, particularly as far as writing out to a file is concerned.

In USDRAW you can filter by the region via MREG (which you could not easily do with mdstck), the particle being transported (JTRACK) and even the generation (LTRACK) and so on. From you get the secondaries, from the heavy fragments, and from (which you include but don’t look into) the residual if any.

You can consider the simplified attached example: for every inelastic interaction (ICODE = 101) I print out the transported particle and the generation, the region where the interaction occurs, the secondaries, the heavy fragments (if any) and the residual (if any). You can easily expand from this according to your needs. I took the liberty to comment out everything that was not needed for the moment.

With this you should get the same radionuclides as RESNUCLEI, but bare in mind that the output of RESNUCLEI would not be directly comparable with what you get from mgdraw.

I hope this was helpful.

PS: For writing custom output files, I suggest to explicitly add OPEN statements in the routines when they are first called.

mgdraw2.f (14.8 KB)
Te-LS.inp (4.7 KB)

Dear @dbozzato ,
Thank you for your detailed instructions and example! Actually, I use mgdraw.f only to record all the information at first. However, as I intend to filter out any reactions with isotopes produced. I use ABS(KPART(IP)) > 10000 as the selection condition. It turns out that in mdgraw.f the residual nuclei will not be counted as a secondary while in mdstck.f it is. So I move to mdstck.f and with your help I now believe that it is equivalent in these two routines when encountered with inelastic scattering and low-energy neutron captures.
Then question remains when the reaction type is radioactive decay. The RESNUCLEi, when equipped with DCYSCORE, will also record all the isotopes produced in a decay process. While in mgdraw.f,
the nuclei itself will not be recorded after decays neither with KPART selection nor with the residual nuclei flag for IBRES and ICRES. The following are the results in these two cases.

Generated a residual with A = 0 , Z = 0
Reaction with ICODE 110 in region 6
Primary history: 5889
Generated 2 particles of ID: 4 5
Generated 0 fragments with
A =
Z =
Generated a residual with A = 0 , Z = 0

Using ABS(KPART(IP)) > 10000 selection
Reaction type 110
the information of the parent in this decay (using USRDCI) IONZ 6 IONA 11 IONM 0
product id 4
product id 5

My question is that is it possible to record the residual nuclei of this C11 beta+ decay: Be11. Or it can only be deduced. I think it will be much more convenient in the postprocessing if Be11 can be printed out.
Thank you for your help!
Best regards
Hechong Han

Dear @hanhechong,

apologies for the long time since the last reply, maybe in the meantime you have clarified your remaining doubts. What you said for RESNUCLEi is in general correct. I just wanted to remind you that with the semi-analogue mode each single radioactive nucleus is treated in a Monte Carlo way like all other unstable particles, meaning that a random decay time, random daughters, random radiation are selected and tracked. This allows for event-by-event analysis but radiation spectra are inclusive: e.g., no correlated gamma cascade is reproduced. You can always go back to the FLUKA manual or to the activation lectures

With a bit of coding you may able to write out the residual from mgdraw but at this point it will be probably easier to use a combination of mgdraw for secondaries from inelastic interactions + usrrnuc for all residuals as they would be scored by RESNUCLEi: in principle the same routine that you passed me at the beginning would be fine, but it will all come down to the details of the analysis you will have to perform.

Let us know in case you encounter specific issues.