RAY pseudoparticles - How to speed-up simulations

Dear Francesco,

Thank you very much for the file!

I have no problem in the compilation and everything works perfectly. Also, the simulation time is almost half of the previous one (i.e., without the kasray.o file). This solves the issue for sure, so thanks a lot.

In the meanwhile, I wrote an mgdraw.f routine to save the RAY path length in every region (it works with the previous input file if the detector is region is put in #2). I would like to add a small part to this routine, based on the example presented in this post.
As you can see in the attached file, I tried to write a part of the SODRAW in which I scan the MEDFLK array to get the FLUKA codes of the used materials, and then I try to get the arrays of the attenuation coefficients through the SGTTEP function (as in the mentioned example). This would be useful, as I could calculate the attenuation for a polyenergetic beam.

The mgdraw.f is compiled, but when I try to run the simulation i get the following error:
“At line 99 of file emf/sgttep.f
Fortran runtime error: Index ‘0’ of dimension 1 of array ‘ge1’ below lower bound of 1”

I hope you can help me understand the error.

Thanks a lot again, I truly appreciate your help and support :pray:

Best regards,
Francesco

mgdraw.f (10.7 KB)