McCode icon indicating copy to clipboard operation
McCode copied to clipboard

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.

/******************************************************************************* *

  • McStas, neutron ray-tracing code generator
  •     Copyright 1997-, All rights reserved
    
  •     Technical University of Denmark, Kongens Lyngby, Denmark
    
  •     Institut Laue Langevin, Grenoble, France
    
  • McXtrace, X-ray ray-tracing code generator
  •     Copyright 2009-, All rights reserved
    
  •     Technical University of Denmark, Kongens Lyngby, Denmark
    
  •     Synchrotron SOLEIL, Paris-Saclay, France
    
  • Documentation: README
  • %Identification
  • Written by: KN, KL, PEO, EF, PW, EK
  • Date: 2022
  • Origin: Risoe
  • Release: all McStas and McXtrace
  • This file is part of McStas / McXtrace.
  • %Link
  • Official McStas website
  • Official McXtrace website
  • %End *******************************************************************************/

This is McStas 2.x and McXtrace 1.x

Copyright (C) Technical University of Denmark, 1997-. All rights reserved. See the file COPYING for conditions on use.

This software is covered by the GNU General Public License. User instrument files generated by McStas/McXtrace, output data or papers based on these use is NOT considered "derived work" but is considered normal usage of the software.

The random number algorithm used by default in McStas/McXtrace is the "Mersenne Twister", by Makoto Matsumoto and Takuji Nishimura (see http://www.math.keio.ac.jp/~matumoto/emt.html). This code is included in the file lib/share/mccode-r.c and is distributed under the terms of the GNU Library General Public License.

If you wish to use McStas/McXtrace in ways that contradict the conditions, contact us and chances are that we will be able to make a suitable arrangement.

Installation instructions are in the doc/install_docs directory.

Changes from previous versions are in the file CHANGES. Please read that !

To get started, some example instrument definitions have been supplied in the mcstas-comps/examples/ and mcxtrace-comps/examples directories. To run a simulation, the command `mcrun' (or mxrun) is used. For example:

mcrun ISIS_Prisma2.instr -n2e6 TT=-30 PHA=22 PHA1=-3 PHA2=-2 PHA3=-1 PHA4=0 PHA5=1 PHA6=2 PHA7=3 TTA=44

This will first compile the instrument definition (if necessary) and subsequently run it. It is also possible to run simulations from the graphical user interface `mcgui' (or mxgui), or to compile and run simulations manually.

The output files will be put in the current directory by default. The file tas1-scans in the example directory is a script that will run a series of simulations that constitute a line-up experiment of the TAS1 spectrometer at Risoe.

To fully utilize McStas/McXtrace, you will need a copy of the manual. It may be found in the lib/doc directory of the distribution.

The manual, along with much other information, is available from the McStas WWW home page:

http://www.mcstas.org

or in the case of McXtrace:

http://www.mcxtrace.org

User mailinglists: [email protected] [email protected]

Feel free to direct any comments or questions to these mailinglist addresses. It is an important goal of the McStas and McXtrace projects to have the programs widely used, so if you have a reasonable request there is a good chance that we will be willing to help you out.

Contacts for McStas are: Peter Kjaer Willendrup [email protected] (PW) Erik Knudsen [email protected] (EK)
Emmanuel Farhi [email protected] (EF) Kim Lefmann [email protected] (KL)

Contacts for McXtrace are: Peter Kjaer Willendrup [email protected] (PW) Erik Knudsen [email protected] (EK) Emmanuel Farhi [email protected] (EF)

Previous authors are: Kristian Nielsen, email (KN) Per-Olof AAstrand (PEO) Klaus Lieutenant (KL2) Peter Christiansen (PC)

Some parts of McStas/McXtrace require additional software to be installed in order to work. The needed software packages are either included as part of your installation bundle (Windows/macOS) or come as dependencies of the installation packages (Linux)

  • The 'mcstas/mcxtrace' base programs only requires a C compiler, which is usually provided with most Unix/Linux systems. For Windows, a MinGW C compiler is shipped with Strawberry-Perl which is distributed alongside the installers.
  • The `mcrun/mxrun' front-ends require Perl or python
  • The `mcdisplay/mxdisplay' front-ends requires Perl or python plus graphical backend(s)
  • The `mcplot/mxplot' front-ends requires Perl or python plus graphical backend(s)
  • The `mcgui/mxgui' graphical user interface requires python, PyQt and optionally qscintilla for the built in instrument editor. Alternatively an external editor can be used, we recommend gedit.