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: Source_adapt

[ Identification | Description | Input parameters | Links ]

The Source_adapt Component

Neutron source with adaptive importance sampling


  • Site:
  • Author: Kristian Nielsen
  • Origin: Risoe
  • Date: 1999


Rectangular source with flat energy or wavelength distribution that
uses adaptive importance sampling to improve simulation efficiency.
Works together with the Adapt_check component.

The source divides the three-dimensional phase space of (energy,
horizontal position, horizontal divergence) into a number of
rectangular bins. The probability for selecting neutrons from each
bin is adjusted so that neutrons that reach the Adapt_check
component with high weights are emitted more frequently than those
with low weights. The adjustment is made so as to attemt to make
the weights at the Adapt_check components equal.

Focusing is achieved by only emitting neutrons towards a rectangle
perpendicular to and placed at a certain distance along the Z axis.
Focusing is only approximate (for simplicity); neutrons are also
emitted to pass slightly above and below the focusing rectangle,
more so for wider focusing.

In order to prevent false learning, a parameter beta sets a
fraction of the neutrons that are emitted uniformly, without regard
to the adaptive distribution. The parameter alpha sets an initial
fraction of neutrons that are emitted with low weights; this is
done to prevent early neutrons with rare initial parameters but
high weight to ruin the statistics before the component adapts its
distribution to the problem at hand. Good general-purpose values
for these parameters are alpha = beta = 0.25.

This component is not validated. It does not work properly with MPI.

Input parameters

Parameters in boldface are required; the others are optional.
N_E1Number of bins in energy (or wavelength) dimension20
N_xpos1Number of bins in horizontal position20
N_xdiv1Number of bins in horizontal divergence20
xminmLeft edge of rectangular source0
xmaxmRight edge0
yminmLower edge0
ymaxmUpper edge0
xwidthmWidth of source0
yheightmHeight of source0
filenamestringOptional filename for adaptive distribution output0
distmDistance to target rectangle along z axis0
focus_xwmWidth of target0.05
focus_yhmHeight of target0.1
E0meVMean energy of neutrons0
dEmeVEnergy spread (energy range is from E0-dE to E0+dE)0
lambda0AAMean wavelength of neutrons (if energy not specified)0
dlambdaAAWavelength spread half width0
flux(1/(cm 2 AA st)) Absolute source flux1e13
target_index1relative index of component to focus at, e.g. next is +1 this is used to compute 'dist' automatically.+1
alpha1Learning cut-off factor (0 < alpha <= 1)0.25
beta1Aggressiveness of adaptive algorithm (0 < beta <= 1)0.25


[ Identification | Description | Input parameters | Links ]

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

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