
/* Example of use of mosaic crystal in transmission (Laue) geometry.
   We will generate a punctual source at 8035 eV with only vertical
   divergence (VD=8mrad) and then trace a Berylium (002) mosaic crystal
   0.025 cm thick and with 0.114 deg (fwhm) mosaicity.
   We will analyze the intensity against Z' at the image in order to
   reproduce the "rocking curve"                                */


sanchez@sol> GO source

SOURCE selected. Begin procedure.

This procedure generates a SOURCE for SHADOW.
Mode selected [ ? <ret> for HELP ] ? prompt
Call to INPUT
---------------------------------- S H A D O W  ------------------------------- 
 Jan 1992                     F.Cerrina                         ECE - UW         

 Defining source : 
When prompted for a yes/no answer, you may enter:
for   YES  answer      Y, 1
for   NO   answer      anything else




 Do you want a verbose [ 1 ] or terse [ 0 ] output ?
------------- SOURCE SPECS ------------------
 Source modelling type [ 0-5 ] ? 
 How many rays [ 1 - 5 000 ] ? 1000
 Seed [ odd, 1000 - 1 000 000 ] ? 233343
 Do you want to optimize the source ? 
 Source type : [ 0 ] regular source
              [ 1 ] normal wiggler
              [ 2 ] undulator
              [ 3 ] elliptical wiggler
 Then ? 
 X-Z plane source type [ 0-3 ] ? 
 Source Depth [ 1-4 ] ? 
 Source Angle Distribution [ 1-6 ] ? 
 Horizontal half-divergence [ (+)x, rads ] ? 0
                            [ (-)x, rads ] ? 0
 Vertical                   [ (+)z, rads ] ? .004
                            [ (-)z, rads ] ? .004
 Do you want a Photon energy [ Y/N ] ? 1
 Energy distribution [ 1-3 ] ? 1
 Photon Energy [ 0 ] or Angstroms [ 1 ] ? 0
 Energy [ eV ] ? 8035
 Do you want to store the optical paths (OPD) [Y/N] ? 
 Do you want to generate the A vectors (electric field)          [Y/N] ?
Exit from INPUT_SOURCE
Calling gen_source with /u1/src/shadow-6000/bin/gen_source start.00
Generated   250 rays out of   1000
            500
            750
            1000
Exit from SOURCE
SOURCE => Source has been succesfully generated.

SOURCE procedure completed.

Shadow:: exit


/* Now generation of crystal data running BRAGG with the following input: */

sanchez@sol> more bragg.inp
4
2.2866
3.5833
0
0
2
BE
.25,1.838
.30,1.705
.35,1.613
6000
20000
100
1
1
be6_20.002
0
sanchez@sol> bragg < bragg.inp

/* Now we run trace. Remember to use REFRACTIVE case                 */

sanchez@sol> GO trace

Ray Tracing Selected. Begin procedure.

Mode selected [ ? <ret> for HELP ] ? pron mpt
Call to RESET
Exit from RESET
Mode selected is: 
PROMPT                                                                          
Options: to start anew                 [ 0 ] 
            to restart from a given OE [ 1 ] 
 Then ? 
Call to INPUT_OE
---------------------------------- S H A D O W  ------------------------------- 
 Jan 1992                     F.Cerrina                         ECE - UW         
 
When prompted for a yes/no answer, you may enter:
for   YES  answer      Y, 1
for   NO   answer      anything else
 

 Defining Optical Element:  1
 Continue ? [ EXIT to terminate OS ] 




 Do you want a verbose [ 1 ] or terse [ 0 ] output ?
 
Files to write out. Options: 
All............................ [ 0 ] 
Mirror only.....................[ 1 ] 
Image at CP only................[ 2 ] 
None............................[ 3 ] 
  Then ? 
 Optical Element definition:
 Incidence Angle ? 
 Source Distance ? 1000
 Reflection Angle? 
 Image Distance  ? 1000
 Reflector [ 0 ] or refractor [ 1 ] ? 1
 Mirror surface [ 1-9] ? 5
 Is the mirror Cylindrical ? 
 Is this optical element a Fresnel Zone Plate ? 
 Are we dealing with a Grating ? 
 Are we dealing with a crystal [ Y/N ] ? 1
 File containing crystal parameters ?
 be6_20.002
 Is it a mosaic crystal [ Y/N ] ? 1
 What is the crystal thickness [cm] ? .025
 What is the mosaic spread FWHM [deg] ? .114
 Give me a random seed [odd, integer] ? 213948737
 Automatic Tuning of Crystal [ Y/N ] ?1
 Energy, in eV, [ 0 ] or wavelength, in Angs., [ 1 ] ? 
 Photon Energy ? 8035
 Is the mirror convex [ Y/N ] ? 
 Orientation Angle [ Alpha ] ? 
 Mirror Dimensions finite [ Y/N ] ?
 Do you want to move the Source [ Y/N ] ? 
 Do you want to move the mirror itself [ Y/N ] ? 
 Distorted surface [ Y/N ] ? 
 Do you want to include surface roughness [Y/N] ? 
 Any screens in this OE [ Y/N ] ? 
 Slit at continuation plane [ Y/N ] ? 
 Extra Image plates [ Y/N ] ? 
 File containing the source array ? begin.dat
Exit from INPUT
Tracing optical element #   1
Call to SETSOUR
Exit from SETSOUR
Call to IMREF
Exit from IMREF
Call to OPTAXIS
Exit from OPTAXIS
Call to MSETUP
Exit from MSETUP
Call to RESTART
Exit from RESTART
Call to MIRROR
SHADOW-E-Error: 
Module     : Error from GNORMAL
Message    : Value outside the interval
Error flag :   129
Exit from MIRROR
Call to IMAGE
Exit from IMAGE
Call to RESET
Exit from RESET
[H[2J Do you want to change input mode ? 
Call to INPUT_OE
---------------------------------- S H A D O W  ------------------------------- 
 Jan 1992                     F.Cerrina                         ECE - UW         

 Defining Optical Element:  2
 Continue ? [ EXIT to terminate OS ] exit
End of session
 Warning: the following IEEE floating-point arithmetic exceptions 
 occurred in this program and were never cleared: 
 Inexact;  Division by Zero;  Underflow; 

Procedure completed.

Shadow:: exit
7.5u 3.6s 1:53 9% 0+524k 21+32io 55pf+0w

/*  Now run PREPLOT                                                 */

sanchez@sol> preplot
 PREPLOT> Input file ? star.01
Read           1000 rays.
Each ray has   12 entries.
 PREPLOT> How many columns to write out ? 2
 Row [1-12]  : the individual column
Row   [20]  : R = SQRT(X**2 + Y**2 + Z**2)
Row   [21]  : angle from the Y-axis
Row   [22]  : the magnitude of A vector
Row   [23]  : A**2
 PREPLOT> Row # 1 : 6
 PREPLOT>       2 : 23
Options --- Enter
0 for excluding the losses
1 for including losses at a particular O.E.
2 for plotting all the rays .
3 for plotting ONLY the losses (all of them)
4 for plotting ONLY the losses at a given O.E.
 PREPLOT> Then ? 
***********
Found   1000 good points out of  1000
Output options :
  [ 0 ] store rays in a file
  [ 1 ] plot directly on screen
  [ 2 ] both
 Then ? 0
 PREPLOT> Output file ? preplot.dat



