Home > lattice > setshift.m

setshift

PURPOSE ^

SETSHIFT sets the misalignment vectors T1, T2 for elements

SYNOPSIS ^

function setshift(ELEMINDEX, DX, DY)

DESCRIPTION ^

SETSHIFT sets the misalignment vectors T1, T2 for elements

 SETSHIFT(ELEMINDEX, DX, DY) sets the entrance and exit misalignment vectors
  of one element or a group of elements in the globally defined lattice THERING.
  
  DX, DY are displacements of the ELEMENT 
  so the coordinate transformation on the particle at entrance is
    X  ->  X-DX
   Y  ->  Y-DY
  The elements to be modified are given by ELEMINDEX  
    Previous stored values are overwritten. 

 See also SETSHIFT

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function setshift(ELEMINDEX, DX, DY)
0002 %SETSHIFT sets the misalignment vectors T1, T2 for elements
0003 %
0004 % SETSHIFT(ELEMINDEX, DX, DY) sets the entrance and exit misalignment vectors
0005 %  of one element or a group of elements in the globally defined lattice THERING.
0006 %
0007 %  DX, DY are displacements of the ELEMENT
0008 %  so the coordinate transformation on the particle at entrance is
0009 %    X  ->  X-DX
0010 %   Y  ->  Y-DY
0011 %  The elements to be modified are given by ELEMINDEX
0012 %    Previous stored values are overwritten.
0013 %
0014 % See also SETSHIFT
0015  
0016 global THERING
0017 numelems = length(ELEMINDEX);
0018 
0019 if (numelems ~= length(DX)) | (numelems ~= length(DY))
0020    error('ELEMINDEX, DX, and DY must have the same number of elements');
0021 end
0022 
0023 V = zeros(1,6);
0024 for i = 1:length(ELEMINDEX)
0025    V(1) = -DX(i);
0026    V(3) = -DY(i);
0027    THERING{ELEMINDEX(i)}.T1 =  V;
0028    THERING{ELEMINDEX(i)}.T2 = -V;
0029 end
0030 
0031

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