 c    unless otherwise stated, all macros have NBEAM = 1
 c    and NLINE = 1024
.exam03                                                                          
 c    echo shows commands as they are read    
 echo 1                                                                          
 c    color displays wavelength
 color                                                                           
 c    beam 1 has unit intensity, supergaussian is 90, so
 c       the beam is a flat-top, radius is 0.5
 fluence 1 1 90. 0.5                                                             
 status                                                                          
 dump 1 270 275
 c    plot intensity of beam 1 from -2 to 2 cm across beam                                                                  
 intplot 1 -2 2                                                                  
 c    propagate beam 100 cm and look at new beam intensity
 dist 100                                                                        
 status                                                                          
 intplot 1 -2 2
 c    put lens in beam                                                                  
 lens 1 100           
 c    propagate to focal plane                                                           
 dist 100.                                                                       
 status                                                                          
 intplot 1 -1 1
 c  plot intensity from 0 to 2.5 cm, all beam points, 9 log cycles                                                                  
 intplot 1 0 2.50 0 9                                                            
 echo 0                                                                          
.eom                                                                             
.exam04                                                                          
 echo 1                                                                          
 fluence 1 1 1 4
 c    color sets wavelength
 color 1 1.                                                                      
 c    clap sets clear aperture semidimension
 clap 1 .5                                                                       
 tiltmrad 1 20.                                                                  
 status                                                                          
 phaplot                                                                         
 dist 50                                                                         
 tiltmrad 1 -40.                                                                 
 phaplot                                                                         
 dist 50.                                                                        
 status                                                                          
 phaplot                                                                         
 intplot                                                                         
 echo 0                                                                          
.eom                                                                             
.exam05                                                                          
 echo 1                                                                          
 units 3 .04                                                                     
 color 3 1.                                                                      
 clap -1 1 1.5 -2.0                                                              
 fluence -1 1. 50. 1.5 2.0                                                       
 obs 1 0.5 1.5                                                                   
 clap -2 1.5 -2.0                                                                
 fluence -2 1 1 1.5 -2.0                                                         
 obs 2 0.5 -2.5                                                                  
 status                                                                          
 intplot 1                                                                       
 intplot 2                                                                       
 lens -3 50. 2.0                                                                 
 dist 100                                                                        
 status                                                                          
 intplot 1                                                                       
 intplot 2                                                                       
 echo 0                                                                          
.eom                                                                             
.exam07                                                                          
 echo 1                                                                          
 units 1 0.1                                                                     
 fluence 1 1.0 1 1.0                                                             
 bell                                                                            
 readtty                                                                         
 status                                                                          
 writedisk                                                                       
 intensity 1                                                                     
 writetty                                                                        
 intensity 1                                                                     
 echo 0                                                                          
.eom                                                                             
.exam08                                                                          
 echo 1                                                                          
 c    assumes 2 beams, by 512 points per beam                                                    
 color 0 16.                                                                     
 units 0 0.01                                                                    
 fluence -1 1 90 1                                                               
 fluence 2 1 90. 1                                                               
 intplot 1                                                                       
 intplot 2                                                                       
 dist 100                                                                        
 intplot 1 0 3                                                                   
 intplot 2 0 3                                                                   
 dist 400                                                                        
 intplot 1 0 3                                                                   
 intplot 2 0 3                                                                   
 lens -1 50.0                                                                    
 lens 2 50.0                                                                     
 status                                                                          
 dist 50                                                                         
 intplot 1 0 0.2                                                                 
 intplot 2 0 0.2                                                                 
 echo 0                                                                          
.eom                                                                             
.exam12                                                                          
 echo 1                                                                          
 c           nbeam = 1,  nline = 16                                              
 color 1 1                                                                       
 units 1 0.1                                                                     
 fluence -1 1.0 1 0.5                                                            
 obs 1 .2 .2                                                                     
 intensity 1                                                                     
 intplot                                                                         
 dist 10.                                                                        
 mirror -1 5. 1.                                                                 
 dist -10.                                                                       
 intensity 1                                                                     
 intplot                                                                         
 mirror -1 5 1.                                                                  
 status                                                                          
 echo 0                                                                          
