Re: source.f & mgdraw.f - input and output my own particles

From: Stefano Sinigardi <>
Date: Wed, 22 Aug 2012 11:51:58 +0200

Dear all,
I'm replying to my own email sent some time ago because finally I was
able to solve my problems using source.f and mgdraw.f to read and dump
the raw particles at the beginning and at the end of the simulations.
In case you're interested I wanted to share my results.
You can find all the code on my github repo page at
Just one problem remains, that is how to obtain a dump at a certain
time step, instead that at a certain interface. At the moment I'm
reconstructing it using the time variable at which each particle
reaches the z position and letting the quickest to drift freely while
waiting for the slowest using a small routine that I've written, but
it would be better if fluka could do that. If it's possible, how could
I do?

Best regards,


On Thu, Jun 21, 2012 at 1:24 PM, Stefano Sinigardi
<> wrote:
> Dear Fluka experts,
> I'd like to "include" fluka inside a kit of programs that we use to
> simulate our beamline. To do so, I must be able to use as an input an
> ASCII files which describes our protons, which structured in this way [6
> columns]: x (micrometers), y, z, px (gamma*beta), py, pz, with z as the
> longitudinal direction of our beam.
> To do so, I tried to learn from manual and previous question in this
> mailing list and I prepared the source.f attached.
> In my initial tests, I'm using very small files with just 997 protons,
> but this number will grow to maybe one million. So I must put just one
> particle at a time on the stack. I hope that a source.f done in this way
> is correct. Also, I put a START 997 scorecard in the input file.
> At the end of the interaction of my protons with this small slab of
> material, in which they will not be stopped when we will finalize the
> thickness, I will have to obtain a similar file with the new positions
> and momenta of just the protons (if not position and momenta, position,
> angular direction and energy can be of course accepted, anyway the full
> phase space), so I though that I have to use mgdraw.f.
> I tried to write that too, and enabled through the USERDUMP scorecard.
> It compiles and runs, but unfortunately it's just writing a lot of trash
> on the final phase-space file. Also, I'm not sure if I'm reading my
> particles correctly.
> Any help will be very well appreciated.
> Best regards,
> Stefano
> ps: i put a .txt extension at the end of the filenames attached to
> prevent a problem with mimetype I got in the past. You have to rename
> them and remove those .txt of course if you'd like to test them.
Received on Thu Aug 23 2012 - 11:04:04 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 23 2012 - 11:04:17 CEST