Skip to content

Installation

tincotema edited this page Dec 19, 2023 · 1 revision

Installation Requirements

This package is available via pypi/pip

I do not rely on any of the prepackaged python code from the Mcstas code base. Thus you have to insure to have all necessary dependency and programs installed:

Linux

In order to have proper MPI support this script depends on the Open MPI implementation when using unix based systems. MPIexec will not work and leads to an error.

Windows

  • Python with (anaconda3 environment recommended)
    • numpy
    • matplotlib
    • mcpw
  • Mcstas installation
  • gcc (MinGW recommended, skip visual studio step if you use a different IDE)
  • mpiexec (for mpi support)

Run requirements

A mcstas instrument with all components

The Define Section of your instrument must have following Format:

DEFINE INSTRUMENT 'instrument'
(
    double x = 1.0,     //comment

	//comment
    int i = 1,          //comment
    float f = 1.0,      //comment
)

Empty lines will be ignored.

First setup and use

Requirements:

The mcpw_setup command creates all necessary files in order to use the mcpw_manager command.

Go to the directory where your mcstas instrument lies,

Then execute mcpw_setup:

mcpw_setup -I instrument.instr -m path_to_mcstas_executable -o output_directory

An already existing local_var.py or instrument.py file will not be updated or replaced.

If you have no errors and have two files: local_var.py and instrument.py in your working directory the setup step is completed.

Now you can run mcpw_manager to execute your simulation and all relevant functions you added in the python script.

The minimal command to run a simulation is:

mcpw_manager -p instrument.py full

For more advanced use cases have a look at mcpw_manager --help and the rest of this readme.