Multiple region source in new generation source.f

Dear experts,

I want to define 4 different regions of a simulation geometry as source. Each region has equal probability.

I used following kind of syntax in the new generation source.f (see the attached).

random = FLRNDM(XDUMMY)
if (random .lt. 0.25) then
   	call regionsource ( coordinate_x, coordinate_y, coordinate_z, 35, 7.5D0, 14.0D0, 1.8D0, 4.2D0, 31.5D0, 42.0D0 )
else if (random .gt. 0.25 .AND. random .lt. 0.5) then
   	call regionsource ( coordinate_x, coordinate_y, coordinate_z, 23, 5.5D0, 7.5D0, 0.5D0, 1.1D0, 28.0D0, 31.0D0 )
else if (random .gt. 0.5 .AND. random .lt. 0.75) then
   	call regionsource ( coordinate_x, coordinate_y, coordinate_z, 28, 2.0D0, 3.0D0, 0.3D0, 0.5D0, 25.0D0, 27.0D0 )
else
   	call regionsource ( coordinate_x, coordinate_y, coordinate_z, 30, 1.0D0, 1.5D0, 0.1D0, 0.25D0, 20.0D0, 24.0D0 )
end if

Here region number, and Xmin, Xmax, Ymin, Ymax, Zmin and Zmax values are arbitrarily put. It will be modified as per the actual simulation geometry.

Kindly suggest me whether the syntax is correct? If not, kindly suggest me some way out.

Thanking you in advance.
source_newgen_with_Multiple_regionsource.f (20.2 KB)

Dear Arghya,

in general, the code looks fine. One minor change would be to use .ge. (greater or equal) instead of .gt. (greater than) to include the boundary values as well.

Cheers,
David