subroutine show_tune (u, lines, nl) use cesrv_struct implicit none type (universe_struct), target :: u type (data_struct), pointer :: qx, qy, qz real(rp) factor integer nl character(20) fmt, norm character(*) lines(:) ! factor = logic%tune_conversion_factor qx => u%tune%x%d(1) qy => u%tune%y%d(1) qz => u%tune%z%d(1) if (logic%tune_units == kHz$ .or. logic%tune_units == degrees$) then fmt = '(a, f9.2)' norm = 'FRACTIONAL' else fmt = '(a, f9.4)' norm = 'NONE' endif write (lines(nl+1), *) write (lines(nl+2), '(32x, 3a)') 'Tune (', trim(frequency_units_name(logic%tune_units)), ')' write (lines(nl+3), '(13x, a)') 'Meas Ref Model Design Meas-Model Meas-Design Design-Model' write (lines(nl+4), '(1x, a)') 'Qx' write (lines(nl+5), '(1x, a)') 'Qy' write (lines(nl+6), '(1x, a)') 'Qz' call write_it (norm, lines(nl+4), qx%meas, ' ', qx%meas) call write_it (norm, lines(nl+5), qy%meas, ' ', qy%meas) call write_it (norm, lines(nl+6), qz%meas, ' ', qz%meas) call write_it (norm, lines(nl+4), qx%ref, '', qx%ref) call write_it (norm, lines(nl+5), qy%ref, '', qy%ref) call write_it (norm, lines(nl+6), qz%ref, '', qz%ref) call write_it (norm, lines(nl+4), qx%model, '') call write_it (norm, lines(nl+5), qy%model, '') call write_it (norm, lines(nl+6), qz%model, '') call write_it (norm, lines(nl+4), qx%design, '') call write_it (norm, lines(nl+5), qy%design, '') call write_it (norm, lines(nl+6), qz%design, '') call write_it ('MODULO2', lines(nl+4), qx%meas-qx%model, ' ', qx%meas) call write_it ('MODULO2', lines(nl+5), qy%meas-qy%model, ' ', qy%meas) call write_it ('MODULO2', lines(nl+6), qz%meas-qz%model, ' ', qz%meas) call write_it ('MODULO2', lines(nl+4), qx%meas-qx%design, ' ', qx%meas) call write_it ('MODULO2', lines(nl+5), qy%meas-qy%design, ' ', qy%meas) call write_it ('MODULO2', lines(nl+6), qz%meas-qz%design, ' ', qz%meas) call write_it ('MODULO2', lines(nl+4), qx%design-qx%model, ' ') call write_it ('MODULO2', lines(nl+5), qy%design-qy%model, ' ') call write_it ('MODULO2', lines(nl+6), qz%design-qz%model, ' ') nl = nl + 6 ! if (.not. u%q2x%measured) return write (lines(nl+1), *) nl=nl+1 write (lines(nl+1), '(1x, a)') '2Qx' write (lines(nl+2), '(1x, a)') '2Qy' write (lines(nl+3), '(1x, a)') '2Qx+2Qy' write (lines(nl+4), '(1x, a)') '2Qx-2Qy' call write_it (norm, lines(nl+1), 2*qx%meas, ' ', qx%meas) call write_it (norm, lines(nl+2), 2*qy%meas, ' ', qy%meas) call write_it (norm, lines(nl+3), qx%meas+qy%meas, '', qx%meas) call write_it (norm, lines(nl+4), qx%meas-qy%meas, '', qx%meas) call write_it (norm, lines(nl+1), 2*qx%ref, '', qx%ref) call write_it (norm, lines(nl+2), 2*qy%ref, '', qy%ref) call write_it (norm, lines(nl+3), qx%ref+qy%ref, '', qx%ref) call write_it (norm, lines(nl+4), qx%ref-qy%ref, '', qx%ref) call write_it (norm, lines(nl+1), 2*qx%model, '') call write_it (norm, lines(nl+2), 2*qy%model, '') call write_it (norm, lines(nl+3), qx%model+qy%model, '') call write_it (norm, lines(nl+4), qx%model-qy%model, '') call write_it (norm, lines(nl+1), 2*qx%design, '') call write_it (norm, lines(nl+2), 2*qy%design, '') call write_it (norm, lines(nl+3), qx%design+qy%design, '') call write_it (norm, lines(nl+4), qx%design-qy%design, '') nl=nl+4 !------------------------------------------------- contains subroutine write_it (norm_str, line, value, blanks, value0) character(*) line, blanks, norm_str real(rp) value, v real(rp), optional :: value0 integer ix if (present(value0)) then if (value0 <= 0) then line = trim(line) // blanks // ' -----' return endif endif v = value select case (norm_str) case ('FRACTIONAL') v = modulo (v, twopi) case ('MODULO2') v = modulo2 (v, pi) end select ix = len_trim(line) write (line(ix+1:), fmt) blanks, factor * v end subroutine end subroutine