Spherical volume source in source_newgen.f

Dear Experts,

I am able to model spherical source using CALL RACO(TXX, TYY, TZZ) function as per old format of source.f routine.

However. there is no document on modelling of a spherical volume source using source_newgen.f.
Kindly suggest me how to model a spherical volume source using source_newgen.f.

Thanking you in advance.

Dear ArghyaC,

the RACO subroutine is still usable in the source_newgen.f user routine without any issues. But if you prefer you can use the wrapper subroutine sample_isotropic_direction.


Thank you for your reply. However, as per my understanding,
call sample_isotropic_direction( direction_cosx, direction_cosy, direction_cosz ) will sample the isotropic emission of the particles.

I want to model a spherical volume source of radius 2.5 cm and emission is isotropic. How to do this?

Hi ArghyaC,

RACO is also for sampling isotropic direction.

If you replace the direction_cosx, … variables with the coordinate ones in sample_isotropic_direction, then you get a sampling on the surface of a sphere.
Then you can call it again, now with the variables for the directions, to get the isotropic source distribution.


Hi @ArghyaC
I guess that the SPHE-VOL can simply solve your question.

@horvathd please correct me if I’m wrong.


Thank you for your reply.

My source is not uniform random distribution over the surface of the sphere. It is uniform random distribution of source particles throughout the entire volume of the the sphere.
Co-ordinate sampling is something like below:

R = 2.5D0

Note that, the co-ordinate of the centre of the sphere is (-5cm, 0cm, 38 cm)

Under module source_variables, I have included the line

double precission, save :: TXX, TYY, TZZ, R

I am able to do this. But is there any direct CALL function for this type of source (like annular source, Flood source etc) in the source_newgen.f ?

Thank you for your reply.
But this configuration is useful for monoenergetic volume source not for poly-energetic source.

1 Like

Dear ArghyaC,

with this sampling, you only sample the position on the surface of the sphere, you need to sample the radius correctly as well, see: python - Sampling uniformly distributed random points inside a spherical volume - Stack Overflow

You can define your variables, but using the SAVE option is unnecessary since you don’t need to keep their values between the primaries.

There is a subroutine for annular source sampling, but the volumetric sources are not implemented.


Thank you very much for the clarification.
Whether using “SAVE” option will make any difference in the final output?

Hi Arghya,

adding the SAVE option when it is not necessary won’t change the behavior of the routines.
See more: SAVE (FORTRAN 77 Language Reference)


Thank you very much.