diff --git a/bmad/doc/charged-tracking.tex b/bmad/doc/charged-tracking.tex index 62a07ef62f..7afded5481 100644 --- a/bmad/doc/charged-tracking.tex +++ b/bmad/doc/charged-tracking.tex @@ -67,7 +67,7 @@ \section{Relative Versus Absolute Time Tracking} To understand the difference between relative and absolute time tracking, consider a particle traveling on the reference orbit along side the reference particle in a circular ring with one RF cavity. This particle always has $z = 0$ and thus, with \vn{relative time tracking}, $t_\text{eff}$ -will always be zero (assuming \vn{bmad_com[absolute_time_ref_shift] is set to True) at the entrance +will always be zero (assuming \vn{bmad_com[absolute_time_ref_shift]} is set to True) at the entrance to the cavity. With \vn{absolute time tracking}, the particle, on the first turn, will have $t_\text{eff}$ equal to zero. However, on subsequent turns (or subsequent passes if using multipass), the time will increase by the revolution time $t_\text{C}$ on each turn. If the RF diff --git a/bmad/doc/elements.tex b/bmad/doc/elements.tex index 738b7e25ec..562ed2de9e 100644 --- a/bmad/doc/elements.tex +++ b/bmad/doc/elements.tex @@ -38,7 +38,7 @@ \chapter{Lattice Elements} \end{tabular} } \caption{Table of element types suitable for use with charged particles. Also see Table~\ref{t:control.classes}} -\label{t:particle.classes}\center +\label{t:particle.classes} \end{table} \index{MAD} @@ -75,7 +75,7 @@ \chapter{Lattice Elements} \end{tabular} } \caption{Table of element types suitable for use with photons. Also see Table~\ref{t:control.classes}} -\label{t:photon.classes}\center +\label{t:photon.classes} \end{table} \begin{table}[ht] @@ -88,11 +88,13 @@ \chapter{Lattice Elements} \end{tabular} } \caption{Table of controller elements.} -\label{t:control.classes}\center +\label{t:control.classes} \end{table} For a listing of element attributes for each type of element, see Chapter~\sref{c:attrib.list}. +\newpage + %----------------------------------------------------------------- \section{AB_Multipole} \label{s:ab.m} @@ -104,7 +106,7 @@ \section{AB_Multipole} General \vn{ab_multipole} attributes are: \begin{center} -\tt +\tt \begin{tabular}{llll} \toprule {\sl Attribute Class} & \s & {\sl Attribute Class} & \s \\ \midrule a$n$, b$n$ multipoles & \ref{s:multip} & Length & \ref{s:l} \\ @@ -136,6 +138,8 @@ \section{AB_Multipole} abc: ab_multipole, a2 = 0.034e-2, b3 = 5.7, a11 = 5.6e6/2 \end{example} +\newpage + %----------------------------------------------------------------- \section{AC_Kicker} \label{s:ac.kick} @@ -254,6 +258,8 @@ \section{AC_Kicker} ends of the element must be able to ``communicate'' (which happens at the speed of light) in a time scale short compared to the time scale of the change in the field. +\newpage + %----------------------------------------------------------------- \section{BeamBeam} \label{s:beambeam} @@ -417,8 +423,9 @@ \section{BeamBeam} bbi: beambeam, sig_x = 3e-3, sig_y = 3e-4, x_offset = 0.05, n_particle = 1.3e9 \end{example} +\newpage + %----------------------------------------------------------------- -\vskip 0ex plus 10ex \section{Beginning_Ele} \label{s:begin.ele} \index{beginning_ele|hyperbf} @@ -439,6 +446,8 @@ \section{Beginning_Ele} See \sref{s:list.beginning} for a full list of element attributes. +\newpage + %----------------------------------------------------------------- \section{Bends: Rbend and Sbend} \label{s:bend} @@ -796,6 +805,7 @@ \section{Bends: Rbend and Sbend} tracking, \bmad and PTC tracking will show marked differences when \vn{ptc_field_geometry} is set to \vn{straight}. +\newpage %----------------------------------------------------------------- \section{Capillary} @@ -837,6 +847,8 @@ \section{Capillary} the value of \vn{s} of the last wall cross-section (\sref{s:wall.capillary}). +\newpage + %----------------------------------------------------------------- \section{Collimators: Ecollimator and Rcollimator} \label{s:col} @@ -905,6 +917,8 @@ \section{Collimators: Ecollimator and Rcollimator} px_aperture_width2 = 0.3, py_aperture_width = 0.1 \end{example} +\newpage + %----------------------------------------------------------------- \section{Converter} \label{s:converter} @@ -1080,6 +1094,8 @@ \section{Converter} whether or not there is are restrictions. A value of zero (the default) for any one of these parameters means that that parameter is ignored. +\newpage + %----------------------------------------------------------------- \section{Crab_Cavity} \label{s:crab} @@ -1155,6 +1171,8 @@ \section{Crab_Cavity} \end{align} where $\beta = v/c$ is the normalized speed of the particle. +\newpage + %----------------------------------------------------------------- \section{Crystal} \label{s:crystal} @@ -1379,6 +1397,8 @@ \section{Crystal} %\end{equation} %where $T$ is the crystal thickness and \vn{nint} is the nearest integer function. +\newpage + %----------------------------------------------------------------- \section{Custom} \label{s:custom} @@ -1442,6 +1462,8 @@ \section{Custom} In this example the \vn{descrip} string is being used to specify a file that contains parameters for the element. +\newpage + %----------------------------------------------------------------- \section{Detector} \label{s:detector} @@ -1500,6 +1522,8 @@ \section{Detector} (\sref{s:surface}). It is assumed that any curvature is only in one dimension ($x$ or $y$). This allows a straight forward mapping of the rectangular pixel grid onto the curved surface. +\newpage + %----------------------------------------------------------------- \section{Diffraction_Plate} \label{s:diff.plate} @@ -1588,6 +1612,8 @@ \section{Diffraction_Plate} fresnel: diffraction_plate, wall = \{...\} \end{example} +\newpage + %----------------------------------------------------------------- \section{Drift} \label{s:drift} @@ -1621,6 +1647,8 @@ \section{Drift} superposition. That is, drifts ``disappear'' when superimposed upon. (\sref{s:super})]. +\newpage + %----------------------------------------------------------------- \section{E_Gun} \label{s:e.gun} @@ -1726,6 +1754,8 @@ \section{E_Gun} ... \} \end{example} +\newpage + %----------------------------------------------------------------- \section{ELseparator} \label{s:elsep} @@ -1782,6 +1812,8 @@ \section{ELseparator} h_sep2: elsep, l = 4.5, e_field = 1e5, tilt = pi/2 \end{example} +\newpage + %----------------------------------------------------------------- \section{EM_Field} \label{s:em.field} @@ -1829,6 +1861,8 @@ \section{EM_Field} Note: \vn{em_field} elements will be created when elements are superimposed (\sref{s:super}) and there is no other suitable element class. +\newpage + %----------------------------------------------------------------- \section{Fiducial} \label{s:fiducial} @@ -1946,6 +1980,8 @@ \section{Fiducial} used to position the second ring in a dual ring colliding beam machine. +\newpage + %----------------------------------------------------------------- \section{Floor_Shift} \label{s:floor.ele} @@ -2035,6 +2071,8 @@ \section{Floor_Shift} This offsets the element after the \vn{floor_shift} 3.2 meters from the previous element. +\newpage + %----------------------------------------------------------------- \section{Foil} \label{s:foil} @@ -2086,6 +2124,8 @@ \section{Foil} septum: foil, material_type = "Cu", thickness = 0.127 \end{example} +\newpage + %----------------------------------------------------------------- \section{Fork and Photon_Fork} \label{s:fork} @@ -2272,6 +2312,8 @@ \section{Fork and Photon_Fork} to program. For example, some programs will simply ignore everything except the root branch. Hopefully any program documentation will clarify the matter. +\newpage + %----------------------------------------------------------------- \section{Girder} \label{s:girder} @@ -2473,6 +2515,8 @@ \section{Girder} A \vn{girder} that has its \vn{is_on} attribute set to False is considered to be unsifted with respect to it's reference frame. +\newpage + %----------------------------------------------------------------------------- \section{GKicker} \label{s:gkicker} @@ -2509,6 +2553,8 @@ \section{GKicker} gk: gkicker, x_kick = 0.003, pz_kick = 0.12 \end{example} +\newpage + %----------------------------------------------------------------------------- \section{Group} \label{s:group} @@ -2687,6 +2733,8 @@ \section{Group} taken if that element attribute is changed. This is discussed in \sref{s:arith} and \sref{s:go.syntax}. +\newpage + %----------------------------------------------------------------- \section{Hybrid} \label{s:hybrid} @@ -2697,6 +2745,8 @@ \section{Hybrid} simulation. In terms of tracking a \vn{hybrid} element is essentially the same as a \vn{taylor} element. +\newpage + %----------------------------------------------------------------- \section{Instrument, Monitor, and Pipe} \label{s:monitor} @@ -2747,6 +2797,8 @@ \section{Instrument, Monitor, and Pipe} d21: instrum, l = 4.5 \end{example} +\newpage + %----------------------------------------------------------------- \section{Kickers: Hkicker and Vkicker} \label{s:hvkicker} @@ -2785,6 +2837,8 @@ \section{Kickers: Hkicker and Vkicker} h_kick: hkicker, l = 4.5, kick = 0.003 \end{example} +\newpage + %----------------------------------------------------------------- \section{Kicker} \label{s:kicker} @@ -2822,6 +2876,8 @@ \section{Kicker} a_kick: kicker, l = 4.5, hkick = 0.003 \end{example} +\newpage + %----------------------------------------------------------------- \section{Lcavity} \label{s:lcav} @@ -2984,6 +3040,8 @@ \section{Lcavity} the only accurate way to simulate a cavity in this situation is by integrating through the actual field [Cf.~Runge Kutta tracking (\sref{s:tkm})]} +\newpage + %----------------------------------------------------------------- \section{Lens} \label{s:lens} @@ -2993,6 +3051,8 @@ \section{Lens} This element is under development... +\newpage + %----------------------------------------------------------------- \section{Marker} \label{s:mark} @@ -3028,6 +3088,8 @@ \section{Marker} mm: mark, type = "BPM" \end{example} +\newpage + %----------------------------------------------------------------- \section{Mask} \label{s:mask} @@ -3118,6 +3180,8 @@ \section{Mask} \} \end{example} +\newpage + %----------------------------------------------------------------- \section{Match} \label{s:match} @@ -3291,6 +3355,8 @@ \section{Match} like a \vn{marker} element. That is, the orbit and Twiss parameters are unchanged when tracking through a \vn{match} element that is turned off. +\newpage + %----------------------------------------------------------------- \section{Mirror} \label{s:mirror} @@ -3332,6 +3398,8 @@ \section{Mirror} A \vn{mirror} may be offset and pitched (\ref{s:offset}). The incoming local reference coordinates are used for these misalignments. +\newpage + %----------------------------------------------------------------- \section{Multipole} \label{s:mult} @@ -3375,6 +3443,8 @@ \section{Multipole} m1: multipole, k1l = 0.034e-2, t1, k3sl = 4.5, t3 = 0.31*pi \end{example} +\newpage + %----------------------------------------------------------------- \section{Multilayer_mirror} \label{s:multilayer} @@ -3445,6 +3515,8 @@ \section{Multilayer_mirror} elements, if there is an ambiguity in the name as shown in the above example, an element will be considered to be of type \vn{multipole}. +\newpage + %----------------------------------------------------------------- \section{Null_Ele} \label{s:null.ele} @@ -3463,6 +3535,8 @@ \section{Null_Ele} \vn{Null_ele} elements are not generally useful otherwise. +\newpage + %----------------------------------------------------------------- \section{Octupole} \label{s:oct} @@ -3511,6 +3585,8 @@ \section{Octupole} oct1: octupole, l = 4.5, k3 = 0.003, tilt ! same as tilt = pi/8 \end{example} +\newpage + %----------------------------------------------------------------------------- \section{Overlay} \label{s:overlay} @@ -3617,6 +3693,8 @@ \section{Overlay} taken if that element attribute is changed. This is discussed in \sref{s:arith} and \sref{s:go.syntax}. +\newpage + %----------------------------------------------------------------- \section{Patch} \label{s:patch} @@ -3843,8 +3921,9 @@ \section{Patch} Since the geometry of a \vn{patch} element is complicated, interpolation of the chamber wall in the region of a patch follows special rules. See section~\sref{s:wall.vacuum} for more details. +\newpage + %----------------------------------------------------------------- -\vskip 0ex plus 10ex \section{Photon_Init} \label{s:photon.init} \index{photon_init|hyperbf} @@ -4071,6 +4150,8 @@ \section{Photon_Init} See Section~\sref{s:rowland} for an example lattice that can be used to simulate a Rowland circle spectrometer using a \vn{photon_init} element. +\newpage + %----------------------------------------------------------------- \section{Quadrupole} \label{s:quad} @@ -4129,8 +4210,9 @@ \section{Quadrupole} q03w: quad, l = 0.6, k1 = 0.003, tilt ! same as tilt = pi/4 \end{example} +\newpage + %----------------------------------------------------------------------------- -\vskip 0ex plus 10ex \section{Ramper} \label{s:ramper} \index{ovlerlay|hyperbf} @@ -4221,6 +4303,8 @@ \section{Ramper} util_programs/controller_function_plot \end{example} +\newpage + %----------------------------------------------------------------- \section{RF_bend} \label{s:rf.bend} @@ -4280,6 +4364,8 @@ \section{RF_bend} using a grid field map, there are no fringe attributes to set (for any elements where a grid field is used, it is always assumed that the fringe fields are included as part of the grid field). +\newpage + %----------------------------------------------------------------- \section{RFcavity} \label{s:rfcav} @@ -4395,6 +4481,8 @@ \section{RFcavity} rf1: rfcav, l = 4.5, harmon = 1281, voltage = 5e6 \end{example} +\newpage + %----------------------------------------------------------------- \section{Sad_Mult} \label{s:sad.mult} @@ -4509,6 +4597,8 @@ \section{Sad_Mult} qs1: sad_mult, l = 0.1, fringe_type = full, b2 = 0.6 / factorial(2) \end{example} +\newpage + %----------------------------------------------------------------- \section{Sample} \label{s:sample} @@ -4561,6 +4651,8 @@ \section{Sample} formula409: sample, x_limit = 10e-3, y_limit = 20e-3, mode = reflection \end{example} +\newpage + %----------------------------------------------------------------- \section{Sextupole} \label{s:sex} @@ -4609,6 +4701,8 @@ \section{Sextupole} q03w: sext, l = 0.6, k2 = 0.3, tilt ! same as tilt = pi/6 \end{example} +\newpage + %----------------------------------------------------------------- \section{Sol_Quad} \label{s:sq} @@ -4655,6 +4749,8 @@ \section{Sol_Quad} sq02: sol_quad, l = 2.6, k1 = 0.632, ks = 1.5e-9*parameter[p0c] \end{example} +\newpage + %----------------------------------------------------------------- \section{Solenoid} \label{s:sol} @@ -4722,6 +4818,8 @@ \section{Solenoid} with \vn{bmad_standard} tracking the field always extends to the edges of the element and the value of \vn{l_soft_edge} is ignored. +\newpage + %----------------------------------------------------------------- \section{Taylor} \label{s:taylor} @@ -4947,6 +5045,7 @@ \section{Taylor} \vn{symp_lie_ptc}. Thus the \vn{taylor} tracking method should always be used with \vn{taylor} elements. +\newpage %----------------------------------------------------------------- \section{Wiggler and Undulator} diff --git a/bmad/doc/list-element-attributes.tex b/bmad/doc/list-element-attributes.tex index b969b42416..430dad53c6 100644 --- a/bmad/doc/list-element-attributes.tex +++ b/bmad/doc/list-element-attributes.tex @@ -435,27 +435,27 @@ \chapter{List of Element Attributes} \label{s:list.em.field} \begin{tabular}{llll} \toprule -alias & fringe_at & phi0_err [rad/2pi] & wall \\ -aperture [m] & fringe_type & ptc_canonical_coords & wrap_superimpose \\ -aperture_at & gen_grad_map & ptc_integration_type & x1_limit [m] \\ -aperture_type & grid_field & ref_origin & x2_limit [m] \\ -autoscale_amplitude & integrator_order & ref_time_start [sec] & x_limit [m] \\ -autoscale_phase & is_on & reference & x_offset [m] \\ -cartesian_map & l [m] & rf_frequency [Hz] & x_offset_tot [m] \\ -constant_ref_energy & lord_pad1 [m] & rf_wavelength [m] & x_pitch [rad] \\ -create_jumbo_slave & lord_pad2 [m] & space_charge_method & x_pitch_tot [rad] \\ -csr_ds_step [m] & lr_freq_spread [Hz] & spin_fringe_on & y1_limit [m] \\ -csr_method & lr_self_wake_on & spin_tracking_method & y2_limit [m] \\ -cylindrical_map & lr_wake & sr_wake & y_limit [m] \\ -delta_ref_time [sec] & lr_wake_file & sr_wake_file & y_offset [m] \\ -descrip & mat6_calc_method & static_linear_map & y_offset_tot [m] \\ -ds_step [m] & num_steps & superimpose & y_pitch [rad] \\ -e_tot [eV] & offset [m] & symplectify & y_pitch_tot [rad] \\ -e_tot_start [eV] & offset_moves_aperture & taylor_map_includes_offsets & z_offset [m] \\ -ele_origin & p0c [eV] & tilt [rad] & z_offset_tot [m] \\ -field_autoscale & p0c_start [eV] & tilt_tot [rad] & \\ -field_calc & phi0 [rad/2pi] & tracking_method & \\ -field_overlaps & phi0_autoscale [rad/2pi] & type & \\ +alias & fringe_at & phi0_err [rad/2pi] & type \\ +aperture [m] & fringe_type & polarity & wall \\ +aperture_at & gen_grad_map & ptc_canonical_coords & wrap_superimpose \\ +aperture_type & grid_field & ptc_integration_type & x1_limit [m] \\ +autoscale_amplitude & integrator_order & ref_origin & x2_limit [m] \\ +autoscale_phase & is_on & ref_time_start [sec] & x_limit [m] \\ +cartesian_map & l [m] & reference & x_offset [m] \\ +constant_ref_energy & lord_pad1 [m] & rf_frequency [Hz] & x_offset_tot [m] \\ +create_jumbo_slave & lord_pad2 [m] & rf_wavelength [m] & x_pitch [rad] \\ +csr_ds_step [m] & lr_freq_spread [Hz] & space_charge_method & x_pitch_tot [rad] \\ +csr_method & lr_self_wake_on & spin_fringe_on & y1_limit [m] \\ +cylindrical_map & lr_wake & spin_tracking_method & y2_limit [m] \\ +delta_ref_time [sec] & lr_wake_file & sr_wake & y_limit [m] \\ +descrip & mat6_calc_method & sr_wake_file & y_offset [m] \\ +ds_step [m] & num_steps & static_linear_map & y_offset_tot [m] \\ +e_tot [eV] & offset [m] & superimpose & y_pitch [rad] \\ +e_tot_start [eV] & offset_moves_aperture & symplectify & y_pitch_tot [rad] \\ +ele_origin & p0c [eV] & taylor_map_includes_offsets & z_offset [m] \\ +field_autoscale & p0c_start [eV] & tilt [rad] & z_offset_tot [m] \\ +field_calc & phi0 [rad/2pi] & tilt_tot [rad] & \\ +field_overlaps & phi0_autoscale [rad/2pi] & tracking_method & \\ \bottomrule \end{tabular} \vfill diff --git a/bsim/modules/lt_tracking_mod.f90 b/bsim/modules/lt_tracking_mod.f90 index 205192a72b..7d268e5a7f 100644 --- a/bsim/modules/lt_tracking_mod.f90 +++ b/bsim/modules/lt_tracking_mod.f90 @@ -1691,7 +1691,7 @@ subroutine ltt_write_custom (lttp, ltt_com, i_turn, orbit, beam) type (expression_atom_struct), pointer :: st integer i_turn -integer i, n, ib, iu, ix, ix1, ix2, is, multi, power, width, digits, n_loc, n_stack +integer i, n, ib, iu, ix, ix1, ix2, is, multi, power, width, digits, n_loc, n_stack, n_bunch logical err @@ -1721,10 +1721,12 @@ subroutine ltt_write_custom (lttp, ltt_com, i_turn, orbit, beam) ! iu = lunget() +n_bunch = 0 +if (present(beam)) n_bunch = size(beam%bunch) if (i_turn == 0 .or. lttp%averages_output_every_n_turns == -1) then open(iu, file = lttp%custom_output_file, recl = 2000) - call ltt_write_params_header(lttp, ltt_com, iu, size(beam%bunch)) + call ltt_write_params_header(lttp, ltt_com, iu, n_bunch) line = '#' do i = 1, size(lttp%column) col => lttp%column(i) @@ -1745,9 +1747,9 @@ subroutine ltt_write_custom (lttp, ltt_com, i_turn, orbit, beam) orb_b(1) = orbit else ! beam is passed - allocate (orb_b(size(beam%bunch))) + allocate(orb_b(n_bunch)) - do ib = 1, size(beam%bunch) + do ib = 1, n_bunch bunch => beam%bunch(ib) n = count(bunch%particle%state == alive$) orb_b(ib)%t = ltt_bunch_time_sum(bunch, lttp) / n