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


About McStas
 Conditions of use
 Project funding

 Linux Install (deb/rpm)
 Mac OS X Install
 Unix Install (src code)
 Windows Install
 Other Downloads (share)

Mailing list

Search web/mailinglist

 McStas manual
 Known problems
 C Compilers




Report bugs


McStas Ubuntu live-dvd

McStas 1.6: changes

Changes in version 1.6 alpha dev (October 29th, 2001)

  • Kernel/language
    • SHARE: In component definitions, a SHARE keyword followed by a C code block 
         %{...}% acts the same as a DECLARE block, but is only included once in an
         instrument. This is very useful when using many identical components
         (guides, monitors, monochromators) to speed-up compiling and perfomrnaces.
           %{ /* included only once for all identical components */
           %{ /* included for all components */
         Then all component programmers may add C functions to the 'kernel'. This is
         only worth when you plan to use a given component many times in a simulation
         (e.g. not for sources or samples). To downgrade a McStas 1.5 component, just
         move the SHARE block C code into the DECLARE block.
    • EXTEND: In an instrument definition, within the TRACE section, each COMPONENT
         instance may include a C code block:
           COMPONENT Comp1 = Guide(...)
           AT (...) ROTATED (...)
           %{ /* some C code to execute after component Comp1 */
              /* in current coordinate system. You may use Comp1 and global */
              /* instrument variables */
         For instance, you can here give a 'color' (additional neutron   
         characteristic) and modify next components behaviours.
         This block is always executed in groups, but you can test if the component
    • GROUP: In an instrument TRACE section, it is possible to put a set of component
         in an exclusive group. Only one of the elements of the group can act on
         the neutron. If no element acts on the neutron, it is absorbed.
         This is specially useful for multi-detectors, multi-monochromators in
         parallel, multiple collimators/guides (e.g. radial).
           COMPONENT Comp1 = Guide(...)
           AT (...) ROTATED (...) GROUP MyGroupName
           COMPONENT Comp2 = Guide(...)
           AT (...) ROTATED (...) GROUP MyGroupName
         Comp1 and Comp2 may even be at the same place.
         For programmers: it is important that the component TRACE section contains a
         SCATTER keyword when it successfully intercepts it, to tell McStas that a
         component in a group acts on a neutron, and can skip other comp in the group.
  • Library/functionalities at run-time
    • The signal handler now gives more info about where a signal was caught.
         For instance it tells in which component part an error occured, to make
         debuging easier.
         Usefull Signals: kill -Signal <pid>
            -USR1: display info and continue simulation
            -USR2: finish simulation and save results
            -QUIT: end simulation immediately
    • The 2D detectors now also output the errors/counts on signal as 1D detectors.
         Set p2=NULL in DETECTOR_OUT_2D to unactivate error saving in components.
    • There are now new MACROS for the component programmer.
           * mccompcurindex is the number (index) of the current component
             (1 is first component of instrument)
           * RESTORE_NEUTRON(index, x, y, z, vx, vy, vz, t, sx, sy, sz, p)
             restores the neutron state to the one at the input of the component
             'index'. To ignore a component effect, use
             RESTORE_NEUTRON(mccompcurindex, x, y, z, vx, vy, vz, t, sx, sy, sz, p)
             at the end of its TRACE section, or in its EXTEND section.
             These neutron states are in the local component coordinate systems.
           * STORE_NEUTRON(index, x, y, z, vx, vy, vz, t, sx, sy, sz, p)
             stores the current neutron state in the trace-history table, in local
             coordinate system. This is automatically done when entering each
             component of an instrument.
           * POS_A_COMP_INDEX(index) is the absolute position of component
             'index'. POS_A_COMP_INDEX(mccompcurindex) is the same as
             POS_A_CURRENT_COMP. You may use POS_A_COMP_INDEX(mccompcurindex+1) to
             make, for instance, your component access the position of the next
             component (this is usefull for automatic targeting).
           * SCATTERED is non zero when previous component acted on neutron (let pass
             or scatter)
    • Warning: programmers, do not use anymore the 'mccompcurname' when writing
         your components. rather use the 'NAME_CURRENT_COMP'.
  • McStas tools (mcrun, mcplot, mcgui, etc...)
    • In 'mcplot', it is possible to use the -ps, -psc and -gif options to
         generate a PS, color PS, and GIF file, and exit mcplot (no display).
  • Updated/modified components
    • The Monitor_nD was upgraded to correct bugs when reaching the component
         (the propagation was not performed correctly in some cases), and the disk/
         sphere radius (monitor remained then squared). This component now uses
         the SHARE block. A bug was corrected for lists. It can output log and abs of
         signals, and source files (see Source_file).
    • The Gravity_guide now handles correctly the focusing multichannel guides.
         Gravitation is included (on y axis). This component now uses the SHARE block.
         The Channeled_guide does not handle properly the focusing multichannels.
    • Moved to obsolete components (usually because they awere renamed):
              monitors: PSD_monitor_4PI_log.comp, PSD_bidim.comp, PSD_curved.comp,
              samples: Powder0.comp
                  Beamstop_circular Beamstop_rectangular (gathered into Beamstop)
                  First_Chopper (included in Chopper)
                  Circular_slit (included in Slit)
    • tested and corrected components
      • misc: Vitess_input/output: included Spin from Vitess. (vitess-lib.c/h)
                  but can not be used as mcstas can not find vitess-lib.c/h. I included
                  what was needed in SHARE sections. now works OK.
      • samples:
                    Single_crystal (now can take lattice angles, forgot a %} at SHARE
                    provide *.dat diffraction samples from Crystallographic
      • optics:
                    Beamstop now is a merging of Beamstop_circular and
                      Beamstop_rectangular (using default  values to select shape)
                    Channeled_guide: now output an error in multichannel focusing mode.
                    Chopper: determined default values to have lambda~4 AA. Can handle
                      First_Chopper (parameter IsFirst)
                    Fermi_Chopper : default values for transmission every ~2 AA
                    Gravity_guide: limit loops to max of 1000 bounces for each
                      components (to avoid endless loops)
                    Mosaic_anisotropic: can take DM (d-spacing). default for graphite.
                    Powder_filter (did not work at all, now can take lattice angles,
                      also works as a sample, can take samples/*.dat diffraction files)
                    Selector: default values for transmission at ~4 AA
                    Slit: now is a merging of Slit and Circular_slit (using default
                      values to select shape)
                    Soller: can take transmission
                    V_selector: default values for transmission at ~4 AA
      • sources
                    Source_gen: can handle all previous sources in one component (up to
                      3 Maxwellians). Corrected homogeneity bug for illumination.
                    Source_file: can read 'source' files from Vitess, text files (both
                      90 bytes/neutron) and float binary  files (e.g, from Monitor_nD
                      with options="list all, source binary" which is more compact in 
                      size, 48  bytes/neutron). Autorecognition of the format. The MCNP
                      output is not fixed. Just tell MCNP  guys to output the float
                      binary or text file.
  • New components
    • The Source_gen component focuses uniformly on the target, and can model
         rectangular, disk, gaussian, and Maxwellian (up to 3 distributions) sources.
         Previous source components did not focus correctly on the target. They were
         also corrected, execpt the 'Source_Maxwell'. Source_gen can replace all thee
         previous sources.
    • A new Source_file component can take as input a text file containing an
         array with columns ' x y z vx vy vz t sx sy sz p', such as the data files
         generated from Monitor_nD with options="list all source". The source may
         be re-generated more than once, which is useful to improve accuracy,
         specially when further components do MC choices. Vitess files and float
         binary files are also ok (auto-recognition of format).
    • We tried to lower the number of components by merging similar ones.

Last modified October 31, 2001 by Per-Olof Åstrand

Last Modified: Friday, 25-Feb-2005 16:28:29 CET
Search website mailinglist archive GitHub repos