McStas logo McStas - A neutron ray-trace simulation package ILL; PSI; ESS Niels Bohr Institute DTU Physics NEXMAP


About McStas
 Conditions of use
 Project funding

 Other Downloads (share)

Mailing list

Search web/mailinglist

 Wiki (GitHub)
 McStas manual


Report bugs (GitHub)

Code-repository (GitHub)

McStas: Virtual_output

[ Identification | Description | Input parameters | Links ]

The Virtual_output Component

Detector-like component that writes neutron state parameters into an ascci-format 'virtual source' neutron file.


  • Site:
  • Author: E. Farhi
  • Origin: ILL
  • Date: Dec 17th, 2002


Detector-like component writing neutron state parameters to a
virtual source neutron filename. The component geometry is the full
plane, and saves the neutron state as it exits from the previous

It is particularly useful to generate a virtual source at a point that few
neutron reach. A long simulation will then only be performed once, to create
the upstream 'source' file. Further simulations are much faster if they start
from this low flux position with the 'source' filename.

The output file format is:
text column formatted with lines containing 11 values in the order:
p x y z vx vy vz t sx sy sz stored into about 83 bytes/n.

Beware the size of generated files ! When saving all events (bufsize=0) the
required memory has been optimized and remains very small. On the other hand
using large bufsize values (not recommended) requires huge storage memory.
Moreover, using the 'bufsize' parameter will often lead to wrong intensities.
Both methods will generate huge files.

A Vitess file may be obtained from the 'Vitess_output' component or from a
Vitess simulation (104 bytes per neutron) and read with Vitess_input.

Example: Virtual_output(filename="MySource.dat")
will generate a 9 Mo text file for 1e5 events stored.

Using bufsize non-zero may generate a virtual source with wrong intensity. This
component works with MPI (parallel execution mode).

Input parameters

Parameters in boldface are required; the others are optional.
filenamestrName of neutron file to write. Default is standard output [string]. If not given, a unique name will be used.0
bufsize1Size of neutron output buffer default is 0, i.e. save all - recommended.0


[ Identification | Description | Input parameters | Links ]

Generated on 2023-09-19 20:01:36

Last Modified: Tuesday, 16-Apr-2024 20:05:20 CEST
Search website mailinglist archive GitHub repos