Read external spectrum data in source.f

Dear experts,

I have written a source.f file which reads data from a spectrum file (see the attached spectrum.txt, the energies are in MeV) . I have used the source file from

To verify whether it has read the file properly or not, I added a write statement [write (,)] inside it so that energy values and position coordinates can be printed in the log file (see the attached tet001.txt, the first column represents energy value).

In my understanding, it should print exactly same energy values from spectrum.txt. But I found out that there is a small difference. Is it expected ?

Thanks and Regards

Riya Dey

spectrum.txt (402 Bytes)
tet001.txt (103.5 KB)

Hi @riya,
you didn’t attach your source routine, therefore it is not evident how to compare the two files you posted.
But please consider that inside each energy bin the spectrum is assumed flat.
Cheers, luigi

Hi @luillo,

Thank you for your response. Here I am attaching a sample input which I prepared as a verification. My source in this case is a spherical source whose centre and radius are written in another text file. Also I am attaching the spectrum.txt file. My questions are as follows:

  1. From the output of log file, it seems that the energy is sampled in the form of histogram, not as a discrete spectra. Is it so?

  2. The energy spectra I have added is for beta spectra from K - 40. Since beta is a continuous spectra, then it might be helpful if we go for histogram sampling, instead of discrete sampling. But for gamma having discrete spectra (for example Co - 60), can we use this same source.f file ?

sample.inp (1.0 KB)

points_source.txt (8 Bytes)

spectrum.txt (402 Bytes)

sample001.log (102.5 KB)

source.f (13.4 KB)

1 Like

Hi @riya,
as I anticipated in the previous email, inside each energy bin the spectrum is assumed flat.
This is correct in case of continuous distributions.

In the case of discrete spectra, you need to modify the logic in two points:

  1. building the cumulative spectrum by adding the weight of each gamma line
  2. no need to sample within the bin, just use

Hope this can help.
Best, luigi

Thank you @luillo, it worked. Can we plot the frequency distribution of this initial K.E. inside fluka ?

Thanks and regards,

Hi @riya,
you can dump the K.E. in an output file and make a histogram with your favourite analysis tool.
Cheers, luigi

Thank you @luillo, yes, I did like that :smiley: