**************************************************************************** 
This is a demo of how to generate a wiggler source with SHADOW.
**************************************************************************** 
System PSLC (vms 4.5)

Username: XRAYOP
Password: 
                    Welcome to VAX/VMS Version 4.5
                  University of Wisconsin - Madison
                     Physical Sciences Laboratory

   Working set quotas on PSLC have been raised to 1 MegaByte.

    Last interactive login on Thursday, 14-JAN-1988 14:39
    Last non-interactive login on Wednesday, 13-JAN-1988 13:21

    You are logged into _RTA1:


Defining Logical Names and Environmental Parameters
Graphics device [e.g. TTD3: ] ? : tt

All logical names and command defined.

Enter $GO to activate SHADOW.

Enter HELPSHA for help.

Type NEWS for recent modifications.: 
$ SD [.WIGGLER]
$ DIR
%DIRECT-W-NOFILES, no files found
!
! EPATH is the program to generate the electron trajectory.
!
$ EPATH
Enter number of periods :  10
Enter wavelength of undulator (m) :  0.10
Enter magnetic field (tesla) :  1.60
Enter electron energy (GeV) :  1.0
Enter number of points per period along undulator axis:  100
Trajectory file for input to NPHOTON :  TRAJ.DAT
Parameters file-name :  WIGGLER.PAR
Write out data for ERAD ?  N
$ DIR

Directory D13:[XRAYOP.WIGGLER]

TRAJ.DAT;1              287  14-JAN-1988 14:45  (RWED,RWED,RE,E)
WIGGLER.PAR;1             2  14-JAN-1988 14:45  (RWED,RWED,RE,E)

Total of 2 files, 289 blocks.
!
! The input and output parameters are listed in WIGGLER.PAR.
!
$ TY WIGGLER.PAR
------   INPUT    ---------
Number of periods               =           10
Undulator Wavelength      [ m ] =   0.1000000000000000    
Beam Energy             [ GeV ] =    1.000000000000000    
Peak Magnetic field   [ Tesla ] =    1.600000000000000    
------   OUTPUT    ---------
Gamma                           =    1956.719408033874    
Fundamental              [ Ev ] =   0.8434549946939766    
Fundamental       [ Angstroms ] =    14701.39796264204    
K                               =    14.93827163024639    
Equivalent SR C.W.     [ Angs ] =    11.62500000000000    
              C.E.       [ eV ] =    1066.539354838710    
!
! The actual data of the trajectory is stored in TRAJ.DAT in the following 
! format for each point along the axis :
!                  X           Y          Beta X
!                 Beta Y      1/R
! where (X,Y,Z) used SHADOW's reference frame, Beta is v/c, R the instanteous
! radius of curvature. Metric units (meter) are used.
!
! The trajectory data for the first three points are shown below.
!
$ TY TRAJ.DAT
 0.0000000000000000E+00 -0.5000000000000000      0.0000000000000000E+00  
 0.9999998694090963      0.4796800626418529    
 2.4462725087902418E-07 -0.4989898989898990      4.8420004016270703E-04 
 0.9999997521842346      0.4787143114857681    
 9.7752578984337230E-07 -0.4979797979797980      9.6645037765906585E-04  
 0.9999994023957600      0.4758209467565633    
         .                     .                         .
         .                     .                         .
         .                     .                         .
         .                     .                         .
!
! NPHOTON calculates the number of photons that will be generate at each
! trajectory point, within the photon energy range that the user specified.
!
$ NPHOTON
Name of input file :  TRAJ.DAT
Read          991 points from input file.
Beam energy (GeV) =   0.9998566215505944    
Radius of curvature (max.) =    131.3959175897241     m     ! These are the 
                    (min.) =    2.084722876519964     m     ! equivalent R
Critical Energy (max.) =    1063.698541302184     eV	     ! and Ec of a
                (min.) =    16.87660258743838     eV	     ! bending magnet.
Minimum photon energy [ eV ] :  1
Maximum photon energy [ eV ] :  100
Name of output file :  W1_100.DAT			     ! unformatted 
Total no.of photons =   1.7403990896625917E+16
!
! Now we can generate the source.
!
$ GO SOURCE



  :::::::  :::    ::            :::    :::::::        :::::     :::  ::  ::
 ::::::::  :::    ::           ::::    ::::::::      :::::::    :::  ::  ::
:::        :::    ::          ::: :    :::   :::    :::    ::   :::  ::  ::
:::        :::    ::         ::: ::    :::    ::    :::    ::   :::  ::  ::
 :::::::   :::::::::        :::  ::    :::    ::    :::    ::   :::  ::  ::
  :::::::  :::::::::       :::   ::    :::    ::    :::    ::   :::  ::  ::
       ::  :::    ::      :::    ::    :::    ::    :::    ::   :::  ::  ::
      :::  :::    ::     :::     ::    :::   :::    :::   :::   ::: ::: :::
