Compiling errors about user routine -- mdstck.f

Dear experts,

I came cross a compiling error about mdstck.f user routine. The fortran file is used to stop the transport of all the secondary neutrons born from all fission events. But after put the ‘Build’ button in Compile page, FLUKA told me ‘Error: Variable ‘ip’ at (1) cannot be redefined inside loop beginning at (2)’ in Output page. The information and my fortran file has been showen below.


mdstck.f (1.7 KB)
There must be some problem with the syntax or logic of my code. What is the reason why the variable ‘ip’ cannot be redefined?

Thanks and regards.
Yin.

Dear @YinXianpeng,

The variable cannot be redefined in the second do-loop because the first do-loop is not closed yet, as clearly stated in the error message.
Please, also notice that your if statement

if (NNN .GT. 0) THEN

is not closed either.
Have a look at the FORTRAN manual for the DO statement and IF statement.
Finally, I would suggest you to follow a basic FORTRAN tutorial to get acquainted with basic FORTRAN syntax.

Dear amario,

Thanks for your suggestion. I learned the tutorial and add correct terminating names and labels. Compiling is successful.

Regards.
Yin.