0001 function [deltap,deltam, indextab] = calc_dppAperture(THERING, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if nargin>=3
0016 PAmarkder = varargin{1};
0017 PAlim = varargin{2};
0018
0019 ati = atindex(THERING);
0020 sepindx = eval(['ati.' PAmarkder]);
0021 THERING{sepindx}.Limits = PAlim;
0022 THERING{sepindx}.PassMethod = 'AperturePass';
0023 end
0024
0025 ati = atindex(THERING);
0026 Vrf = 3200000;
0027 if nargin>=4
0028 Vrf = varargin{3}*1.0e6;
0029 end
0030
0031
0032
0033
0034
0035
0036
0037
0038 bi = findcells(THERING,'BendingAngle');
0039 k = getcellstruct(THERING,'K',bi);
0040 THERING = setcellstruct(THERING,'Energy', bi, 3e9);
0041 THERING = setcellstruct(THERING,'PolynomA',bi,0,1,2);
0042 THERING = setcellstruct(THERING,'PolynomB',bi,k,1,2);
0043 THERING = setcellstruct(THERING,'NumIntSteps',bi,10);
0044 THERING = setcellstruct(THERING,'MaxOrder',bi,1);
0045 THERING = setcellstruct(THERING,'PassMethod',bi,'BndMPoleSymplectic4RadPass');
0046
0047
0048 [curH,allspos]= getcurH(THERING);
0049 curH(length(allspos)+1)=curH(length(allspos));
0050 cnt = 0;
0051 RING0 = THERING;
0052 epsH=1e-7;
0053 tic
0054 for ii=1:length(allspos)
0055 if (RING0{ii}.Length>0 && abs(curH(ii+1)-curH(ii))>epsH)
0056
0057 cnt = cnt + 1;
0058
0059 indextab(cnt) = ii;
0060 THERING = [RING0(ii:end), RING0(1:ii-1)];
0061 [dplus,dminus] = track4dppAp(THERING, 500)
0062 deltap(cnt) = dplus;
0063 deltam(cnt) = dminus;
0064 end
0065 end
0066 toc
0067
0068 [deltap,deltam] = atmomap(ring, Nturn);