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

McStas

About McStas
 Conditions of use
 Authors/Contacts
 Project funding

Download
 Components
 Other Downloads (share)

Mailing list

Search web/mailinglist

Documentation
 Wiki (GitHub)
 McStas manual
 Publications

Links

Report bugs (GitHub)

Code-repository (GitHub)


The NCrystal_filter McStas Component

4.5  The NCrystal_filter McStas Component

Filter or window (box or cylinder) of a material from NCrystal, which only attenuates the beam. Simple, fast and GPU friendly.

Identification

  • Author: Thomas Kittelmann

  • Origin: ESS

  • Date: 2026

Description

A filter or window of an isotropic material, which attenuates the beam according to the total cross section (scattering plus absorption) of the material, as provided by the NCrystal library. Neutrons are not scattered: the weight of a neutron travelling a distance L through the material is multiplied by exp(-sigma*L), where sigma is the macroscopic cross section at its wavelength. This is suitable for e.g. Be filters or Al windows, where the scattered neutrons are not of interest. For the full NCrystal physics, use NCrystal_sample or the Union components instead.

The cross sections are tabulated during initialisation, so the component can also be used on GPUs. The table is provided by NCrystal itself, unless the C API function ncrystal_filtertable is not available, in which case the component will create the table itself as a fallback workaround.

The material is given by an NCrystal cfg-string, e.g. "stdlib::Be_sg194.ncmat;temp=80K" for a cooled Be filter, or "mycrystal.ncmat" for a local file. Oriented materials such as single crystals are not supported, but a fast sapphire filter can be emulated with an assumption that no reflections satisfy the Bragg condition: "stdlib::Al2O3_sg167_Corundum.ncmat;bragg=0;temp=200K". Multiphase materials are also supported: "phases<0.98*stdlib::Al_sg225.ncmat&0.01*stdlib::Fe_sg229_Iron-alpha.ncmat&0.01*stdlib::Si_sg227.ncmat>;temp=180K".

The geometry is a box (xwidth, yheight, zdepth) or a cylinder (radius, yheight) along the y axis.

Input parameters

Parameters in boldface are required; the others are optional.

Name

Unit

Description

Default

cfg

str

NCrystal material configuration string (details <a href="https://github.com/mctools/ncrystal/wiki/Using-NCrystal">on this page</a>).

"void"

xwidth

m

x-dimension (width) of the filter, for a box

0

yheight

m

y-dimension (height) of the filter, for a box or cylinder

0

zdepth

m

z-dimension (depth) of the filter, for a box

0

radius

m

radius of the filter, for a cylinder

0

Links


Last Modified: Tuesday, 06-Oct-2026 21:19:11 CEST
Search website mailinglist archive GitHub repos