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_mcnp_ss_input

[ Identification | Description | Input parameters | Links ]

The Virtual_mcnp_ss_input Component

This component uses a Source Surface type file of recorded neutrons from the reactor monte carlo code MCNP as a source of particles.



This component draws neutron events from a Source Surface file created using the
MCNP Monte Carlo code and converts them to make them suitable for a McStas simulation

Note that axes orientation may be different between MCNP and McStas!
Note also that the conversion of between McStas and MCNP units and parameters
is done automatically by this component - but the user must ensure that
geometry description matches between the two Monte Carlo codes.

The verbose mode is highly recommended as it displays lots of useful informations.

This interface uses the MCNP Source Surface Read/Write format (SSW/SSR).
Infomation transfer from(to) SSW files proceeds via a set of Fortran modules
and subroutines collected in "subs.f"
For succesful compilation, it is required that these subroutines are compiled
and linked to the instrument file:

mcstas dummy.instr  -> generates dummy.c
gfortran -c subs.f  -> generates subs.f
gcc -o runme.out dummy.c subs.o -lm -lgfortran  -> generates runme.out

Note that this requires a fortran compiler (here gfortran) and gcc.

None known bugs so far. But surely this will change...
Caveat: when writing the header for the output wssa file, the number of histories and tracks are assumed to be that of the
input MNCP run. This is generally not the case, due to losses in the McStas simulation step.
In case of losses any subsequel MCNP run based on the McStas output, can be confused by inconsistency between
header and file content. To resolve, either ensure that NPS is lower than the actual number of events in the McStas output.
Or hardcode values of nhis & ntrk in either subs.f or Virtual_mcnp_ss_output.comp.

EXAMPLE of usage:
first a MCNP simulation is run
and at a relevant surface, a Source Surface Write card is given (e.g. for MCNP surface #1, add the line:
to the end of the input file.
By this a ".w" file is produced, which then serves as input to the McStas simulation.
Present version: rename *.w to rssa, and make sure to put it in the dir from which McStas is run

Input parameters

Parameters in boldface are required; the others are optional.
filestrName of the MCNP SSW neutron input file. Not active: Name assumed to be 'rssa'"rssa"
verbose1Toggles debugging info on/off1


  • Source code for Virtual_mcnp_ss_input.comp.
  • MCNP
  • MCNP -- A General Monte Carlo N-Particle Transport Code, Version 5, Volume II: User's Guide, p177

[ Identification | Description | Input parameters | Links ]

Generated on 2024-01-03 11:47:43

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