1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5,...

25
1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5 , Emmanuel Farhi 2 , Erik Knudsen 1,5 , Emmanouela Rantsiou 3,6 , Kim Lefmann 4,5 1 Physics Department, Technical University of Denmark, Denmark 2 Calcul Scientifique, Institut Laue-Langevin, France 3 Laboratory for Developments and Methods, Paul Scherrer Institute, Switzerland 4 Niels Bohr Institute, University of Copenhagen, Denmark 5 ESS design update programme, Denmark 6 ESS design update programme, Switzerland

Transcript of 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5,...

Page 1: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

1

Introduction to McStas, Berlin MC school 2013

Introduction to McStas

Peter Willendrup1,5, Emmanuel Farhi2, Erik Knudsen1,5, Emmanouela Rantsiou3,6, Kim Lefmann4,5

1Physics Department, Technical University of Denmark, Denmark2Calcul Scientifique, Institut Laue-Langevin, France3Laboratory for Developments and Methods, Paul Scherrer Institute, Switzerland4Niels Bohr Institute, University of Copenhagen, Denmark5ESS design update programme, Denmark6ESS design update programme, Switzerland

Page 2: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

2Introduction to McStas, Berlin MC school 2013

Agenda

•An introduction to McStas

•Instruments, components, the neutron ray

•Quick overview of example instruments

•A quick demo

Page 3: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

3Introduction to McStas, Berlin MC school 2013

McStas Introduction

GNU GPL license

Open Source

[email protected] mailinglistProject website athttp://www.mcstas.org

Page 4: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

4Introduction to McStas, Berlin MC school 2013

McStas Introduction•Flexible, general simulation utility for neutron scattering experiments.

•Original design for Monte carlo Simulation of triple axis spectrometers

•Developed at RISØ DTU, KU and ILL, Grenoble.

•V. 1.0 by K Nielsen & K Lefmann (1998)

•Currently 2.5+1 people full time plus students

4

GNU GPL licenseOpen Source

[email protected] mailinglistProject website athttp://www.mcstas.org

McXtrace - since jan 2009 similar in X-rays

• Synergy, knowledge transfer, shared infrastructure

Page 5: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

5Introduction to McStas, Berlin MC school 2013

McStas Introduction

GNU GPL license

Open Source

[email protected] mailinglistProject website athttp://www.mcstas.org

Page 6: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

6

•InstrumentationVirtual experimentsData analysisTeaching

Introduction to McStas, Berlin MC school 2013

What is McStas used for?

6

(KU, DTU, schools & workshops)

Page 7: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

7Introduction to McStas, Berlin MC school 2013

Reliability - cross comparisons

P. Willendrup et al., Physica B, 386, (2006), 1032.E. Farhi, P. Willendrup et al., in preparation

Page 8: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

8Introduction to McStas, Berlin MC school 2013

McStas: key concepts

Time (t)

Page 9: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

9Introduction to McStas, Berlin MC school 2013

McStas: key concepts

Page 10: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

10

Introduction to McStas, Berlin MC school 2013

McStas: key concepts

Page 11: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

11

Introduction to McStas, Berlin MC school 2013

McStas: key concepts Local, internal coordinate system!

Page 12: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

12

Introduction to McStas, Berlin MC school 2013

McStas: key concepts

Page 13: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

13

Introduction to McStas, Berlin MC school 2013

McStas overview

Page 14: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

14

Introduction to McStas, Berlin MC school 2013

Under-the-hood / inner workings

Code generation

Page 15: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

15

Introduction to McStas, Berlin MC school 2013

Implementation

Page 16: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

16

Introduction to McStas, Berlin MC school 2013

Instrument file

Page 17: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

17

Introduction to McStas, Berlin MC school 2013

Component file

Page 18: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

18

Introduction to McStas, Berlin MC school 2013

Generated c-code

Page 19: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

19

Introduction to McStas, Berlin MC school 2013

Writing new comps or understanding existing is not that complex...

Page 20: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

20

Introduction to McStas, Berlin MC school 2013

Example suite: 86 instruments

Page 21: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

Introduction to McStas, Berlin MC school 2013

Including user contribs•Well-developed community support

•30-40% of existing and new additions are from users

•No direct refereeing of the code, but these requirements:

•At least one test-instrument

•Meaningful documentation headers (in-code docs)

•Contributions go in dedicated contrib/ section of library

•Natural life-cycle of contrib’s

•Bug-fixes are applied both by contributor and developers

•If contributor becomes unavailable either:

•Many users of comp: Promote to official components, e.g. in optics/

•Few/no users of comp: Move to obsolete/ until next major release

Page 22: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

22

Introduction to McStas, Berlin MC school 2013

Documentation•Basic use info is available inside comp & instr codes, extracted by perl to html

•100+ page manuals documenting•Metalanguage•What is “under the hood”•Examples of practical use plus advanced features•Assumptions and algorithms applied in the components

•More than 70 example instruments

•Various tutorial and teach yourself solutions are available

Page 23: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

Introduction to McStas, Berlin MC school 2013

Enough Talk!Let’s see McStas run?

Page 24: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

24

Introduction to McStas, Berlin MC school 2013

People

Page 25: 1 Introduction to McStas, Berlin MC school 2013 Introduction to McStas Peter Willendrup 1,5, Emmanuel Farhi 2, Erik Knudsen 1,5, Emmanouela Rantsiou 3,6,

25

Introduction to McStas, Berlin MC school 2013

Demo time?