!Fully Symmetric D1s2s3s4V1s2s3s4 (displacement symmetric quads 1234 and Voltage symmetrirc 1234) !all possibilities voltage and displacement for plates 1,2,3 &4. Quads 1&2 short and long are all the same. !quads 3 & 4 short and long are all the same as quads 1&2. Total number = 2^4 X 2^4 = 256 program create_lattice_config use sim_utils implicit none type quad_error_struct real(rp) long_plate_offset_x(4) ! four plates real(rp) short_plate_offset_x(4) ! four plates real(rp) long_plate_offset_y(4) ! four plates real(rp) short_plate_offset_y(4) ! four plates real(rp) long_plate_volt(4) ! four plates real(rp) short_plate_volt(4) ! four plates end type type (quad_error_struct) quad(4) type (quad_error_struct) quad_ref(4), quad_plate_sep(4), quad_plate_sep_ref(4), quad_cage(4), quad_cage_ref(4) type (quad_error_struct) quad_cage_correlation(4), quad_cage_unc(4), quad_plate_sep_unc(4), quad_plate_total_unc(4) integer i integer k1_1,k2_1,k3_1,k4_1,k1_3,k2_3,k3_3,k4_3,n1,n2,n3,n4,p,n integer n1_1,n2_1,n3_1,n4_1,n1_3,n2_3,n3_3,n4_3 integer iquad, quad_ind integer lun, lun1 integer lun2 integer status/0/ integer system integer n_start, n_end character*40 directory character*3 c character*1 iquad_word real(rp) radial real(rp) volt(4)/4*0.1058/ real(rp) sigma_cor print '(a,$)',' Start at configuration n =? ' read(5,*)n_start print '(a,$)',' End with configuration n =? ' read(5,*)n_end quad_ref(1)%long_plate_offset_x(1) = -0.000530 !-0.245 -0.285 = -0.530 quad_ref(1)%long_plate_offset_y(2) = -0.000840 !-0.98 +0.14 =-0.84 quad_ref(1)%long_plate_offset_x(3) = 0.000040 !-0.245 + 0.285 =0.040 quad_ref(1)%long_plate_offset_y(4) = -0.001120 ! -0.98 -0.14 = -1.12 quad_ref(1)%short_plate_offset_x(1)= -0.000420 !-0.49 +0.07 = -0.42 quad_ref(1)%short_plate_offset_y(2)= 0.002050 !2.235 -0.185 =2.05 quad_ref(1)%short_plate_offset_x(3)= -0.000560 !-0.49 -0.07 =-0.56 quad_ref(1)%short_plate_offset_y(4)= 0.002420 !2.235 +0.185 = 2.420 quad_ref(2)%long_plate_offset_x(1)= 0.0000600 !-0.035 +0.095 =0.06 quad_ref(2)%long_plate_offset_y(2)= 0.0006700 !0.38 +0.29 =0.67 quad_ref(2)%long_plate_offset_x(3)= -0.0001300 !-0.035 -0.095 = -0.13 quad_ref(2)%long_plate_offset_y(4)= 0.0000900 !0.38-0.29 =0.09 quad_ref(2)%short_plate_offset_x(1)= -0.000700 !-0.995 +0.295 = -0.7 quad_ref(2)%short_plate_offset_y(2)= -0.000490 !-0.675 +0.185 = -0.49 quad_ref(2)%short_plate_offset_x(3)= -0.001290 !-0.995 -0.295 =-1.29 quad_ref(2)%short_plate_offset_y(4)= -0.000860 !-0.675 -0.185 =-0.86 quad_ref(3)%long_plate_offset_x(1)= 0.000310 !0.115 +0.195 =0.31 quad_ref(3)%long_plate_offset_y(2)= -0.001840 !-1.965 +0.125 =-1.84 quad_ref(3)%long_plate_offset_x(3)= -0.000080 !0.115 -0.195 =-0.08 quad_ref(3)%long_plate_offset_y(4)= -0.002090 !-1.965 -0.125 =-2.09 quad_ref(3)%short_plate_offset_x(1)= -0.000400 !-0.20 -0.20 =-0.4 quad_ref(3)%short_plate_offset_y(2)= 0.001160 !0.75 +0.41 =1.16 quad_ref(3)%short_plate_offset_x(3)= 0.000000 !-0.20 +0.20 =0 quad_ref(3)%short_plate_offset_y(4)= -0.000340 !0.75 -0.41 =-0.34 quad_ref(4)%long_plate_offset_x(1)= 0.000200 !0.085 +0.115 =0.2 quad_ref(4)%long_plate_offset_y(2)= -0.000440 !-0.22 -0.22 =-0.44 quad_ref(4)%long_plate_offset_x(3)= -0.000030 !0.085 -0.115 =-0.03 quad_ref(4)%long_plate_offset_y(4)= 0.000000 !-0.22 +0.22 =0. quad_ref(4)%short_plate_offset_x(1)= -0.000390 !-0.345 -0.045 =-0.39 quad_ref(4)%short_plate_offset_y(2)= -0.001160 !-1.315 +0.155 =-1.16 quad_ref(4)%short_plate_offset_x(3)= -0.000300 !-0.345 +0.045 =-0.3 quad_ref(4)%short_plate_offset_y(4)= -0.001470 !-1.315 -0.155 =-1.47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! quad_cage_ref(1)%long_plate_offset_x(1) = -0.000245 quad_cage_ref(1)%long_plate_offset_y(2) = -0.00098 quad_cage_ref(1)%long_plate_offset_x(3) = -0.000245 quad_cage_ref(1)%long_plate_offset_y(4) = -0.00098 quad_cage_ref(1)%short_plate_offset_x(1)= -0.00049 quad_cage_ref(1)%short_plate_offset_y(2)= 0.002235 quad_cage_ref(1)%short_plate_offset_x(3)= -0.00049 quad_cage_ref(1)%short_plate_offset_y(4)= 0.002235 quad_cage_ref(2)%long_plate_offset_x(1)= -0.000035 quad_cage_ref(2)%long_plate_offset_y(2)= 0.00038 quad_cage_ref(2)%long_plate_offset_x(3)= -0.000035 quad_cage_ref(2)%long_plate_offset_y(4)= 0.00038 quad_cage_ref(2)%short_plate_offset_x(1)= -0.000995 quad_cage_ref(2)%short_plate_offset_y(2)= -0.000675 quad_cage_ref(2)%short_plate_offset_x(3)= -0.000995 quad_cage_ref(2)%short_plate_offset_y(4)= -0.000675 quad_cage_ref(3)%long_plate_offset_x(1)= 0.000115 quad_cage_ref(3)%long_plate_offset_y(2)= -0.001965 quad_cage_ref(3)%long_plate_offset_x(3)= 0.000115 quad_cage_ref(3)%long_plate_offset_y(4)= -0.001965 quad_cage_ref(3)%short_plate_offset_x(1)= -0.00020 quad_cage_ref(3)%short_plate_offset_y(2)= 0.00075 quad_cage_ref(3)%short_plate_offset_x(3)= -0.00020 quad_cage_ref(3)%short_plate_offset_y(4)= 0.00075 quad_cage_ref(4)%long_plate_offset_x(1)= 0.000085 quad_cage_ref(4)%long_plate_offset_y(2)= -0.00022 quad_cage_ref(4)%long_plate_offset_x(3)= 0.000085 quad_cage_ref(4)%long_plate_offset_y(4)= -0.00022 quad_cage_ref(4)%short_plate_offset_x(1)= -0.000345 quad_cage_ref(4)%short_plate_offset_y(2)= -0.001315 quad_cage_ref(4)%short_plate_offset_x(3)= -0.000345 quad_cage_ref(4)%short_plate_offset_y(4)= -0.001315 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! quad_plate_sep_ref(1)%long_plate_offset_x(1) = 0.00057 quad_plate_sep_ref(1)%long_plate_offset_y(2) = -0.00028 quad_plate_sep_ref(1)%long_plate_offset_x(3) = 0.00057 quad_plate_sep_ref(1)%long_plate_offset_y(4) = -0.00028 quad_plate_sep_ref(1)%short_plate_offset_x(1)= -0.00014 quad_plate_sep_ref(1)%short_plate_offset_y(2)= 0.00037 quad_plate_sep_ref(1)%short_plate_offset_x(3)= -0.00014 quad_plate_sep_ref(1)%short_plate_offset_y(4)= 0.00037 quad_plate_sep_ref(2)%long_plate_offset_x(1)= -0.00019 quad_plate_sep_ref(2)%long_plate_offset_y(2)= -0.00058 quad_plate_sep_ref(2)%long_plate_offset_x(3)= -0.00019 quad_plate_sep_ref(2)%long_plate_offset_y(4)= -0.00058 quad_plate_sep_ref(2)%short_plate_offset_x(1)= -0.00059 quad_plate_sep_ref(2)%short_plate_offset_y(2)= -0.00037 quad_plate_sep_ref(2)%short_plate_offset_x(3)= -0.00059 quad_plate_sep_ref(2)%short_plate_offset_y(4)= -0.00037 quad_plate_sep_ref(3)%long_plate_offset_x(1)= -0.00039 quad_plate_sep_ref(3)%long_plate_offset_y(2)= -0.00025 quad_plate_sep_ref(3)%long_plate_offset_x(3)= -0.00039 quad_plate_sep_ref(3)%long_plate_offset_y(4)= -0.00025 quad_plate_sep_ref(3)%short_plate_offset_x(1)= 0.00040 quad_plate_sep_ref(3)%short_plate_offset_y(2)= -0.00082 quad_plate_sep_ref(3)%short_plate_offset_x(3)= 0.00040 quad_plate_sep_ref(3)%short_plate_offset_y(4)= -0.00082 quad_plate_sep_ref(4)%long_plate_offset_x(1)= -0.00023 quad_plate_sep_ref(4)%long_plate_offset_y(2)= 0.00044 quad_plate_sep_ref(4)%long_plate_offset_x(3)= -0.00023 quad_plate_sep_ref(4)%long_plate_offset_y(4)= 0.00044 quad_plate_sep_ref(4)%short_plate_offset_x(1)= 0.00009 quad_plate_sep_ref(4)%short_plate_offset_y(2)= -0.00031 quad_plate_sep_ref(4)%short_plate_offset_x(3)= 0.00009 quad_plate_sep_ref(4)%short_plate_offset_y(4)= -0.00031 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! quad_plate_total_unc(1)%long_plate_offset_x(1) = 0.00053 quad_plate_total_unc(1)%long_plate_offset_y(2) = 0.00085 quad_plate_total_unc(1)%long_plate_offset_x(3) = 0.00083 quad_plate_total_unc(1)%long_plate_offset_y(4) = 0.00085 quad_plate_total_unc(1)%short_plate_offset_x(1)= 0.00099 quad_plate_total_unc(1)%short_plate_offset_y(2)= 0.00085 quad_plate_total_unc(1)%short_plate_offset_x(3)= 0.00099 quad_plate_total_unc(1)%short_plate_offset_y(4)= 0.00085 quad_plate_total_unc(2)%long_plate_offset_x(1)= 0.00058 quad_plate_total_unc(2)%long_plate_offset_y(2)= 0.00085 quad_plate_total_unc(2)%long_plate_offset_x(3)= 0.00071 quad_plate_total_unc(2)%long_plate_offset_y(4)= 0.00055 quad_plate_total_unc(2)%short_plate_offset_x(1)= 0.0005 quad_plate_total_unc(2)%short_plate_offset_y(2)= 0.00085 quad_plate_total_unc(2)%short_plate_offset_x(3)= 0.0007 quad_plate_total_unc(2)%short_plate_offset_y(4)= 0.00085 quad_plate_total_unc(3)%long_plate_offset_x(1)= 0.00051 quad_plate_total_unc(3)%long_plate_offset_y(2)= 0.00085 quad_plate_total_unc(3)%long_plate_offset_x(3)= 0.00071 quad_plate_total_unc(3)%long_plate_offset_y(4)= 0.00085 quad_plate_total_unc(3)%short_plate_offset_x(1)= 0.00051 quad_plate_total_unc(3)%short_plate_offset_y(2)= 0.00085 quad_plate_total_unc(3)%short_plate_offset_x(3)= 0.00081 quad_plate_total_unc(3)%short_plate_offset_y(4)= 0.00085 quad_plate_total_unc(4)%long_plate_offset_x(1)= 0.00067 quad_plate_total_unc(4)%long_plate_offset_y(2)= 0.00085 quad_plate_total_unc(4)%long_plate_offset_x(3)= 0.0008 quad_plate_total_unc(4)%long_plate_offset_y(4)= 0.00085 quad_plate_total_unc(4)%short_plate_offset_x(1)= 0.00099 quad_plate_total_unc(4)%short_plate_offset_y(2)= 0.00085 quad_plate_total_unc(4)%short_plate_offset_x(3)= 0.00099 quad_plate_total_unc(4)%short_plate_offset_y(4)= 0.00085 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sigma_cor = 0.00035 quad_plate_sep_unc(1)%long_plate_offset_x(1) = sqrt(quad_plate_total_unc(1)%long_plate_offset_x(1)**2 + quad_plate_total_unc(1)%long_plate_offset_x(3)**2) quad_plate_sep_unc(1)%long_plate_offset_y(2) = sqrt(quad_plate_total_unc(1)%long_plate_offset_y(2)**2 + quad_plate_total_unc(1)%long_plate_offset_y(4)**2) quad_plate_sep_unc(1)%long_plate_offset_x(3) = sqrt(quad_plate_total_unc(1)%long_plate_offset_x(1)**2 + quad_plate_total_unc(1)%long_plate_offset_x(3)**2) quad_plate_sep_unc(1)%long_plate_offset_y(4) = sqrt(quad_plate_total_unc(1)%long_plate_offset_y(2)**2 + quad_plate_total_unc(1)%long_plate_offset_y(4)**2) quad_plate_sep_unc(1)%short_plate_offset_x(1)= sqrt(quad_plate_total_unc(1)%short_plate_offset_x(1)**2 + quad_plate_total_unc(1)%short_plate_offset_x(3)**2) quad_plate_sep_unc(1)%short_plate_offset_y(2)= sqrt(quad_plate_total_unc(1)%short_plate_offset_y(2)**2 + quad_plate_total_unc(1)%short_plate_offset_y(4)**2) quad_plate_sep_unc(1)%short_plate_offset_x(3)= sqrt(quad_plate_total_unc(1)%short_plate_offset_x(1)**2 + quad_plate_total_unc(1)%short_plate_offset_x(3)**2) quad_plate_sep_unc(1)%short_plate_offset_y(4)= sqrt(quad_plate_total_unc(1)%short_plate_offset_y(2)**2 + quad_plate_total_unc(1)%short_plate_offset_y(4)**2) quad_plate_sep_unc(2)%long_plate_offset_x(1)= sqrt(quad_plate_total_unc(2)%long_plate_offset_x(1)**2 + quad_plate_total_unc(2)%long_plate_offset_x(3)**2) quad_plate_sep_unc(2)%long_plate_offset_y(2)= sqrt(quad_plate_total_unc(2)%long_plate_offset_y(2)**2 + quad_plate_total_unc(2)%long_plate_offset_y(4)**2) quad_plate_sep_unc(2)%long_plate_offset_x(3)= sqrt(quad_plate_total_unc(2)%long_plate_offset_x(1)**2 + quad_plate_total_unc(2)%long_plate_offset_x(3)**2) quad_plate_sep_unc(2)%long_plate_offset_y(4)= sqrt(quad_plate_total_unc(2)%long_plate_offset_y(2)**2 + quad_plate_total_unc(2)%long_plate_offset_y(4)**2) quad_plate_sep_unc(2)%short_plate_offset_x(1)= sqrt(quad_plate_total_unc(2)%short_plate_offset_x(1)**2 + quad_plate_total_unc(2)%short_plate_offset_x(3)**2) quad_plate_sep_unc(2)%short_plate_offset_y(2)= sqrt(quad_plate_total_unc(2)%short_plate_offset_y(2)**2 + quad_plate_total_unc(2)%short_plate_offset_y(4)**2) quad_plate_sep_unc(2)%short_plate_offset_x(3)= sqrt(quad_plate_total_unc(2)%short_plate_offset_x(1)**2 + quad_plate_total_unc(2)%short_plate_offset_x(3)**2) quad_plate_sep_unc(2)%short_plate_offset_y(4)= sqrt(quad_plate_total_unc(2)%short_plate_offset_y(2)**2 + quad_plate_total_unc(2)%short_plate_offset_y(4)**2) quad_plate_sep_unc(3)%long_plate_offset_x(1)= sqrt(quad_plate_total_unc(3)%long_plate_offset_x(1)**2 + quad_plate_total_unc(3)%long_plate_offset_x(3)**2) quad_plate_sep_unc(3)%long_plate_offset_y(2)= sqrt(quad_plate_total_unc(3)%long_plate_offset_y(2)**2 + quad_plate_total_unc(3)%long_plate_offset_y(4)**2) quad_plate_sep_unc(3)%long_plate_offset_x(3)= sqrt(quad_plate_total_unc(3)%long_plate_offset_x(1)**2 + quad_plate_total_unc(3)%long_plate_offset_x(3)**2) quad_plate_sep_unc(3)%long_plate_offset_y(4)= sqrt(quad_plate_total_unc(3)%long_plate_offset_y(2)**2 + quad_plate_total_unc(3)%long_plate_offset_y(4)**2) quad_plate_sep_unc(3)%short_plate_offset_x(1)= sqrt(quad_plate_total_unc(3)%short_plate_offset_x(1)**2 + quad_plate_total_unc(3)%short_plate_offset_x(3)**2) quad_plate_sep_unc(3)%short_plate_offset_y(2)= sqrt(quad_plate_total_unc(3)%short_plate_offset_y(2)**2 + quad_plate_total_unc(3)%short_plate_offset_y(4)**2) quad_plate_sep_unc(3)%short_plate_offset_x(3)= sqrt(quad_plate_total_unc(3)%short_plate_offset_x(1)**2 + quad_plate_total_unc(3)%short_plate_offset_x(3)**2) quad_plate_sep_unc(3)%short_plate_offset_y(4)= sqrt(quad_plate_total_unc(3)%short_plate_offset_y(2)**2 + quad_plate_total_unc(3)%short_plate_offset_y(4)**2) quad_plate_sep_unc(4)%long_plate_offset_x(1)= sqrt(quad_plate_total_unc(4)%long_plate_offset_x(1)**2 + quad_plate_total_unc(4)%long_plate_offset_x(3)**2) quad_plate_sep_unc(4)%long_plate_offset_y(2)= sqrt(quad_plate_total_unc(4)%long_plate_offset_y(2)**2 + quad_plate_total_unc(4)%long_plate_offset_y(4)**2) quad_plate_sep_unc(4)%long_plate_offset_x(3)= sqrt(quad_plate_total_unc(4)%long_plate_offset_x(1)**2 + quad_plate_total_unc(4)%long_plate_offset_x(3)**2) quad_plate_sep_unc(4)%long_plate_offset_y(4)= sqrt(quad_plate_total_unc(4)%long_plate_offset_y(2)**2 + quad_plate_total_unc(4)%long_plate_offset_y(4)**2) quad_plate_sep_unc(4)%short_plate_offset_x(1)= sqrt(quad_plate_total_unc(4)%short_plate_offset_x(1)**2 + quad_plate_total_unc(4)%short_plate_offset_x(3)**2) quad_plate_sep_unc(4)%short_plate_offset_y(2)= sqrt(quad_plate_total_unc(4)%short_plate_offset_y(2)**2 + quad_plate_total_unc(4)%short_plate_offset_y(4)**2) quad_plate_sep_unc(4)%short_plate_offset_x(3)= sqrt(quad_plate_total_unc(4)%short_plate_offset_x(1)**2 + quad_plate_total_unc(4)%short_plate_offset_x(3)**2) quad_plate_sep_unc(4)%short_plate_offset_y(4)= sqrt(quad_plate_total_unc(4)%short_plate_offset_y(2)**2 + quad_plate_total_unc(4)%short_plate_offset_y(4)**2) quad_cage_correlation(1)%long_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(1)%long_plate_offset_x(1) * quad_plate_total_unc(1)%long_plate_offset_x(3)) quad_cage_correlation(1)%long_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(1)%long_plate_offset_y(2) * quad_plate_total_unc(1)%long_plate_offset_y(4)) quad_cage_correlation(1)%long_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(1)%long_plate_offset_x(1) * quad_plate_total_unc(1)%long_plate_offset_x(3)) quad_cage_correlation(1)%long_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(1)%long_plate_offset_y(2) * quad_plate_total_unc(1)%long_plate_offset_y(4)) quad_cage_correlation(1)%short_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(1)%short_plate_offset_x(1) * quad_plate_total_unc(1)%short_plate_offset_x(3)) quad_cage_correlation(1)%short_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(1)%short_plate_offset_y(2) * quad_plate_total_unc(1)%short_plate_offset_y(4)) quad_cage_correlation(1)%short_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(1)%short_plate_offset_x(1) * quad_plate_total_unc(1)%short_plate_offset_x(3)) quad_cage_correlation(1)%short_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(1)%short_plate_offset_y(2) * quad_plate_total_unc(1)%short_plate_offset_y(4)) quad_cage_correlation(2)%long_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(2)%long_plate_offset_x(1) * quad_plate_total_unc(2)%long_plate_offset_x(3)) quad_cage_correlation(2)%long_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(2)%long_plate_offset_y(2) * quad_plate_total_unc(2)%long_plate_offset_y(4)) quad_cage_correlation(2)%long_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(2)%long_plate_offset_x(1) * quad_plate_total_unc(2)%long_plate_offset_x(3)) quad_cage_correlation(2)%long_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(2)%long_plate_offset_y(2) * quad_plate_total_unc(2)%long_plate_offset_y(4)) quad_cage_correlation(2)%short_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(2)%short_plate_offset_x(1) * quad_plate_total_unc(2)%short_plate_offset_x(3)) quad_cage_correlation(2)%short_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(2)%short_plate_offset_y(2) * quad_plate_total_unc(2)%short_plate_offset_y(4)) quad_cage_correlation(2)%short_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(2)%short_plate_offset_x(1) * quad_plate_total_unc(2)%short_plate_offset_x(3)) quad_cage_correlation(2)%short_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(2)%short_plate_offset_y(2) * quad_plate_total_unc(2)%short_plate_offset_y(4)) quad_cage_correlation(3)%long_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(3)%long_plate_offset_x(1) * quad_plate_total_unc(3)%long_plate_offset_x(3)) quad_cage_correlation(3)%long_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(3)%long_plate_offset_y(2) * quad_plate_total_unc(3)%long_plate_offset_y(4)) quad_cage_correlation(3)%long_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(3)%long_plate_offset_x(1) * quad_plate_total_unc(3)%long_plate_offset_x(3)) quad_cage_correlation(3)%long_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(3)%long_plate_offset_y(2) * quad_plate_total_unc(3)%long_plate_offset_y(4)) quad_cage_correlation(3)%short_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(3)%short_plate_offset_x(1) * quad_plate_total_unc(3)%short_plate_offset_x(3)) quad_cage_correlation(3)%short_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(3)%short_plate_offset_y(2) * quad_plate_total_unc(3)%short_plate_offset_y(4)) quad_cage_correlation(3)%short_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(3)%short_plate_offset_x(1) * quad_plate_total_unc(3)%short_plate_offset_x(3)) quad_cage_correlation(3)%short_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(3)%short_plate_offset_y(2) * quad_plate_total_unc(3)%short_plate_offset_y(4)) quad_cage_correlation(4)%long_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(4)%long_plate_offset_x(1) * quad_plate_total_unc(4)%long_plate_offset_x(3)) quad_cage_correlation(4)%long_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(4)%long_plate_offset_y(2) * quad_plate_total_unc(4)%long_plate_offset_y(4)) quad_cage_correlation(4)%long_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(4)%long_plate_offset_x(1) * quad_plate_total_unc(4)%long_plate_offset_x(3)) quad_cage_correlation(4)%long_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(4)%long_plate_offset_y(2) * quad_plate_total_unc(4)%long_plate_offset_y(4)) quad_cage_correlation(4)%short_plate_offset_x(1) = sigma_cor**2/(quad_plate_total_unc(4)%short_plate_offset_x(1) * quad_plate_total_unc(4)%short_plate_offset_x(3)) quad_cage_correlation(4)%short_plate_offset_y(2) = sigma_cor**2/(quad_plate_total_unc(4)%short_plate_offset_y(2) * quad_plate_total_unc(4)%short_plate_offset_y(4)) quad_cage_correlation(4)%short_plate_offset_x(3) = sigma_cor**2/(quad_plate_total_unc(4)%short_plate_offset_x(1) * quad_plate_total_unc(4)%short_plate_offset_x(3)) quad_cage_correlation(4)%short_plate_offset_y(4) = sigma_cor**2/(quad_plate_total_unc(4)%short_plate_offset_y(2) * quad_plate_total_unc(4)%short_plate_offset_y(4)) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! quad_cage_unc(1)%long_plate_offset_x(1) = quad_plate_sep_unc(1)%long_plate_offset_x(1)/2*(1+quad_cage_correlation(1)%long_plate_offset_x(1) )**.5 quad_cage_unc(1)%long_plate_offset_y(2) = quad_plate_sep_unc(1)%long_plate_offset_y(2)/2*(1+quad_cage_correlation(1)%long_plate_offset_y(2) )**.5 quad_cage_unc(1)%long_plate_offset_x(3) = quad_plate_sep_unc(1)%long_plate_offset_x(3)/2*(1+quad_cage_correlation(1)%long_plate_offset_x(3) )**.5 quad_cage_unc(1)%long_plate_offset_y(4) = quad_plate_sep_unc(1)%long_plate_offset_y(4)/2*(1+quad_cage_correlation(1)%long_plate_offset_y(4) )**.5 quad_cage_unc(1)%short_plate_offset_x(1)= quad_plate_sep_unc(1)%short_plate_offset_x(1)/2*(1+quad_cage_correlation(1)%short_plate_offset_x(1) )**.5 quad_cage_unc(1)%short_plate_offset_y(2)= quad_plate_sep_unc(1)%short_plate_offset_y(2)/2*(1+quad_cage_correlation(1)%short_plate_offset_y(2) )**.5 quad_cage_unc(1)%short_plate_offset_x(3)= quad_plate_sep_unc(1)%short_plate_offset_x(3)/2*(1+quad_cage_correlation(1)%short_plate_offset_x(3) )**.5 quad_cage_unc(1)%short_plate_offset_y(4)= quad_plate_sep_unc(1)%short_plate_offset_y(4)/2*(1+quad_cage_correlation(1)%short_plate_offset_y(4) )**.5 quad_cage_unc(2)%long_plate_offset_x(1) = quad_plate_sep_unc(2)%long_plate_offset_x(1)/2*(1+quad_cage_correlation(2)%long_plate_offset_x(1) )**.5 quad_cage_unc(2)%long_plate_offset_y(2) = quad_plate_sep_unc(2)%long_plate_offset_y(2)/2*(1+quad_cage_correlation(2)%long_plate_offset_y(2) )**.5 quad_cage_unc(2)%long_plate_offset_x(3) = quad_plate_sep_unc(2)%long_plate_offset_x(3)/2*(1+quad_cage_correlation(2)%long_plate_offset_x(3) )**.5 quad_cage_unc(2)%long_plate_offset_y(4) = quad_plate_sep_unc(2)%long_plate_offset_y(4)/2*(1+quad_cage_correlation(2)%long_plate_offset_y(4) )**.5 quad_cage_unc(2)%short_plate_offset_x(1)= quad_plate_sep_unc(2)%short_plate_offset_x(1)/2*(1+quad_cage_correlation(2)%short_plate_offset_x(1) )**.5 quad_cage_unc(2)%short_plate_offset_y(2)= quad_plate_sep_unc(2)%short_plate_offset_y(2)/2*(1+quad_cage_correlation(2)%short_plate_offset_y(2) )**.5 quad_cage_unc(2)%short_plate_offset_x(3)= quad_plate_sep_unc(2)%short_plate_offset_x(3)/2*(1+quad_cage_correlation(2)%short_plate_offset_x(3) )**.5 quad_cage_unc(2)%short_plate_offset_y(4)= quad_plate_sep_unc(2)%short_plate_offset_y(4)/2*(1+quad_cage_correlation(2)%short_plate_offset_y(4) )**.5 quad_cage_unc(3)%long_plate_offset_x(1) = quad_plate_sep_unc(3)%long_plate_offset_x(1)/2*(1+quad_cage_correlation(3)%long_plate_offset_x(1) )**.5 quad_cage_unc(3)%long_plate_offset_y(2) = quad_plate_sep_unc(3)%long_plate_offset_y(2)/2*(1+quad_cage_correlation(3)%long_plate_offset_y(2) )**.5 quad_cage_unc(3)%long_plate_offset_x(3) = quad_plate_sep_unc(3)%long_plate_offset_x(3)/2*(1+quad_cage_correlation(3)%long_plate_offset_x(3) )**.5 quad_cage_unc(3)%long_plate_offset_y(4) = quad_plate_sep_unc(3)%long_plate_offset_y(4)/2*(1+quad_cage_correlation(3)%long_plate_offset_y(4) )**.5 quad_cage_unc(3)%short_plate_offset_x(1)= quad_plate_sep_unc(3)%short_plate_offset_x(1)/2*(1+quad_cage_correlation(3)%short_plate_offset_x(1) )**.5 quad_cage_unc(3)%short_plate_offset_y(2)= quad_plate_sep_unc(3)%short_plate_offset_y(2)/2*(1+quad_cage_correlation(3)%short_plate_offset_y(2) )**.5 quad_cage_unc(3)%short_plate_offset_x(3)= quad_plate_sep_unc(3)%short_plate_offset_x(3)/2*(1+quad_cage_correlation(3)%short_plate_offset_x(3) )**.5 quad_cage_unc(3)%short_plate_offset_y(4)= quad_plate_sep_unc(3)%short_plate_offset_y(4)/2*(1+quad_cage_correlation(3)%short_plate_offset_y(4) )**.5 quad_cage_unc(4)%long_plate_offset_x(1) = quad_plate_sep_unc(4)%long_plate_offset_x(1)/2*(1+quad_cage_correlation(4)%long_plate_offset_x(1) )**.5 quad_cage_unc(4)%long_plate_offset_y(2) = quad_plate_sep_unc(4)%long_plate_offset_y(2)/2*(1+quad_cage_correlation(4)%long_plate_offset_y(2) )**.5 quad_cage_unc(4)%long_plate_offset_x(3) = quad_plate_sep_unc(4)%long_plate_offset_x(3)/2*(1+quad_cage_correlation(4)%long_plate_offset_x(3) )**.5 quad_cage_unc(4)%long_plate_offset_y(4) = quad_plate_sep_unc(4)%long_plate_offset_y(4)/2*(1+quad_cage_correlation(4)%long_plate_offset_y(4) )**.5 quad_cage_unc(4)%short_plate_offset_x(1)= quad_plate_sep_unc(4)%short_plate_offset_x(1)/2*(1+quad_cage_correlation(4)%short_plate_offset_x(1) )**.5 quad_cage_unc(4)%short_plate_offset_y(2)= quad_plate_sep_unc(4)%short_plate_offset_y(2)/2*(1+quad_cage_correlation(4)%short_plate_offset_y(2) )**.5 quad_cage_unc(4)%short_plate_offset_x(3)= quad_plate_sep_unc(4)%short_plate_offset_x(3)/2*(1+quad_cage_correlation(4)%short_plate_offset_x(3) )**.5 quad_cage_unc(4)%short_plate_offset_y(4)= quad_plate_sep_unc(4)%short_plate_offset_y(4)/2*(1+quad_cage_correlation(4)%short_plate_offset_y(4) )**.5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! quad(1)%long_plate_offset_x(1) =0.00149 quad(1)%long_plate_offset_x(3) =0.00149 quad(1)%short_plate_offset_x(1) =0.0021 quad(1)%short_plate_offset_x(3) =0.0021 quad(2)%long_plate_offset_x(1) =0.001378 quad(2)%long_plate_offset_x(3) =0.001378 quad(2)%short_plate_offset_x(1) =0.00129 quad(2)%short_plate_offset_x(3) =0.00129 quad(3)%long_plate_offset_x(1) =0.001307 quad(3)%long_plate_offset_x(3) =0.001307 quad(3)%short_plate_offset_x(1) =0.00144 quad(3)%short_plate_offset_x(3) =0.00144 quad(4)%long_plate_offset_x(1) =0.001562 quad(4)%long_plate_offset_x(3) =0.001562 quad(4)%short_plate_offset_x(1) =0.0021 quad(4)%short_plate_offset_x(3) =0.0021 quad(1)%long_plate_offset_y(2) =0.00106 quad(1)%long_plate_offset_y(4) =0.00106 quad(1)%short_plate_offset_y(2) =0.001064 quad(1)%short_plate_offset_y(4) =0.001064 quad(2)%long_plate_offset_y(2) =0.00106 quad(2)%long_plate_offset_y(4) =0.00106 quad(2)%short_plate_offset_y(2) =0.001064 quad(2)%short_plate_offset_y(4) =0.001064 quad(3)%long_plate_offset_y(2) =0.00106 quad(3)%long_plate_offset_y(4) =0.00106 quad(3)%short_plate_offset_y(2) =0.00106 quad(3)%short_plate_offset_y(4) =0.00106 quad(4)%long_plate_offset_y(2) =0.00106 quad(4)%long_plate_offset_y(4) =0.00106 quad(4)%short_plate_offset_y(2) =0.00106 quad(4)%short_plate_offset_y(4) =0.00106 do i=1,4 quad(i)%long_plate_volt(1:4) =0.01 *volt(i) quad(i)%short_plate_volt(1:4) =0.01 *volt(i) end do radial = 30.e-6*1.45 n=0 n1=0 n2=0 n3=0 n4=0 lun2=lunget() open(unit=lun2,file='survey_table.dat') do i=1,4 write(lun2, '(/,a11,1x,i1,8a16)') ' long quad ',i,' plate offset ',' cage offset ', 'plate sep ref','total plate unc', 'cage off unc','plate sep unc', 'correlation' write(lun2,'(a12,7es16.3)')'inner plate', quad_ref(i)%long_plate_offset_x(1)*1000, quad_cage_ref(i)%long_plate_offset_x(1)*1000, quad_plate_sep_ref(i)%long_plate_offset_x(1)*1000,quad_plate_total_unc(1)%long_plate_offset_x(1)*1000, & quad_cage_unc(i)%long_plate_offset_x(1)*1000, quad_plate_sep_unc(i)%long_plate_offset_x(1)*1000, quad_cage_correlation(i)%long_plate_offset_x(1) write(lun2,'(a12,7es16.3)')'top plate', quad_ref(i)%long_plate_offset_y(2)*1000, quad_cage_ref(i)%long_plate_offset_y(2)*1000, quad_plate_sep_ref(i)%long_plate_offset_y(2)*1000, quad_plate_total_unc(1)%long_plate_offset_y(2)*1000, & quad_cage_unc(i)%long_plate_offset_y(2)*1000, quad_plate_sep_unc(i)%long_plate_offset_y(2)*1000, quad_cage_correlation(i)%long_plate_offset_y(2) write(lun2,'(a12,7es16.3)')'outer plate', quad_ref(i)%long_plate_offset_x(3)*1000, quad_cage_ref(i)%long_plate_offset_x(3)*1000, quad_plate_sep_ref(i)%long_plate_offset_x(3)*1000, quad_plate_total_unc(1)%long_plate_offset_x(3)*1000, & quad_cage_unc(i)%long_plate_offset_x(3)*1000, quad_plate_sep_unc(i)%long_plate_offset_x(3)*1000, quad_cage_correlation(i)%long_plate_offset_x(3) write(lun2,'(a12,7es16.3)')'bottom plate', quad_ref(i)%long_plate_offset_y(4)*1000, quad_cage_ref(i)%long_plate_offset_y(4)*1000, quad_plate_sep_ref(i)%long_plate_offset_y(4)*1000, quad_plate_total_unc(1)%long_plate_offset_y(4)*1000, & quad_cage_unc(i)%long_plate_offset_y(4)*1000, quad_plate_sep_unc(i)%long_plate_offset_y(4)*1000, quad_cage_correlation(i)%long_plate_offset_y(4) write(lun2, '(/,a11,1x,i1,7a16)') ' short quad ',i,' plate offset ',' cage offset ', 'plate sep ref', 'total plate unc','cage off unc','plate sep unc', 'correlation' write(lun2,'(a12,7es16.3)')'inner plate', quad_ref(i)%short_plate_offset_x(1)*1000, quad_cage_ref(i)%short_plate_offset_x(1)*1000, quad_plate_sep_ref(i)%short_plate_offset_x(1)*1000, quad_plate_total_unc(1)%short_plate_offset_x(1)*1000, & quad_cage_unc(i)%short_plate_offset_x(1)*1000, quad_plate_sep_unc(i)%short_plate_offset_x(1)*1000, quad_cage_correlation(i)%short_plate_offset_x(1) write(lun2,'(a12,7es16.3)')'top plate', quad_ref(i)%short_plate_offset_y(2)*1000, quad_cage_ref(i)%short_plate_offset_y(2)*1000, quad_plate_sep_ref(i)%short_plate_offset_y(2)*1000, quad_plate_total_unc(1)%short_plate_offset_y(2)*1000, & quad_cage_unc(i)%short_plate_offset_y(2)*1000, quad_plate_sep_unc(i)%short_plate_offset_y(2)*1000, quad_cage_correlation(i)%short_plate_offset_y(2) write(lun2,'(a12,7es16.3)')'outer plate', quad_ref(i)%short_plate_offset_x(3)*1000, quad_cage_ref(i)%short_plate_offset_x(3)*1000, quad_plate_sep_ref(i)%short_plate_offset_x(3)*1000, quad_plate_total_unc(1)%short_plate_offset_x(3)*1000, & quad_cage_unc(i)%short_plate_offset_x(3)*1000, quad_plate_sep_unc(i)%short_plate_offset_x(3)*1000, quad_cage_correlation(i)%short_plate_offset_x(3) write(lun2,'(a12,7es16.3)')'bottom plate', quad_ref(i)%short_plate_offset_y(4)*1000, quad_cage_ref(i)%short_plate_offset_y(4)*1000, quad_plate_sep_ref(i)%short_plate_offset_y(4)*1000, quad_plate_total_unc(1)%short_plate_offset_y(4)*1000, & quad_cage_unc(i)%short_plate_offset_y(4)*1000, quad_plate_sep_unc(i)%short_plate_offset_y(4)*1000, quad_cage_correlation(i)%short_plate_offset_y(4) end do close(unit=lun2) ! Voltage and positions same on all quads ! do p = -1,1,2 !radial bfiield do k1_1=-1,1 !,2 !horizontal-vertical 1 ! k1_1=0 ! do k1_3=-1,1,2 !horizontal-vertical 1 k1_3=k1_1 do k2_1 =-1,1 ! ,2 !vertical 2 ! k2_1=0 ! do k2_3 =-1,1,2 !vertical 2 k2_3= k2_1 do k3_1 =-1,1 ! ,2 !horizontal 3 ! k3_1=0 ! do k3_3 =-1,1,2 !horizontal 3 k3_3=k3_1 do k4_1=-1,1 !,2 !vertical 4 ! k4_1=0 ! do k4_3=-1,1,2 !vertical 4 k4_3= k4_1 ! do n1_1 = -1,1 !,2 !voltage plate 1 n1_3 = n1_1 ! do n1_3 = -1,1,2 !voltage plate 1 ! do n2_1 = -1,1 !,2 !voltage plate 2 n2_3 = n2_1 ! do n2_3 = -1,1,2 !voltage plate 2 ! do n3_1 = -1,1 !,2 !voltage plate 3 n3_3 = n3_1 ! do n3_3 = -1,1,2 !voltage plate 3 ! do n4_1 = -1,1 !,2 !voltage plate 4 n4_3 = n4_1 ! do n4_3 = -1,1,2 !voltage plate 4 !!! not zero k1_1=0;k2_1=0;k3_1=0;k4_1=0 !!!zero ! if(k1_1 .ne. 0 .and. k2_1 .ne. 0 .and. k3_1 .ne. 0 .and. k4_1 .ne. 0)cycle ! skip cases with no zeros. Already done n=n+1 if(n n_end)goto 99 write(c,'(i3.3)')n ! if(n < 10)c(3:3)=char(n) ! if(n >= 10 .and. n <100)c(2:3)=char(n) ! if(n >= 100)c(1:3)=char(n) directory = 'config_survey_correlation'//'_'//c status= system('mkdir ' // directory) lun = lunget() open(unit=lun, file = trim(directory)//'/quad_plate_misalign.bmad') lun1 = lunget() open(unit = lun1,file=trim(directory)//'/quad_input.dat') write(lun1,'(a6)')'&input' do iquad = 1,4 write(iquad_word,'(i1)')iquad ! print *,' quad_word = ', iquad_word ! write(lun, '(a,f14.6)' )'quad'//iquad_word//'_long[grid_field(3)%r0(1)]=', k1_1 * quad_cage_unc(iquad)%long_plate_offset_x(1) + quad_cage_ref(iquad)%long_plate_offset_x(1) & - (k3_1 * quad_plate_sep_unc(iquad)%long_plate_offset_x(1) +quad_plate_sep_ref(iquad)%long_plate_offset_x(1))/2 write(lun, '(a,f14.6)' )'quad'//iquad_word//'_long[grid_field(4)%r0(2)]=', k2_1 * quad_cage_unc(iquad)%long_plate_offset_y(2) + quad_cage_ref(iquad)%long_plate_offset_y(2) & - (k4_1 * quad_plate_sep_unc(iquad)%long_plate_offset_y(2) +quad_plate_sep_ref(iquad)%long_plate_offset_y(2))/2 write(lun, '(a,f14.6)' )'quad'//iquad_word//'_long[grid_field(5)%r0(1)]=', k1_1 * quad_cage_unc(iquad)%long_plate_offset_x(3) + quad_cage_ref(iquad)%long_plate_offset_x(3) & + (k3_1 * quad_plate_sep_unc(iquad)%long_plate_offset_x(3) +quad_plate_sep_ref(iquad)%long_plate_offset_x(3))/2 write(lun, '(a,f14.6)' )'quad'//iquad_word//'_long[grid_field(6)%r0(2)]=', k2_1 * quad_cage_unc(iquad)%long_plate_offset_y(4) + quad_cage_ref(iquad)%long_plate_offset_y(4) & + (k4_1 * quad_plate_sep_unc(iquad)%long_plate_offset_y(4) +quad_plate_sep_ref(iquad)%long_plate_offset_y(4))/2 write(lun1, '(a,4f14.6)' )'quad_params%long_quad_plate_index('//iquad_word//') = ', volt(iquad),volt(iquad),volt(iquad),volt(iquad) ! write(lun1, '(a,4f14.6)' )'quad_params%long_quad_plate_index('//iquad_word//') = ', volt(iquad)+n1_1* quad(iquad)%long_plate_volt(1),volt(iquad)+n2_1*quad(iquad)%long_plate_volt(2), & ! volt(iquad)+n3_1* quad(iquad)%long_plate_volt(3),volt(iquad)+n4_1*quad(iquad)%long_plate_volt(4) write(lun, '(a,f14.6)' )'quad'//iquad_word//'_short[grid_field(3)%r0(1)]=', k1_1 * quad_cage_unc(iquad)%short_plate_offset_x(1) + quad_cage_ref(iquad)%short_plate_offset_x(1) & - (k3_1 * quad_plate_sep_unc(iquad)%short_plate_offset_x(1) +quad_plate_sep_ref(iquad)%short_plate_offset_x(1))/2 write(lun, '(a,f14.6)' )'quad'//iquad_word//'_short[grid_field(4)%r0(2)]=', k2_1 * quad_cage_unc(iquad)%short_plate_offset_y(2) + quad_cage_ref(iquad)%short_plate_offset_y(2) & - (k4_1 * quad_plate_sep_unc(iquad)%short_plate_offset_y(2) +quad_plate_sep_ref(iquad)%short_plate_offset_y(2))/2 write(lun, '(a,f14.6)' )'quad'//iquad_word//'_short[grid_field(5)%r0(1)]=', k1_1 * quad_cage_unc(iquad)%short_plate_offset_x(3) + quad_cage_ref(iquad)%short_plate_offset_x(3) & + (k3_1 * quad_plate_sep_unc(iquad)%short_plate_offset_x(3) +quad_plate_sep_ref(iquad)%short_plate_offset_x(3))/2 write(lun, '(a,f14.6)' )'quad'//iquad_word//'_short[grid_field(6)%r0(2)]=', k2_1 * quad_cage_unc(iquad)%short_plate_offset_y(4) + quad_cage_ref(iquad)%short_plate_offset_y(4) & + (k4_1 * quad_plate_sep_unc(iquad)%short_plate_offset_y(4) +quad_plate_sep_ref(iquad)%short_plate_offset_y(4))/2 write(lun1, '(a,4f14.6)' )'quad_params%short_quad_plate_index('//iquad_word//') = ', volt(iquad),volt(iquad),volt(iquad),volt(iquad) ! write(lun1, '(a,4f14.6)' )'quad_params%short_quad_plate_index('//iquad_word//') = ', volt(iquad)+n1_1* quad(iquad)%long_plate_volt(1),volt(iquad)+n2_1*quad(iquad)%long_plate_volt(2), & ! volt(iquad)+n3_1* quad(iquad)%long_plate_volt(3),volt(iquad)+n4_1*quad(iquad)%long_plate_volt(4) end do !iquad 1,4 ! ! write(lun, '(a,f14.6)' )'quad2_long[grid_field(3)%r0(1)]=', k1 * quad(2)%long_plate_offset_x(1) ! write(lun, '(a,f14.6)' )'quad2_long[grid_field(4)%r0(2)]=', k2 * quad(2)%long_plate_offset_y(2) ! write(lun, '(a,f14.6)' )'quad2_long[grid_field(5)%r0(1)]=', k3 * quad(2)%long_plate_offset_x(3) ! write(lun, '(a,f14.6)' )'quad2_long[grid_field(6)%r0(2)]=', k4 * quad(2)%long_plate_offset_y(4) ! write(lun1, '(a,4f14.6)' )'quad_params%long_quad_plate_index(2) = ', volt(2)+n1* quad(2)%long_plate_volt(1),volt(2)+n2*quad(2)%long_plate_volt(2), & ! volt(2)+n3* quad(2)%long_plate_volt(3),volt(2)+n4*quad(2)%long_plate_volt(4) ! ! write(lun, '(a,f14.6)' )'quad2_short[grid_field(3)%r0(1)]=', k1 * quad(2)%short_plate_offset_x(1) ! write(lun, '(a,f14.6)' )'quad2_short[grid_field(4)%r0(2)]=', k2 * quad(2)%short_plate_offset_y(2) ! write(lun, '(a,f14.6)' )'quad2_short[grid_field(5)%r0(1)]=', k3 * quad(2)%short_plate_offset_x(3) ! write(lun, '(a,f14.6)' )'quad2_short[grid_field(6)%r0(2)]=', k4 * quad(2)%short_plate_offset_y(4) ! write(lun1, '(a,4f14.6)' )'quad_params%short_quad_plate_index(2)= ', volt(2)+n1* quad(2)%short_plate_volt(1),volt(2)+n2*quad(2)%short_plate_volt(2), & ! volt(2)+n3* quad(2)%short_plate_volt(3),volt(2)+n4*quad(2)%short_plate_volt(4) ! ! write(lun, '(a,f14.6)' )'quad3_long[grid_field(3)%r0(1)]=', k1 * quad(3)%long_plate_offset_x(1) ! write(lun, '(a,f14.6)' )'quad3_long[grid_field(4)%r0(2)]=', k2 * quad(3)%long_plate_offset_y(2) ! write(lun, '(a,f14.6)' )'quad3_long[grid_field(5)%r0(1)]=', k3 * quad(3)%long_plate_offset_x(3) ! write(lun, '(a,f14.6)' )'quad3_long[grid_field(6)%r0(2)]=', k4 * quad(3)%long_plate_offset_y(4) ! write(lun1, '(a,4f14.6)' )'quad_params%long_quad_plate_index(3) = ', volt(3)+n1* quad(3)%long_plate_volt(1),volt(3)+n2*quad(3)%long_plate_volt(2), & ! volt(3)+n3* quad(3)%long_plate_volt(3),volt(3)+n4*quad(3)%long_plate_volt(4) ! write(lun, '(a,f14.6)' )'quad3_short[grid_field(3)%r0(1)]=', k1 * quad(3)%short_plate_offset_x(1) ! write(lun, '(a,f14.6)' )'quad3_short[grid_field(4)%r0(2)]=', k2 * quad(3)%short_plate_offset_y(2) ! write(lun, '(a,f14.6)' )'quad3_short[grid_field(5)%r0(1)]=', k3 * quad(3)%short_plate_offset_x(3) ! write(lun, '(a,f14.6)' )'quad3_short[grid_field(6)%r0(2)]=', k4 * quad(3)%short_plate_offset_y(4) ! write(lun1, '(a,4f14.6)' )'quad_params%short_quad_plate_index(3)= ', volt(3)+n1* quad(3)%short_plate_volt(1),volt(3)+n2*quad(3)%short_plate_volt(2), & ! volt(3)+n3* quad(3)%short_plate_volt(3),volt(3)+n4*quad(3)%short_plate_volt(4) ! ! write(lun, '(a,f14.6)' )'quad4_long[grid_field(3)%r0(1)]=', k1 * quad(4)%long_plate_offset_x(1) ! write(lun, '(a,f14.6)' )'quad4_long[grid_field(4)%r0(2)]=', k2 * quad(4)%long_plate_offset_y(2) ! write(lun, '(a,f14.6)' )'quad4_long[grid_field(5)%r0(1)]=', k3 * quad(4)%long_plate_offset_x(3) ! write(lun, '(a,f14.6)' )'quad4_long[grid_field(6)%r0(2)]=', k4 * quad(4)%long_plate_offset_y(4) ! write(lun1, '(a,4f14.6)' )'quad_params%long_quad_plate_index(4) = ', volt(4)+n1* quad(4)%long_plate_volt(1),volt(4)+n2*quad(4)%long_plate_volt(2), & ! volt(4)+n3* quad(4)%long_plate_volt(3),volt(4)+n4*quad(4)%long_plate_volt(4) ! ! write(lun, '(a,f14.6)' )'quad4_short[grid_field(3)%r0(1)]=', k1 * quad(4)%short_plate_offset_x(1) ! write(lun, '(a,f14.6)' )'quad4_short[grid_field(4)%r0(2)]=', k2 * quad(4)%short_plate_offset_y(2) ! write(lun, '(a,f14.6)' )'quad4_short[grid_field(5)%r0(1)]=', k3 * quad(4)%short_plate_offset_x(3) ! write(lun, '(a,f14.6)' )'quad4_short[grid_field(6)%r0(2)]=', k4 * quad(4)%short_plate_offset_y(4) ! write(lun1, '(a,4f14.6)' )'quad_params%short_quad_plate_index(4)= ', volt(4)+n1* quad(4)%short_plate_volt(1),volt(4)+n2*quad(4)%short_plate_volt(2), & ! volt(4)+n3* quad(4)%short_plate_volt(3),volt(4)+n4*quad(4)%short_plate_volt(4) ! write(lun, '(a,es14.6)' )'radial_field =', p*radial write(lun1, '(a,es14.6)' )'b_radial = ', p*radial write(lun1, '(a1)')'\' close(lun1) close(lun) lun = lunget() open (lun,file = trim(directory)//'/g2.sh') write(lun,'(a)')'#!/bin/bash' directory = 'config_survey_correlation'//'_'//c write(lun,'(a)')'cd /nfs/gm2/data2/dlr10/g-2/mytest/efield_pitch_survey_correlation/'//trim(directory) write(lun,'(a)')'DESTINATION_DIR=${JOB_ID}' write(lun,'(a)')'mkdir -p ${DESTINATION_DIR}' write(lun,'(a)')'/nfs/acc/user/dlr/development9_linux/g-2/softlink_lnx' write(lun,'(a)')'ln -s /nfs/gm2/data2/dlr10/g-2/mytest/efield_pitch_survey_correlation/input.dat' write(lun,'(a)')'ln -s /nfs/gm2/data2/dlr10/g-2/mytest/efield_pitch_survey_correlation/bmad_esquad_grid.' ! write(lun,'(a)')'ln -s /nfs/gm2/data2/dlr10/g-2/mytest/efield_pitch_survey_corerlation/INJ_TO_RING_phase_space.dat' write(lun,'(a)')'/nfs/acc/user/dlr/development9_linux/production/bin/g2_tracking > ${DESTINATION_DIR}/log.dat' close(lun) ! end do !horizontal 1 ! end do ! end do !voltage plate 4 ! end do !voltage plate 3 ! end do !voltage plate 2 ! end do !voltage plate 1 ! end do !vertical 4 ! end do end do ! horizontal 3 end do end do !vertical 2 end do ! end do ! p radial bield 99 continue end program create_lattice_config