.eom                                                                             
.exam13mac                                                                       
 engnorm 1                                                                       
 writedisc                                                                       
 clap 1 .3                                                                       
 mirror 1 -90.                                                                   
 dist -90.                                                                       
 mirror 1 180.                                                                   
 clap 1 0.8                                                                      
 dist 90.                                                                        
 writetty                                                                        
.eom                                                                             
.exam14                                                                          
 echo 1                                                                          
 c  assumes NBEAM = 4 and NLINE = 256                                            
 c  does a flat-top intensity function                                           
 color 0 .3                                                                      
 units 0 .024                                                                    
 fluence -5 2 20 3                                                               
 clap -5 2.                                                                      
 obs 1 .12                                                                       
 obs 3 2 -1.88                                                                   
 obs 4 2 1.88                                                                    
 dist 3000                                                                       
 zero 2                                                                          
 addinc 2 3 4                                                                    
 status                                                                          
 energy                                                                          
 intplot 2                                                                       
 intplot 3                                                                       
 intplot 1                                                                       
 echo 0                                                                          
.eom                                                                             
.exam15                                                                          
 echo 1                                                                          
 c   assumes nbeam = 3 and nline = 512                                           
 color 0 0.3                                                                     
 units 0 0.012                                                                   
 fluence -4 2 20 3                                                               
 clap -4 2.0                                                                     
 obs 1 0.12                                                                      
 obs 2 2 -1.88                                                                   
 obs 3 2 1.88                                                                    
 dist 3000                                                                       
 addcoh 2 3                                                                      
 status                                                                          
 energy                                                                          
 intplot 1                                                                       
 intplot 2                                                                       
 intplot 3                                                                       
 echo 0                                                                          
.eom                                                                             
.exam16                                                                          
 echo 1                                                                          
 c      nbeam = 2 and nline = 128                                                
 units 3 0.5                                                                     
 color 1 16.0                                                                    
 color 2 10.59                                                                   
 clap -3 20.                                                                     
 setbeer 0.5 1e4 3 10.0                                                          
 setgco2 0.5 1e4 3 10.                                                           
 beer 1 10. 2                                                                    
 intensity 1 0 25 6                                                              
 intplot                                                                         
 gainco2 3 10 2                                                                  
 intensity 1 0 25 6                                                              
 intensity 2 0 25 6                                                              
 intplot 1                                                                       
 intplot 2                                                                       
 echo 0                                                                          
.eom                                                                             
.exam17                                                                          
 echo 1                                                                          
 color 5 11.0                                                                    
 color 1 16.0                                                                    
 fluence 1 1 1 0.4                                                               
 fluence 2 20 1 0.4                                                              
 fluence 3 30 1 0.4                                                              
 fluence 4 40 1 0.4                                                              
 energy                                                                          
 dist -500.0                                                                     
 zreff 0 0.0                                                                     
 raman 1000 5 5.e-5                                                              
 intensity 1 0 2.0 6                                                             
 intensity 2 0 1.0 6                                                             
 intensity 3 0 1.0 6                                                             
 intplot 1                                                                       
 intplot 2                                                                       
 intplot 3                                                                       
 echo 0                                                                          
.eom                                                                             
.exam18                                                                          
 echo 1                                                                          
 c  assumes NBEAM = 2 and NLINE = 128                                            
 c  does various functional forms for the phase profile                          
 units 1 .05                                                                     
 fluence -1 2. 2 2.                                                              
 bell                                                                            
 cabgau 0. 0.2 2                                                                 
 cabpow 0. 0 0 0 0 0 0 0.5 0 -0.5                                                
 cabsin 0.4 1.5 45.                                                              
 cabzer 3. 0. 0. 0. 0. 0. 0. 0. 0. 0.5                                           
 copy 1 2                                                                        
 abrgau 1 0.5                                                                    
 strl                                                                            
 phaplot 1 -3.0 3.0                                                              
 copy 2 1                                                                        
 abrpow 1                                                                        
 strl                                                                            
 phaplot 1 -2.0 2.0                                                              
 copy 2 1                                                                        
 abrsin 1                                                                        
 strl                                                                            
 phaplot 1 -3.0 3.0                                                              
 fluence -1 1 90. 3                                                              
 abrzer 1                                                                        
 strl                                                                            
 phaplot 1 -3.0 3.0                                                              
 copy 2 1                                                                        
 wvrand 1 1.2 2                                                                  
 strl                                                                            
 phaplot 1                                                                       
 fluence 1 1 20 2 0                                                              
 obs 1 .3                                                                        
 intplot 1 -5. 5.0                                                               
 dist 1e15                                                                       
 intplot                                                                         
 intplot 0 0 0 0 4                                                               
 echo 0                                                                          