::::::::   :::    ::    :::      ::    ::::::::      :::::::     :::::::::
:::::::    :::    ::   :::       ::    :::::::        :::::       ::: :::




VERSION     87.3                                               1 December 1987




Hit <RETURN> when ready: 


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  ------------------------------- 
Mar 1987                                         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 ? 1

------------- SOURCE SPECS ------------------
Options available:
Random in  BOTH REAL and MOMENTUM space		      0
Grid       BOTH					      1
Grid       REAL, random  MOMENTUM	              2
Random     REAL,  grid   MOMENTUM		      3
Ellipses in PHASE space, random around each ellipse   4
Ellipses in PHASE space,   grid around each ellipse   5
Source modelling type [ 0-5 ] ?  0
How many rays [ 1 - 5 000 ] ?  1000
Seed [ odd, 1000 - 1 000 000 ] ?  24579
Do you want to optimize the source ?  0

Is this a wiggler source ?  1
File containing the electron trajectory ?  W1_100.DAT
Conversion factor from meters to user units ?  100		! Lets use cm.
Sigma along X ?  0.0050					! 50 microns
            Z ?  0.0050					! 50 microns
Horizontal half-divergence [ (+)x, rads ] ?  0.005
                           [ (-)x, rads ] ?  0.005
Vertical                   [ (+)z, rads ] ?  0.005
                           [ (-)z, rads ] ?  0.005
Electron beam emittance.  Units are : rads*[ units of length used so far ]
Beam emittances in X [ at waist ] ?  1E-6			! 1e-8 m*rad
Distance of wiggler's center from X waist [ signed ] ?  0
Beam emittances in Z [ at waist ] ?  5E-7			! 5e-9 m*rad
Distance of wiggler's center from Z waist [ signed ] ?  0

Polarization component of interest. Enter 
parallel polarization    1
perpendicular            2
total                    3
                   then ? 
Polarization Selected [ 1-3 ] ?  3

Do you want to store the optical paths (OPD) [Y/N] ?  N
Do you want to generate the A vectors (electric field) [Y/N] ? N
Exit from INPUT_SOURCE


Generated          250 rays out of         1000
                   500
                   750
                  1000
Exit from SOURCE
SOURCE => Source has been succesfully generated.

SOURCE procedure completed.

Shadow:: EXIT


Exit to DCL

$ DIR

Directory D13:[XRAYOP.WIGGLER]

BEGIN.DAT;1             188  14-JAN-1988 14:51  (RWED,RWED,RE,E)
END.00;1                  7  14-JAN-1988 14:51  (RWED,RWED,RE,E)
START.00;1                7  14-JAN-1988 14:50  (RWED,RWED,RE,E)
TRAJ.DAT;1              287  14-JAN-1988 14:45  (RWED,RWED,RE,E)
W1_100.DAT;1            101  14-JAN-1988 14:47  (RWED,RWED,RE,E)
WIGGLER.PAR;1             2  14-JAN-1988 14:45  (RWED,RWED,RE,E)

Total of 6 files, 592 blocks.
!
! Lets prepare a top view of the source.
!
$ PREPLOT
PREPLOT> Input file ?  BEGIN.DAT
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 :  2
PREPLOT>       2 :  1
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 ?  0
***********
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 ?  BEGIN.YX
!
! Now prepare a top view of the trajectory.  COL_2 is used to write out two
! columns from a N-columns file.
!
$ COL_2
input file :  TRAJ.DAT
How many columns in the input file :  5
output file :  TRAJ.YX
Column 1 :  2
Column 2 :  1
$ TDFILE
TOP DRAWER (10/10/80) NOW EXECUTING

MOD NOECHO
           1  MOD NOECHO                                 
                                                                           
@BEGIN.YX
READING FROM INDIRECT COMMAND FILE: BEGIN.YX                        
           2     39.68063      1.4937155E-04             
                                                                           
END OF INDIRECT COMMAND FILE
PLOT
        1002  PLOT                                       
                                                                           
ORDER X 100 Y 100			! The trajectory file used m instead
        1003  ORDER X 100 Y 100        ! of cm, thus has to be multiply by 100
                                                                           
@TRAJ.YX
READING FROM INDIRECT COMMAND FILE: TRAJ.YX                         
        1004   -0.5000000000000000      0.0000000000000000E+00  
                                                                           
 PRINTING SUPPRESSED AFTER     0 POINTS.  (PLOT CONTINUES.)
END OF INDIRECT COMMAND FILE
JOIN 1
        1995  JOIN 1                                            
                                                                           
END
        1996  END                                               
                                                                           
FORTRAN STOP
$ LOG
  XRAYOP       logged out at 14-JAN-1988 14:54:37.25
