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: MCPL_output Component

[ Identification | Description | Input parameters | Output parameters | Links ]

The MCPL_output Component

Detector-like component that writes neutron state parameters into an mcpl-format binary, virtual-source neutron file.


  • Author: Erik B Knudsen
  • Origin: DTU Physics
  • Date: Mar 2016
  • Version:(Unknown)


Detector-like component that writes neutron state parameters into an mcpl-format
binary, virtual-source neutron file.

MCPL is short for Monte Carlo Particle List, and is a new format for sharing events
between e.g. MCNP(X), Geant4 and McStas.

When used with MPI, the component first outputs #MPI nodes individual MCPL files that
may be merged (the default). If, in addition, keep_mpi_unmerged is set, the constituent
parts of the merged mcpl-file are kept.

N.b. Any file extension given will be replaced by .mcpl

MCPL_output allows a few flags to tweak the output files:
1. If use_polarisation is unset (default) the polarisation vector will not be stored (saving space)
2. If doubleprec is unset (default) data will be stored as 32 bit floating points, effectively cutting the output file size in half.
3. Extra information may be attached to each ray in the form of a userflag, a user-defined variable wich is packed into 32 bits. If
the user variable does not fit in 32 bits the value will be truncated and likely garbage. If more than one variable is to be attached to
each neutron this must be packed into the 32 bits.

These features are set this way to keep file sizes as manageable as possible.


Input parameters

Parameters in boldface are required; the others are optional.
Name Unit Description Default
polarisationuse 1 Enable storing the polarisation state of the neutron. 0
doubleprec 1 Use double precision storage 0
verbose 1 If 1) Print summary information for created MCPL file. 2) Also print summary of first 10 particles information stored in the MCPL file. >2) Also print information for first 10 particles as they are being stored by McStas. 0
userflag 1 Extra variable to attach to each neutron. The value of this variable will be packed into a 32 bit integer. 0
filename str Name of neutron file to write. Default is standard output [string]. If not given, a unique name will be used. 0
userflagcomment str String variable to describe the userflag. If this string is empty (the default) no userflags will be stored. ""
merge_mpi 1 Flag to indicate if output should be merged in case of MPI 1
keep_mpi_unmerged 1 Flag to indicate if original unmerged mcpl-files should be kept (or deleted). 0

Output parameters

Name Unit Description Default


[ Identification | Description | Input parameters | Output parameters | Links ]

Generated automatically by McDoc, Peter Willendrup <> / Wed Jan 12 15:13:31 2022

Last Modified: Wednesday, 12-Jan-2022 16:13:31 CET
Search website mailinglist archive GitHub repos