Modules Writeout

# VITESS Modules Writeout and Read-In

The module writeout can be inserted between two other VITESS modules or put to the end of the instrument to write data sets of trajectories (or 'neutrons' or 'events') into an ASCII file. It records the output of the preceding module. It is possible to write all data sets, but there are also different options to select the trajectories that are written to this file (see table Parameters for Module 'writeout'). In any case, all trajectories are written unchanged to the pipe for the following module, so the simulation is not disturbed by using this module.
The data can be written in 3 different formats: VITESS, McStas and MCNPX. There is the possibility to disable the module, i.e. suppress writing the output. For VITESS, there is also the option to select the written parameters (see table Parameters for Module 'writeout').
Note that the output file needs something like 0.1 kByte per Trajectory and may therefore become very large.

The module read_in reads the data sets written by writeout. It can read data in the same 3 formats: VITESS, McStas and MCNPX. In any case it expects complete data sets, i.e. no reduction of the number of written paramters as enabled in writeout for the VITESS format (see above). For VITESS trajectories, the data format - float or exponential - has to be specified. For MCNPX data, a normalization is foreseen to get correct absolute intensities. In contrast to writeout there is only one filter realized - by color (of the neutrons/trajectories), which only works for VITESS. The input file can be read N times to start a longer simulation. In this case the weights of the trajectories are divided by N to give the same total intensity of the beam.
It is supposed to be used as the first module and to replace a source module. Note that read_in reads ASCII files (of different formats) written by writeout. In contrast, the input file that can be used alternatively is a binary file in VITESS format that is generated by writing the pipe into output file at the end of the first part of the instrument.

The following information is stored for each trajectory (or neutron) in VITESS format:

    column
       1    the ID of the trajectory.                     (e.g. AA000123456)
       2    the tracing information                       (T: tracing, N: no tracing)
       3    the 'color' of the trajectory                 (reserved for the user's demands)
       4    the time of flight                    [ms]
       5    neutron wavelength                     [Å]
       6    intensity (or weight)                 [n/s]   (represented by the trajectory)
     7 - 9  x-,y-,z-coordinate of the position    [cm]    (with respect to the coordinate system provided by the module preceding writeout)
    10 -12  x-,y-,z-coordinate of the flight dir.         (direction cosinus)
    13 -15  x-,y-,z-coordinate of the spin

The following information is stored for each trajectory (or neutron) in McStas format:

    column
       1    intensity (or weight)                 [n/s]   (represented by the trajectory)
     2 - 4  x-,y-,z-coordinate of the position     [m]    (with respect to the coordinate system provided by the module preceding writeout)
     5 - 7  x-,y-,z-coordinate of the speed       [m/s]
       8    the time of flight                     [s]
     9 -11  x-,y-,z-coordinate of the spin

The ollowing information is stored for each trajectory (or neutron) in MCNPX format:

    column
     1 - 3  x-,y-,z-coordinate of the position    [cm]    (with respect to the coordinate system provided by the module preceding writeout)
     4 - 6  x-,y-,z-coordinate of the flight dir.         (direction cosinus)
       7    neutron energy                        [MeV]
       8    intensity (or weight)                 [n/s]   (represented by the trajectory)
       9    the time of flight                [shakes=1e-8s]

The same information is expected by read_in - except for the weight in MCNPX format. This can be normalised to [n/s] by the corresponding input parameter (s. table Module Parameters )

### Parameters for Module 'read_in'

Parameter Unit | Description | Range or Values | Command Option
ASCII input file 1, 2, 3 | Names of the input files containing the neutron trajectories for MCPL format only input file 1 is handled | - | -A -B -D
Weight of the trajectories in file 1, 2, 3 | If there is only one input file, then this should get the weight 1.0. If 2 input files resulting from simulation with 1 Mio. and 3 Mio. trajectories are combined, then 0.25 for the 1st and 0.75 for the 2nd would be the proper choice to get the correct flux | 0.0 - 1.0 | -a -b -c
Intensity factor for MCNPX [n/s] | The weight of each neutron trajectory from the MCNPX simulation will be multiplied by this factor to yield correct absolute source flux values. The factor is: F = Isrc/ NMCNPX-Events | >0 typical 1.0e11 default: 1.0 | -I
format | Format in which the input was written | "VITESS" "McStas" "MCPL" "MCNPX" | -f
VITESS storage format | Format in which VITESS trajectories were written into the input file: in scientific/exponential form (e.g. 5.4321E03) or usual float format (5432.1) | "exp" "float" | -F
read in color | (optional) Only trajectories of the given color are read. Color -1 means: all trajectories are read | >= -1 (int) default: -1 | -C
repetition | (optional) The trajectories will be written 'repetition' times to yield 'repetition' times as many neutrons for the simulations. The weight of each trajectory will be reduced by the same factor. | >= 1 (int) default: 1 | -R

### Parameters for Module 'writeout'

Parameter Unit | Description | Range or Values | Command Option
ASCII output file | Name of the output file containing the neutron trajectories | - | -A
Active? | "no": no output is written "yes": output file is written | "no" "yes" | -a
format | The format in which the output file will be written | "VITESS" "McStas" "MCPL" "MCNPX" | -f
writeout color | (optional) Only trajectories of the given color are written to the output file. Color -1 means: all trajectories are written | >= -1 (int) default: -1 | -C
data format | Data format in which float numbers in VITESS trajectories are written to the output file "exp": exponential (scientific) representation, "float": floating point representation MCNPX output is written in exponential and McStas ouput in floating point representation | "exp" "float" | -F
separator | Character used to separate the numbers in a VITESS output file MCNPX and McStas data are separated by 'space' | "Space" "Tabulator" | -S
Columns | Choice of output parameters for VITESS format | - | -c
filter lambda min/max [Å] | (optional) Only neutrons within the given wavelength range are read | >0 | -l -L
filter Y pos. min/max [cm] | (optional) Only neutrons within the given horizontal space range are read | any | -y -Y
filter Z pos. min/max [cm] | (optional) Only neutrons within the given vertical space range are read | any | -z -Z
filter horz. div. min/max [] | (optional) Only neutrons within the given horizontal divergence range are read | any | -e -d
filter vert. div. min/max [] | (optional) Only neutrons within the given vertical divergence range are read | any | -E -D
filter div. min/max [] | (optional) Only neutrons within the given total divergence range are read | >=0 | -g -G

Back to VITESS overview
vitess@helmholtz-berlin.de