atwiggler
PURPOSE
atwiggler(fname, Ltot, Lw, Bmax, Nstep, Nmeth, By, Bx, method)
SYNOPSIS
function Elem = atwiggler(fname, Ltot, Lw, Bmax, Nstep, Nmeth, By, Bx, method)
DESCRIPTION
CROSS-REFERENCE INFORMATION
This function calls:
This function is called by:
SOURCE CODE
0001 function Elem = atwiggler(fname, Ltot, Lw, Bmax, Nstep, Nmeth, By, Bx, method)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 global MaxOrder;
0032 global NumIntSteps;
0033
0034 GWIG_EPS = 1e-6;
0035 dNw = abs(mod(Ltot/Lw, 1));
0036 if dNw > GWIG_EPS
0037 error(' Wiggler: Ltot/Lw is not an integter.');
0038 end
0039
0040 Elem.FamName = fname;
0041 Elem.Length = Ltot;
0042 Elem.Lw = Lw;
0043 Elem.Bmax = Bmax;
0044 Elem.Nstep = Nstep;
0045 Elem.Nmeth = Nmeth;
0046 if ~isempty(By)
0047 Elem.NHharm = length(By(1,:));
0048 for i=1:Elem.NHharm
0049 kx = By(3,i); ky = By(4,i); kz = By(5,i);
0050 dk = sqrt(abs(ky*ky - kz*kz - kx*kx))/abs(kz);
0051 if ( dk > GWIG_EPS ) then
0052 error([' Wiggler (H): kx^2 + kz^2 - ky^2 != 0!, i = ', num2str(i,3)]);
0053 end;
0054 end
0055 else
0056 Elem.NHharm = 0;
0057 end
0058
0059 if ~isempty(Bx)
0060 Elem.NVharm = length(Bx(1,:));
0061 for i=1:Elem.NVharm
0062 kx = Bx(3,i); ky = Bx(4,i); kz = Bx(5,i);
0063 dk = sqrt(abs(kx*kx - kz*kz - ky*ky))/abs(kz);
0064 if ( dk > GWIG_EPS ) then
0065 error([' Wiggler (V): ky^2 + kz^2 - kx^2 != 0!, i = ', num2str(i,3)]);
0066 end;
0067 end
0068 else
0069 Elem.NVharm = 0;
0070 end
0071 Elem.By = By;
0072 Elem.Bx = Bx;
0073 Elem.R1 = diag(ones(6,1));
0074 Elem.R2 = diag(ones(6,1));
0075 Elem.T1 = zeros(1,6);
0076 Elem.T2 = zeros(1,6);
0077 Elem.PassMethod = method;
0078 Elem.Class = 'Wiggler';
Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005