.eom                                                                             
.exam19                                                                          
 echo 1                                                                          
 c  assumes NBEAM = 4 and NLINE = 256                                            
 c  does coherent addition of two beams                                          
 nbeam 3                                                                         
 color 0 10.                                                                     
 units 0 0.020                                                                   
 fluence -5 1 1 1                                                                
 decent 1 1.                                                                     
 decent 2 -1                                                                     
 tiltmrad 1 -5                                                                   
 tilt 2 5                                                                        
 status                                                                          
 dist 200                                                                        
 status                                                                          
 nbeam 4                                                                         
 zero 4                                                                          
 addcoh 4 1 3                                                                    
 intplot 4                                                                       
 zero 4                                                                          
 addcoh 4 2 3                                                                    
 intensity 2 -1 0 5                                                              
 intplot 4                                                                       
 window 2 0. 3.                                                                  
 status                                                                          
 echo 0                                                                          
.eom                                                                             
.exam20                                                                          
 echo 1                                                                          
 c                 nbeam = 2 nad nline = 512                                     
 hermite 1 2 3 1 1                                                               
 intplot 1 -5.0 5.0                                                              
 energy                                                                          
 mult 1 0.9                                                                      
 energy                                                                          
 obs 1 0.8 2.5                                                                   
 flip 1                                                                          
 intplot 1 -5.0 5.0                                                              
 status                                                                          
 energy                                                                          
 rescale 1 5                                                                     
 status                                                                          
 energy                                                                          
 intplot 1 -3.0 5.0                                                              
 echo 0                                                                          
.eom                                                                             
.again
 c     Define your starting intensity profile with 
 c     a fluence command, then use this macro to show the  
 c     near-field (Fresnel) intensity diffraction pattern at 20 cm,
 c     then 40 cm, then 60 cm, ... away from the aperture.
 c     Watch the pattern transition into a far-field (Fraunhoffer) pattern.
 c     For example, try these commands:
 c
 c     fluence 1 1 20 1
 c     macro -40
 c     again
 c                                                                                       
 dist 20                                                                         
 intplot 1 -4.0 4.0                                                                         
.eom                                                                             
.hermites                                                                        
 echo 1                                                                          
 hermite 1 1 0 1 0                                                               
 intplot 1 -5.0 5.0                                                              
 hermite 1 1 1 1 0                                                               
 intplot 1 -5.0 5.0                                                              
 hermite 1 1 2 1 0                                                               
 intplot 1 -5.0 5.0                                                              
 hermite 1 1 3 1 0                                                               
 intplot 1 -5.0 5.0                                                              
 hermite 1 1 4 1 0                                                               
 intplot 1 -5.0 5.0                                                              
 hermite 1 1 5 1 0                                                               
 intplot 1 -5.0 5.0                                                              
 echo 0                                                                          
.eom                                                                             
.axaf
 echo 1
 fluence 1 1 1 0.00005
 color 1 0.63
 pause
 clap 1 0.0254
 pause
 intplot 1 -0.03 0.03
 dist 0.0127
 pause
 intplot 1 -0.03 0.03
 clap 1 0.0075
 pause
 intplot 1 -0.01 0.01
 dist 2.86258
 pause
 intplot 1
 clap 1 0.047
 pause
 intplot 1 -0.05 0.05
 phaplot 1 -0.05 0.05
 dist 997.137
 pause
 intplot 1 -20. 20.
 end
.eom