Index below lower bound

Dear all,

In several of the last simulation i launched I got this message: At line 114 of file mgdraw.f
Fortran runtime error: Index ‘-7’ of dimension 1 of array ‘am’ below lower bound of -6

Error termination. Backtrace:
#0 0x7f3ce6331860 in ???
#1 0x7f3ce63323b9 in ???
#2 0x7f3ce6332a2d in ???
#3 0x40921b in master.0.mgdraw
at /users/muoncollider/lcastell/3TeV/two_beam/ran38/executable/mgdraw.f:114
#4 0x40921b in master.0.mgdraw
at /users/muoncollider/lcastell/3TeV/two_beam/ran38/executable/mgdraw.f:4
#5 0x409331 in bxdraw_
at /users/muoncollider/lcastell/3TeV/two_beam/ran38/executable/mgdraw.f:102
#6 0x611144 in kashea_
at cascade/kashea.f:1261
#7 0x5decf6 in kaskad_
at cascade/kaskad.f:4245
#8 0x4a1d9a in feeder_
at cascade/feeder.f:274
#9 0x410c9b in flukam_
at main/flukam.f:2812
#10 0x4075d0 in fluka
at main/fluka.f:77
#11 0x4075d0 in main
at /shared/src/usflmd.inc:15

I am not so sure but I think I started getting this error when I switched to fluka4.4.0. Do you have any idea of what could be the cause?

Dear @lucastel,

It is impossible to say what the cause could be with so little information. Please, share your input as well as your user routines.

The issue is unrelated to the version upgrade.

In mgdraw you are invoking the mass array AM with an index that turns out to be outside the applicable range, taking the -7 value where -6 (4-HELIUM) is the lowest acceptable value.
You should implement a dedicated logic properly handling <-6 cases (for the JTRACK variable, I guess), as @dcalzola is going to explain.

Ciao Luca,

I think you might be performing the muon collider simulations with the former mgdraw.f script that I was employing for the scoring.

As Francesco promptly noticed, the crash occurs since you are invoking the AM vector of masses with an unacceptable index. In other words, you have in the stack a fission fragment or an heavy ion, whose mass is not contained in the aforementioned vector.

For most applications you can just forget them (handling only JTRACK above -6), otherwise - if you want to keep those information - you can access them through the common fheavy.inc.
More details here: slide 21 https://indico.cern.ch/event/1200922/contributions/5411856/attachments/2662688/4613294/10_MGDRAW_routine_2023_Advanced_ANL.pdf

See you soon!
Cheers,
Daniele