function [H,Hv]=CurlyH(RING,dp,ind) computes Curly H (dispersion invariant) RING :at lattice dp : energy deviation ind : reference positions output H : horizontal dispersion invariant Hv : vertical dispersion invariant
0001 function [H,Hv]=CurlyH(RING,dp,ind) 0002 %function [H,Hv]=CurlyH(RING,dp,ind) 0003 % 0004 % computes Curly H (dispersion invariant) 0005 % 0006 % RING :at lattice 0007 % dp : energy deviation 0008 % ind : reference positions 0009 % 0010 % output 0011 % 0012 % H : horizontal dispersion invariant 0013 % Hv : vertical dispersion invariant 0014 % 0015 % 0016 0017 %TD=twissring(RING,dp,ind); 0018 [TD,~,~]=atlinopt(RING,dp,ind); 0019 0020 B = cat(1,TD.beta); 0021 A = cat(1,TD.alpha); 0022 %[D,Dv] = getDispersion(RING,ind); 0023 %[Dp,Dpv] = getDispersionAngle(RING,ind); 0024 DD = cat(2,TD.Dispersion); 0025 D=DD(1,:); 0026 Dv=DD(3,:); 0027 Dp=DD(2,:); 0028 Dpv=DD(4,:); 0029 0030 G=(1+A(:,1).^2)./B(:,1); 0031 Gv=(1+A(:,2).^2)./B(:,2); 0032 0033 H=B(:,1).*Dp'.*Dp' + 2*A(:,1).*D'.* Dp' + G.*D'.* D'; 0034 Hv=B(:,2).*Dpv'.*Dpv' + 2*A(:,2).*Dv'.* Dpv' + Gv.*Dv'.* Dv'; 0035