I hope you are all well. I have two questions on how to sample a beam with an extension in space and a divergence in angle within a “source.f” subroutine:
I would like to sample a beam with a circular shape in the x and y direction, how would this go?
I would like to sample angular divergence in the x and y direction. Looking at the previous post:
I saw that the solution that appears here only samples the divergence in the x direction (since in this post the divergence in y was set to zero).
I am aware that I would need to modify the variables: TXFLK, TYFLK and TZFLK; and XFLK, YFLK and ZFLK but I cannot figure the details out. It would be great if anyone shared it.
Thank you very much for your reply. One further doubt, if I want to sample a beam with an energy spread given by a histogram for heavy ions, I would need to simply use section 3.4.4 of “source_newgen.f” without further consideration right? (in the old source.f subroutine you needed to be careful of where you added the sampling).
you should be able to use the sampling without any complication. The only thing to keep in mind to set the particle type to HEAVYION on BEAM, and set the energy / momentum higher that the maximum reachable with the sampling.
Thank you very much for your reply and all your help! Maybe this is worth another post but how would you do an SOBP in the “source-newgen.f” subroutine? I have been trying to write several files, each with its own histogram as suggested in point 3 of Region of particle cannot be determined in extreme position - #3 by horvathd, but I cannot make it work, any suggestion on how to proceed?
On another note, is it possible to use both “source.f” subroutines: the old and new ones, where the old one would be in charge of sampling the SOBP and the new one in charge of sampling the circular distribution?
I start with your second question, but it maybe explain something for the first. There can by only one source routine linked to FLUKA, so it must contain all the required samplings.
To have multiple histograms in one source routine, you need to duplicate only the sampling function (located in the file: include/source_library.inc) with different names. This is viable if you have only a few histograms.
If you have more than a few, then probably the easiest solution would be to create a single histogram which describes the whole SOBP beam.