subroutine write_rfquad_loop (vparam_id, vparam_label, vparam_col_ind, nmuons,kicker_params, tot, coef, chisq, ndf) use bmad use muon_mod use muon_interface use parameters_bmad implicit none type (kicker_params_struct) kicker_params integer, save :: lun32 integer vparam_id, vparam_col_ind, nmuons integer tot character*20 vparam_label logical first/.true./ real(rp) peak_to_peak real(rp) coef(4), chisq real(rp) chisq_pdf integer ndf integer num/0/ if(first)then lun32 = lunget() open(unit = lun32, file = trim(directory)//'/'//'RFquadparamDependence.dat') write(lun32,'(a,i4)')'vparam_id =', vparam_id write(lun32,'(a,a1,a,a1)')'set xlabel ','"',vparam_label,'"' write(lun32,'(a,i5)')'column1 =',vparam_col_ind write(lun32,'(a,i10)')'nmuons =', nmuons write(lun32,'(a)')'exit' write(lun32,'(/,a,/)')'#' write(lun32,'(a12,12x,a24,12x,12x,a24,12x, 12x,a24,12x,12x,a24,12x,6a12,a12,a12,a12)') & 'loop num','rf_quad(1:4)%amp_h','rf_quad(1:4)%phi_h', & 'rf_quad(1:4)%start_h', 'rf_quad(1:4)%freq_h', & 'coef[1]','coef[2]','coef[3]','coef[4]', 'chisq','ndf', ' chisq/ndf', & 'n muons','remaining' first=.false. endif !open lun32 num = num+1 chisq_pdf=0. if(ndf/=0)chisq_pdf=chisq/ndf write(lun32,'(i12,4es12.4,4es12.4,4es12.4,4es12.4,4es12.4,es12.4,i12,es12.4,2i12)') & num, rf_quad(1:4)%amp_h,rf_quad(1:4)%phi_h, & rf_quad(1:4)%start_h * 1.e6, rf_quad(1:4)%freq_h/1.e6, & coef(1:4), chisq, ndf, chisq_pdf, & nmuons, tot return end