Mgdraw elastic vs inelastic ICODE

Dear @fogallar,

Thank you for pointing me good information.

I have created my own mgdraw.f, but I’m curious about my scoring process. At first, used ICODE = 100( refers to elastic interaction by secondaries) for collecting neutrons. After the routine was executed, the .txt file output was not generated, I thought there is no elastic interaction, is that make sense? And then I changed ICODE to 101 (inelastic interaction) which give me the .txt file. I want to know, do my mgdraw routine make sense or have something wrong?

Here is the neutron distribution by 50000 primary protons from inelastic interaction.
mgdraw_example.f (4.2 KB)

Best regards,


it looks like you select proton interactions

    IF (JTRACK.EQ.1)THEN      

and then you search for neutrons among the interaction products

            IF (KPART(ip) .EQ. 8) THEN

However, by definition of elastic interaction, one can just get one proton (and the recoiling nucleus).

Do not open the unit 90 every time you write, but move the OPEN statement under the dedicated



The TKI(IP) variable has a positive value (kinetic energy), no need for ABS.