Kumakhov Calculation 

SHADOW now permits you to perform tube-like optics calculation -- multiple
bounce optical elements.  The model was contructed with the idea of
having an array of tubes, but with appropriate source specification can be
used for single tubes as well.  Most of the parameters are input through a
data file.  For multiple tube arrays the packing is calculated internally.

A polynomial tube can be expressed in the following way

(X - C_ig(z))^2+(Y-C_jg(z))^2 = (r_0g(z))^2

g(z) = -z           z^2
       ----    -  ------  + 1
	S          2SL

C_i and C_j are the center coordinate of each Kumakhov tube
and  are obtained from  Wigner-Seitz simulation. 
S is the source distance from the entrance plane of the tubes, L 
is the tube length, and r_0 is the tube diameter.

Example:

In this example, the source is a point source with +/- 7mrad divergence,
located at 30 mm.  Incidence angle is 0, reflection angle is 180, image
distance 210mm.

    .....
    Kumakhov lens are formed from tube arrays 
    their packing pattern are Wigner-Seitz type cell.
    A capillary would be the central tube of 
    a kumakhov lens.
    Is this a Kumakhov system? Y
    For multiple reflection calculations, you may
    want to store the intercepts of each bounce.
    Store (X,Y,Z) for each bounce? Y
    Normally, the tube radii are specified as r(z).
    You may also specify r(z)^2.
    Specify as r(z)^2 ? (Y/N) N
    File with the parameters? KOKO.DAT
    ....
    
Input Data Format 

You have the option to enter the polynomial in the form of g(z) 
(along the tube), and f(z) (radius) or for a single tube calculation 
f(z)^2. 

1.  The polynomial file for the Kumakhov tube  description.

Example KOKO.DAT file: 

0.028			! basis vectors a_1
0.			!               a_2
0.014			!               b_1
0.02424871130596428	!               b_2
200 			! tube length
-0.0333333		! a_g
-0.0000833333 		! b_g
0.014			! initial tube radius
0.02424871130596428	! a_f
0.013			! b_f
4			! square of degree of polynomial <= 4
3			! solution of polynomial to use

The first four lines are for the two 2-dimensional basis vectors.
  (a_1, a_2), (b_1, b_2) 
200 : tube length (mm)
The sixth and the seventh lines are the parameters for the
Tube polynomial (i.e. g(z)= az+bz^2 +1)
	note: In our calculation y = A_y(az+bz^2+1) The slope will
	be determined by a' = A_ya , and b' = A_yb.  A_y is determined
	inside SHADOW based on the tube that the ray enters.
The eighth line is the tube radius
The 9-10 lines are variation of the tube radius ( f(z) ) the same way of 
  specification as the tube shape
4 is the degree of your tube polynomial.  It is the maximum of the degrees
  of g(z) and f(z) squared.  N_DEG cannot be greater than 4. (i.e. the
  degree of either polynomial cannot be greater than 2).
3 is the number for the F_POLSEL
  3: closest solution
  2: next closest solution
  1: next farthest solution
  4: farthest solution



2. Alternate Method for specifying the tubes -- Single tube applications:

For single tube applications, g(z) is along (0,0) and not specified.  The
user may find it easier to specify how the radius of the tube is changing
by using r(z)^2 instead of r(z).  As you are now specifying only how the
radius is changing, you are limited to circular cross sections.  
The file is slightly different than the normal case and follows.

402.0			! basis vectors a_1
0.			!               a_2
201			!               b_1
348.1422123213443	!               b_2
7650			! tube length
400			! initial tube radius
-160000.		! polynomial coefficients z^0
0.0d0			!                         z^1
0.0025			!                         z^2
0.0			!                         z^3
0.0			!                         z^4
2			! degree of polynomial <= 4
3			! solution chosen

1-4 are the WS basis
5 is the length
6 is the radius
7 -11 are the coefficients for
you r(z)^2 -- watch the sign!  R(x,y)^2 - r(z)^2 = 0
12 is the NDEG
13 is F_POLSEL
