Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 3 KB

McStas.md

File metadata and controls

60 lines (44 loc) · 3 KB

McStas

Overview

McStas (web) is a general tool for simulating neutron scattering instruments. It is based on a compiler that reads a high-level specification language defining the instrument to be simulated and produces C code that performs the Monte Carlo Simulation. This makes it very fast, typical figures are 500000 neutron histories per second on a fast PC.

It is common to test calculations in more than one software to check their validity; an alternative to McStas is Vitess.

McStas shares codebase with its X-Ray analogous, McXtrace, with a similar syntax.

Installation

On PC

It is recommended to install McStas with miniforge. Once miniforge is installed, create a conda environment and install McStas:

conda create --name mcstas
conda activate mcstas
mamba install mcstas

On HPC clusters

To use McStas in HPC clusters like Hyperion, it should be installed in the /scratch folder. Replacing gila by your own username,

module load Python
conda create --prefix /scratch/gila/.conda/envs/mcstas
conda activate /scratch/gila/.conda/envs/mcstas
conda install mamba --channel conda-forge
mamba install mcstas

Once installed, it can be accessed anytime as

module load Python
conda activate /scratch/gila/.conda/envs/mcstas

Components

McStas comes with a comprehensive library of well-tested components that include most standard elements of neutron scattering instruments. New components are constantly created by the community.

Workflow

The ESS workflow using McStas is presented in the ESS DMSM Summer School. Neutron sources can be imported as MCPL files from other MC codes, such as PHITS. Then we can use the McStasScript Python API to create the instruments easily.

  • McStasScript Python API to make things easier
  • MCPL file format to transfer data between different Monte Carlo applications

Tutorials