The presence of the in the main scope is normal: I want the program to be executed for increasing values of the constant M_tot.
If I understand you are suggesting that I should put all the procedure body outside the for ... end do, and let only the calling inside? This sounds bright! I'm going to change it.
For the number of global variables... I have a lot of numerical parameter, what else could I do (the idea of passing each global parameter to each procedure seemed to cumbersome).
Actually, most of my procedures don't change the global variables value, but what happened is that without explicitly use global ... inside the procedures' bodies , the procedures made their own version of the variables (symbolic), put it in the formulae, so that I wasn't able to simplify them in the main scope. This is why I explicitly pass all the global variables.
If you have remarks I'll pay attention to them