Program for finding aberrations of an electrostatic deflector, used with xmpl3d33 to 44
This can be copied from example file xmpl3d33, which is supplied with the CPO3D package.
Program (in Fortran) for anaylyzing the data in the output data file, which should be first copied to tempa.dat:
C Program for finding aberrations of a deflector (in Fortran).
C Used in conjunction with xmpl3d33 to 44, for various types of deflector.
C The rays are assumed to cover the whole of a circle about the axis, and
C so no use is made of the symmetry about y=0 of the 2-fold deflectors.
C The output data files should first be copied to tempa.dat.
DIMENSION x(100) , y(100) , z(100) , vx(100) , vy(100) , vz(100) ,
& xf(100) , yf(100)
n = 13
C =number of results in output file
zf_gaussian = 8.0
C =final z at which image is supposed to be
dzf = 0.01
C =decrements for testing for z positions of minimum spots (in tangential
C and sagittal directions, and disc of least confusion)
zf_min = 6.0
C =lowest vale of zf for looking for minimum spots
ntest = int((zf_gaussian-zf_min)/dzf)
zf = zf_gaussian + dzf
OPEN (UNIT=1,FILE='tempa.dat',STATUS='OLD')
C =trajectory output file
OPEN (UNIT=2,FILE='tempres.dat',STATUS='UNKNOWN')
C =results file
DO i = 1 , n
READ (1,*) x(i) , y(i) , z(i) , vx(i) , vy(i) , vz(i)
ENDDO
dxmin = 1.E10
C =spread in x direction
dymin = 1.E10
C =spread in y direction
dxymin = 1.E10
C =spread in either x or y directions -ie disc of least confusion
DO iz = 1 , ntest
zf = zf - dzf
C =test value of final z, to find minimum spots
xmax = -1.E10
xmin = 1.E10
ymax = -1.E10
ymin = 1.E10
DO i = 1 , n
xf(i) = x(i) + (zf - zf_gaussian)*vx(i)/vz(i)
yf(i) = y(i) + (zf - zf_gaussian)*vy(i)/vz(i)
C =x and y at test plane
C (put in arrays in case more sophisticated analysis is wanted later)
xmax = max(xmax,xf(i))
xmin = min(xmin,xf(i))
ymax = max(ymax,yf(i))
ymin = min(ymin,yf(i))
ENDDO
dx = xmax - xmin
C =spread in x direction
dy = ymax - ymin
C =spread in y direction
IF (iz.EQ.1) THEN
dx_gaussian = dx
dy_gaussian = dy
C =saved values at z=zf_gaussian
ENDIF
IF (dx.LT.dxmin) THEN
C Best size of spot so far, in the x direction only
dxmin = dx
dzminx = zf_gaussian - zf
IF (iz.EQ.ntest)
& WRITE (2,'(''Range of z not large enough'')')
ENDIF
IF (dy.LT.dymin) THEN
C Best size of spot so far, in the y direction only
dymin = dy
dzminy = zf_gaussian - zf
IF (iz.EQ.ntest)
& WRITE (2,'(''Range of z not large enough'')')
ENDIF
dxy = max(dx,dy)
C =largest spread in x or y direction (for disc of least confusion)
IF (dxy.LT.dxymin) THEN
C Best size of spot of least confusion so far
dxymin = dxy
dzminlc = zf_gaussian - zf
IF (iz.EQ.ntest)
& WRITE (2,'(''Range of z not large enough'')')
ENDIF
ENDDO
WRITE (2,99001) dx_gaussian , dy_gaussian , dxmin ,
& dzminx , dymin , dzminy , dxymin , dzminlc
99001 FORMAT (
&'Gaussian plane: tangential: sagital: least confusion:'/
&' dx dy dx dz dy dz dx,y dz'/
&2F8.5,F9.5,F6.3,F9.5,F6.3,F9.5,F6.3)
STOP
END