Home > lattice > element_creation > atsbend.m

atsbend

PURPOSE ^

ATRBEND(FAMNAME,LENGTH,BENDINGANGLE,K,PASSMETHOD)

SYNOPSIS ^

function elem=atsbend(fname,varargin)

DESCRIPTION ^

ATRBEND(FAMNAME,LENGTH,BENDINGANGLE,K,PASSMETHOD)
    creates a rectangular bending magnet element with class 'Bend'
        FAMNAME            family name
        LENGTH             length of the arc for an on-energy particle [m]
        BENDINGANGLE    total bending angle [rad]
        K                focusing strength, defaults to 0
        PASSMETHOD      tracking function, defaults to 'BendLinearPass'

ATRBEND(FAMNAME,LENGTH,BENDINGANGLE,K,PASSMETHOD,'FIELDNAME1',VALUE1,...)
   Each pair {'FIELDNAME',VALUE} is added to the element

See also: ATDRIFT, ATQUADRUPOLE, ATSEXTUPOLE, ATSBEND
          ATMULTIPOLE, ATTHINMULTIPOLE, ATMARKER, ATCORRECTOR

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function elem=atsbend(fname,varargin)
0002 %ATRBEND(FAMNAME,LENGTH,BENDINGANGLE,K,PASSMETHOD)
0003 %    creates a rectangular bending magnet element with class 'Bend'
0004 %        FAMNAME            family name
0005 %        LENGTH             length of the arc for an on-energy particle [m]
0006 %        BENDINGANGLE    total bending angle [rad]
0007 %        K                focusing strength, defaults to 0
0008 %        PASSMETHOD      tracking function, defaults to 'BendLinearPass'
0009 %
0010 %ATRBEND(FAMNAME,LENGTH,BENDINGANGLE,K,PASSMETHOD,'FIELDNAME1',VALUE1,...)
0011 %   Each pair {'FIELDNAME',VALUE} is added to the element
0012 %
0013 %See also: ATDRIFT, ATQUADRUPOLE, ATSEXTUPOLE, ATSBEND
0014 %          ATMULTIPOLE, ATTHINMULTIPOLE, ATMARKER, ATCORRECTOR
0015 
0016 [rsrc,L,A,K,method]=decodeatargs({0,0,[],'BendLinearPass'},varargin);
0017 [L,rsrc]=getoption(rsrc,'Length',L);
0018 [A,rsrc]=getoption(rsrc,'BendingAngle',A);
0019 [K,rsrc]=getoption(rsrc,'K',K);
0020 [method,rsrc]=getoption(rsrc,'PassMethod',method);
0021 [PolynomB,rsrc]=getoption(rsrc,'PolynomB',[0 0]);
0022 [cl,rsrc]=getoption(rsrc,'Class','Bend');
0023 if ~isempty(K), PolynomB(2)=K; end
0024 [EntranceAngle,rsrc]=getoption(rsrc,'EntranceAngle',0);
0025 [ExitAngle,rsrc]=getoption(rsrc,'ExitAngle',0);
0026 elem=atbaselem(fname,method,'Class',cl,'Length',L,...
0027     'BendingAngle',A,'EntranceAngle',EntranceAngle,'ExitAngle',ExitAngle,...
0028     'K',PolynomB(2),'PolynomB',PolynomB,rsrc{:});
0029 end

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005