xtrack 0.38.0__tar.gz → 0.38.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xtrack-0.38.0/xtrack.egg-info → xtrack-0.38.2}/PKG-INFO +1 -1
- xtrack-0.38.2/xtrack/_version.py +1 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements.py +1 -1
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/dipoleedge.h +2 -2
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/fringe_track.h +96 -102
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/track_thick_cfd.h +6 -4
- xtrack-0.38.2/xtrack/beam_elements/elements_src/zetashift.h +26 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/line.py +2 -2
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/mad_loader.py +3 -5
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/match.py +3 -0
- {xtrack-0.38.0 → xtrack-0.38.2/xtrack.egg-info}/PKG-INFO +1 -1
- xtrack-0.38.0/xtrack/_version.py +0 -1
- xtrack-0.38.0/xtrack/beam_elements/elements_src/zetashift.h +0 -42
- {xtrack-0.38.0 → xtrack-0.38.2}/LICENSE +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/MANIFEST.in +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/README.md +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/base_classes.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/elements.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/line.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/particles.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/pyproject.toml +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/setup.cfg +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/setup.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/base_element.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/combinedfunctionmagnet.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/fringe.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/lineartransfermatrix.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/multipolar_kick.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/wedge_track.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/footprint.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/general.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/headers/checks.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/headers/constants.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/internal_record.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/lumi.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/multiline/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/multiline/multiline.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/multiline/shared_knobs.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/prebuild_kernels.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/prebuilt_kernels/_kernel_definitions.json +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/random/__init__.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/slicing.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/survey.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/tapering.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/targets.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/tracker.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/tracker_data.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack/twiss.py +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack.egg-info/SOURCES.txt +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.38.0 → xtrack-0.38.2}/xtrack.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '0.38.2'
|
@@ -1234,7 +1234,7 @@ class SimpleThinBend(BeamElement):
|
|
1234
1234
|
return
|
1235
1235
|
|
1236
1236
|
if len(knl) != 1:
|
1237
|
-
raise ValueError("For a
|
1237
|
+
raise ValueError("For a SimpleThinBend, len(knl) must be 1.")
|
1238
1238
|
|
1239
1239
|
kwargs["knl"] = knl
|
1240
1240
|
self.xoinitialize(**kwargs)
|
@@ -58,7 +58,7 @@ void DipoleEdge_track_local_particle(DipoleEdgeData el, LocalParticle* part0){
|
|
58
58
|
//end_per_particle_block
|
59
59
|
}
|
60
60
|
//start_per_particle_block (part0->part)
|
61
|
-
|
61
|
+
Fringe_single_particle(part, fint, hgap, k);
|
62
62
|
//end_per_particle_block
|
63
63
|
if (sin_ > -99.){
|
64
64
|
//start_per_particle_block (part0->part)
|
@@ -73,7 +73,7 @@ void DipoleEdge_track_local_particle(DipoleEdgeData el, LocalParticle* part0){
|
|
73
73
|
//end_per_particle_block
|
74
74
|
}
|
75
75
|
//start_per_particle_block (part0->part)
|
76
|
-
|
76
|
+
Fringe_single_particle(part, fint, hgap, -k);
|
77
77
|
//end_per_particle_block
|
78
78
|
if (sin_ > -99.){
|
79
79
|
//start_per_particle_block (part0->part)
|
@@ -11,11 +11,13 @@
|
|
11
11
|
#define POW4(X) ((X)*(X)*(X)*(X))
|
12
12
|
|
13
13
|
|
14
|
-
|
14
|
+
#ifndef XTRACK_FRINGE_FROM_PTC
|
15
|
+
|
16
|
+
// MAD-NG implementation
|
15
17
|
// https://github.com/MethodicalAcceleratorDesign/MAD/blob/d3cabd9cdebde62ebedb51bab61ac033b9159489/src/madl_dynmap.mad#L1864
|
16
18
|
|
17
19
|
/*gpufun*/
|
18
|
-
void
|
20
|
+
void Fringe_single_particle(
|
19
21
|
LocalParticle* part, // LocalParticle to track
|
20
22
|
const double fint, // Fringe field integral
|
21
23
|
const double hgap, // Half gap
|
@@ -24,7 +26,7 @@ void MadNG_Fringe_single_particle(
|
|
24
26
|
if (fabs(k0) < 10e-10) {
|
25
27
|
return;
|
26
28
|
}
|
27
|
-
|
29
|
+
|
28
30
|
const double beta0 = LocalParticle_get_beta0(part);
|
29
31
|
|
30
32
|
// Particle coordinates
|
@@ -34,15 +36,16 @@ void MadNG_Fringe_single_particle(
|
|
34
36
|
const double py = LocalParticle_get_py(part);
|
35
37
|
const double t = LocalParticle_get_zeta(part) / beta0;
|
36
38
|
const double pt = LocalParticle_get_ptau(part);
|
39
|
+
const double delta = LocalParticle_get_delta(part);
|
37
40
|
|
38
41
|
const double fh = hgap * fint;
|
39
42
|
const double fsad = (fh > 10e-10) ? 1./(72 * fh) : 0;
|
40
43
|
const double k0w = k0;
|
41
44
|
|
42
|
-
const double _beta = 1. /
|
43
|
-
const double b0 = k0w
|
45
|
+
const double _beta = 1. / beta0 ;
|
46
|
+
const double b0 = k0w; // MAD does something with the charge (to be checked)
|
44
47
|
|
45
|
-
const double dpp = 1. +
|
48
|
+
const double dpp = POW2(1. + delta);
|
46
49
|
const double pz = sqrt(dpp - POW2(px) - POW2(py));
|
47
50
|
const double _pz = 1./pz;
|
48
51
|
const double relp = 1./sqrt(dpp);
|
@@ -71,13 +74,11 @@ void MadNG_Fringe_single_particle(
|
|
71
74
|
const double ky = fi1*xyp*_pz + fi2*yp2*_pz - fi3*yp;
|
72
75
|
const double kz = fi1*tfac*xp*POW2(_pz) + fi2*tfac*yp*POW2(_pz) - fi3*tfac*_pz;
|
73
76
|
|
74
|
-
// printf("ky = %e\n", ky);
|
75
|
-
// printf("k0*fi0 = %e\n", fi0);
|
76
|
-
|
77
77
|
const double new_y = 2 * y / (1 + sqrt(1 - 2 * ky * y));
|
78
|
-
const double new_x = x + 0.5*kx*POW2(new_y);
|
79
|
-
const double new_py = py
|
80
|
-
const double new_t = t + 0.5*kz*POW2(
|
78
|
+
const double new_x = x + 0.5 * kx * POW2(new_y);
|
79
|
+
const double new_py = py - 4 * c3 * POW3(new_y) - b0 * tan(fi0) * new_y;
|
80
|
+
const double new_t = t + 0.5 * kz * POW2(new_y) + c3 * POW4(new_y) * POW2(relp) * tfac;
|
81
|
+
|
81
82
|
const double new_zeta = new_t * beta0;
|
82
83
|
|
83
84
|
LocalParticle_set_x(part, new_x);
|
@@ -86,104 +87,97 @@ void MadNG_Fringe_single_particle(
|
|
86
87
|
LocalParticle_set_zeta(part, new_zeta);
|
87
88
|
}
|
88
89
|
|
90
|
+
#endif // no XTRACK_FRINGE_FROM_PTC
|
89
91
|
|
90
92
|
|
93
|
+
#ifdef XTRACK_FRINGE_FROM_PTC
|
91
94
|
// The following is ported from PTC:
|
95
|
+
//https://github.com/MethodicalAcceleratorDesign/MAD-X/blob/master/libs/ptc/src/Sh_def_kind.f90#L4936
|
92
96
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
// const double b = k0; // PTC naming convention
|
105
|
-
|
106
|
-
// double fsad=0.0;
|
107
|
-
// if(fint*hgap != 0.){
|
108
|
-
// fsad=1./(fint*hgap*2)/36.0;
|
109
|
-
// }
|
110
|
-
|
111
|
-
// // Particle coordinates
|
112
|
-
// const double x = LocalParticle_get_x(part);
|
113
|
-
// const double px = LocalParticle_get_px(part);
|
114
|
-
// const double y = LocalParticle_get_y(part);
|
115
|
-
// const double py = LocalParticle_get_py(part);
|
116
|
-
// const double zeta = LocalParticle_get_zeta(part);
|
117
|
-
// const double delta = LocalParticle_get_delta(part);
|
118
|
-
// const double rvv = LocalParticle_get_rvv(part);
|
119
|
-
|
120
|
-
// const double el = zeta * rvv;
|
121
|
-
|
122
|
-
// // if(k%TIME) then
|
123
|
-
// // PZ=sqrt(1.0_dp+2.0_dp*X(5)/el%beta0+x(5)**2-X(2)**2-X(4)**2)
|
124
|
-
// // TIME_FAC=1.0_dp/el%beta0+X(5)
|
125
|
-
// // rel_p=sqrt(1.0_dp+2.0_dp*X(5)/el%beta0+x(5)**2)
|
126
|
-
// // else
|
127
|
-
// const double pz = sqrt((1.0 + delta)*(1.0 + delta) - px * px - py * py);
|
128
|
-
// const double time_fac = 1.0 + delta;
|
129
|
-
// const double rel_p = time_fac;
|
130
|
-
// const double c3 = b * b * fsad / rel_p;
|
131
|
-
|
132
|
-
// const double xp = px / pz;
|
133
|
-
// const double yp = py / pz;
|
134
|
-
|
135
|
-
|
136
|
-
// const double D_1_1 = (1.0 + xp * xp) / pz;
|
137
|
-
// const double D_2_1 = xp * yp / pz;
|
138
|
-
// const double D_3_1 = -xp;
|
139
|
-
// const double D_1_2 = xp * yp / pz;
|
140
|
-
// const double D_2_2 = (1.0 + yp * yp)/pz;
|
141
|
-
// const double D_3_2 = -yp;
|
142
|
-
// const double D_1_3 = -time_fac * xp / (pz * pz);
|
143
|
-
// const double D_2_3 = -time_fac * yp / (pz * pz);
|
144
|
-
// const double D_3_3 = time_fac / pz;
|
145
|
-
|
146
|
-
// double fi0 = atan((xp / (1.0 + yp * yp)))-b * fint * hgap * 2.0 * ( 1.0 + xp * xp *(2.0 + yp * yp)) * pz;
|
147
|
-
// const double co2 = b / cos(fi0) / cos(fi0);
|
148
|
-
// const double co1 = co2 / (1.0 + (xp / POW2(1.0 + yp * yp)));
|
149
|
-
|
150
|
-
// const double fi_1 = co1 / (1.0 + yp*yp) - co2 * b * fint * hgap * 2.0*(2.0 * xp * (2.0 + yp * yp) * pz);
|
151
|
-
// const double fi_2 = -co1 * 2.0 * xp * yp / POW2(1.0 + yp * yp) - co2 * b * fint * hgap * 2.0 * (2.0 * xp* xp * yp) * pz;
|
152
|
-
// const double fi_3 = -co2 * b * fint * hgap * 2.0 * (1.0 + xp * xp * (2.0 + yp*yp));
|
153
|
-
|
154
|
-
// fi0 = b * tan(fi0);
|
155
|
-
|
156
|
-
// double BB = 0;
|
157
|
-
// BB = fi_1 * D_1_2 + BB;
|
158
|
-
// BB = fi_2 * D_2_2 + BB;
|
159
|
-
// BB = fi_3 * D_3_2 + BB;
|
160
|
-
|
161
|
-
// const double new_y = 2.0 * y / (1.0 + sqrt(1.0 - 2.0 * BB * y));
|
162
|
-
// double new_py = py - fi0 * new_y;
|
163
|
-
// // printf("fi0 = %e\n", fi0);
|
164
|
-
// // printf("BBy = %e\n", BB);
|
165
|
-
|
166
|
-
// BB = 0;
|
167
|
-
// BB = fi_1 * D_1_1 + BB;
|
168
|
-
// BB = fi_2 * D_2_1 + BB;
|
169
|
-
// BB = fi_3 * D_3_1 + BB;
|
170
|
-
// const double new_x = x + 0.5 * BB * new_y * new_y;
|
97
|
+
/*gpufun*/
|
98
|
+
void Fringe_single_particle(
|
99
|
+
LocalParticle* part, // LocalParticle to track
|
100
|
+
const double fint, // Fringe field integral
|
101
|
+
const double hgap, // Half gap
|
102
|
+
const double k0 // Dipole strength
|
103
|
+
) {
|
104
|
+
if (fabs(k0) < 10e-10) {
|
105
|
+
return;
|
106
|
+
}
|
171
107
|
|
172
|
-
|
173
|
-
// BB = fi_1 * D_1_3 + BB;
|
174
|
-
// BB = fi_2 * D_2_3 + BB;
|
175
|
-
// BB = fi_3 * D_3_3 + BB;
|
176
|
-
// double new_el = el - 0.5 * BB * new_y * new_y;
|
108
|
+
const double b = k0; // PTC naming convention
|
177
109
|
|
110
|
+
double fsad=0.0;
|
111
|
+
if(fint*hgap != 0.){
|
112
|
+
fsad=1./(fint*hgap*2)/36.0;
|
113
|
+
}
|
178
114
|
|
179
|
-
//
|
180
|
-
|
115
|
+
// Particle coordinates
|
116
|
+
const double beta0 = LocalParticle_get_beta0(part);
|
117
|
+
const double x = LocalParticle_get_x(part);
|
118
|
+
const double px = LocalParticle_get_px(part);
|
119
|
+
const double y = LocalParticle_get_y(part);
|
120
|
+
const double py = LocalParticle_get_py(part);
|
121
|
+
const double ptau = LocalParticle_get_ptau(part);
|
122
|
+
const double delta = LocalParticle_get_delta(part);
|
123
|
+
|
124
|
+
const double pz = sqrt((1.0 + delta)*(1.0 + delta) - px * px - py * py);
|
125
|
+
const double time_fac = 1/beta0 + ptau;
|
126
|
+
const double rel_p = sqrt(1. + 2*ptau/beta0 + POW2(ptau));
|
127
|
+
const double c3 = b * b * fsad / rel_p;
|
128
|
+
|
129
|
+
const double xp = px / pz;
|
130
|
+
const double yp = py / pz;
|
131
|
+
|
132
|
+
const double D_1_1 = (1.0 + xp * xp) / pz;
|
133
|
+
const double D_2_1 = xp * yp / pz;
|
134
|
+
const double D_3_1 = -xp;
|
135
|
+
const double D_1_2 = xp * yp / pz;
|
136
|
+
const double D_2_2 = (1.0 + yp * yp)/pz;
|
137
|
+
const double D_3_2 = -yp;
|
138
|
+
const double D_1_3 = -time_fac * xp / (pz * pz);
|
139
|
+
const double D_2_3 = -time_fac * yp / (pz * pz);
|
140
|
+
const double D_3_3 = time_fac / pz;
|
141
|
+
|
142
|
+
double fi0 = atan((xp / (1.0 + yp * yp)))-b * fint * hgap * 2.0 * ( 1.0 + xp * xp *(2.0 + yp * yp)) * pz;
|
143
|
+
const double co2 = b / cos(fi0) / cos(fi0);
|
144
|
+
const double co1 = co2 / (1.0 + POW2(xp / POW2(1.0 + yp * yp)));
|
145
|
+
|
146
|
+
const double fi_1 = co1 / (1.0 + yp*yp) - co2 * b * fint * hgap * 2.0*(2.0 * xp * (2.0 + yp * yp) * pz);
|
147
|
+
const double fi_2 = -co1 * 2.0 * xp * yp / POW2(1.0 + yp * yp) - co2 * b * fint * hgap * 2.0 * (2.0 * xp* xp * yp) * pz;
|
148
|
+
const double fi_3 = -co2 * b * fint * hgap * 2.0 * (1.0 + xp * xp * (2.0 + yp*yp));
|
149
|
+
|
150
|
+
fi0 = b * tan(fi0);
|
151
|
+
|
152
|
+
double BB = 0;
|
153
|
+
BB = fi_1 * D_1_2 + BB;
|
154
|
+
BB = fi_2 * D_2_2 + BB;
|
155
|
+
BB = fi_3 * D_3_2 + BB;
|
156
|
+
|
157
|
+
const double new_y = 2.0 * y / (1.0 + sqrt(1.0 - 2.0 * BB * y));
|
158
|
+
double new_py = py - fi0 * new_y;
|
159
|
+
|
160
|
+
BB = 0;
|
161
|
+
BB = fi_1 * D_1_1 + BB;
|
162
|
+
BB = fi_2 * D_2_1 + BB;
|
163
|
+
BB = fi_3 * D_3_1 + BB;
|
164
|
+
const double new_x = x + 0.5 * BB * new_y * new_y;
|
165
|
+
|
166
|
+
BB = 0;
|
167
|
+
BB = fi_1 * D_1_3 + BB;
|
168
|
+
BB = fi_2 * D_2_3 + BB;
|
169
|
+
BB = fi_3 * D_3_3 + BB;
|
170
|
+
double d_tau = -0.5 * BB * new_y * new_y;
|
171
|
+
|
172
|
+
new_py = new_py - 4 * c3 * POW3(new_y);
|
173
|
+
d_tau = d_tau + c3 * POW4(new_y) / POW2(rel_p) * time_fac;
|
181
174
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
175
|
+
LocalParticle_set_x(part, new_x);
|
176
|
+
LocalParticle_set_y(part, new_y);
|
177
|
+
LocalParticle_set_py(part, new_py);
|
178
|
+
LocalParticle_add_to_zeta(part, -d_tau * beta0); // PTC uses tau = ct
|
179
|
+
}
|
180
|
+
#endif // XTRACK_FRINGE_FROM_PTC
|
187
181
|
|
188
182
|
|
189
183
|
// The following is derived from https://cds.cern.ch/record/2857004
|
@@ -9,6 +9,8 @@
|
|
9
9
|
#define POW2(X) ((X)*(X))
|
10
10
|
#define NONZERO(X) ((X) != 0.0)
|
11
11
|
|
12
|
+
// From madx: https://github.com/MethodicalAcceleratorDesign/MAD-X/blob/8695bd422dc403a01aa185e9fea16603bbd5b3e1/src/trrun.f90#L4320
|
13
|
+
|
12
14
|
/*gpufun*/
|
13
15
|
void track_thick_cfd(
|
14
16
|
LocalParticle* part, // LocalParticle to track
|
@@ -29,12 +31,11 @@ void track_thick_cfd(
|
|
29
31
|
const double px = LocalParticle_get_px(part);
|
30
32
|
const double py = LocalParticle_get_py(part);
|
31
33
|
const double pt = LocalParticle_get_ptau(part);
|
34
|
+
const double rvv = LocalParticle_get_rvv(part);
|
32
35
|
|
33
|
-
const double beti = 1.0 / (LocalParticle_get_rvv(part) * beta0);
|
34
36
|
// In MAD-X (delta + 1) is computed:
|
35
37
|
// const double delta_plus_1 = sqrt(pt*pt + 2.0*pt*beti + 1.0);
|
36
38
|
const double delta_plus_1 = LocalParticle_get_delta(part) + 1;
|
37
|
-
const double bet = delta_plus_1 / (beti + pt);
|
38
39
|
|
39
40
|
const double k0 = k0_ / delta_plus_1;
|
40
41
|
const double k1 = k1_ / delta_plus_1;
|
@@ -127,13 +128,14 @@ void track_thick_cfd(
|
|
127
128
|
else {
|
128
129
|
length_ += 0.5 * POW2(D) * length;
|
129
130
|
}
|
130
|
-
|
131
|
+
|
132
|
+
const double dzeta = length - length_ / rvv;
|
131
133
|
|
132
134
|
LocalParticle_set_x(part, x_);
|
133
135
|
LocalParticle_set_px(part, px_);
|
134
136
|
LocalParticle_set_y(part, y_);
|
135
137
|
LocalParticle_set_py(part, py_);
|
136
|
-
LocalParticle_add_to_zeta(part,
|
138
|
+
LocalParticle_add_to_zeta(part, dzeta);
|
137
139
|
LocalParticle_add_to_s(part, length);
|
138
140
|
}
|
139
141
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// copyright ############################### //
|
2
|
+
// This file is part of the Xtrack Package. //
|
3
|
+
// Copyright (c) CERN, 2021. //
|
4
|
+
// ######################################### //
|
5
|
+
|
6
|
+
#ifndef XTRACK_ZETASHIFT_H
|
7
|
+
#define XTRACK_ZETASHIFT_H
|
8
|
+
|
9
|
+
/*gpufun*/
|
10
|
+
void ZetaShift_track_local_particle(ZetaShiftData el, LocalParticle* part0){
|
11
|
+
|
12
|
+
|
13
|
+
double dzeta = ZetaShiftData_get_dzeta(el);
|
14
|
+
#ifdef XSUITE_BACKTRACK
|
15
|
+
dzeta = -dzeta;
|
16
|
+
#endif
|
17
|
+
|
18
|
+
//start_per_particle_block (part0->part)
|
19
|
+
|
20
|
+
LocalParticle_add_to_zeta(part, -dzeta);
|
21
|
+
|
22
|
+
//end_per_particle_block
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
#endif
|
@@ -2334,7 +2334,7 @@ class Line:
|
|
2334
2334
|
for name, element in self.element_dict.items():
|
2335
2335
|
if _is_simple_quadrupole(element):
|
2336
2336
|
fast_quad = beam_elements.SimpleThinQuadrupole(
|
2337
|
-
knl=element.knl,
|
2337
|
+
knl=element.knl[:2],
|
2338
2338
|
_context=element._context,
|
2339
2339
|
)
|
2340
2340
|
self.element_dict[name] = fast_quad
|
@@ -2350,7 +2350,7 @@ class Line:
|
|
2350
2350
|
for name, element in self.element_dict.items():
|
2351
2351
|
if _is_simple_dipole(element):
|
2352
2352
|
fast_di = beam_elements.SimpleThinBend(
|
2353
|
-
knl=element.knl,
|
2353
|
+
knl=element.knl[:1],
|
2354
2354
|
hxl=element.hxl,
|
2355
2355
|
length=element.length,
|
2356
2356
|
_context=element._context,
|
@@ -1413,11 +1413,9 @@ class MadLoader:
|
|
1413
1413
|
el_transverse = self.Builder(
|
1414
1414
|
ee.name, self.classes.XYShift, dx=ee.dx, dy=ee.dy
|
1415
1415
|
)
|
1416
|
-
|
1417
|
-
|
1418
|
-
ee.name, self.classes.ZetaShift, dzeta=dzeta
|
1419
|
-
)
|
1416
|
+
if ee.ds:
|
1417
|
+
raise NotImplementedError # Need to implement ShiftS element
|
1420
1418
|
ee.dx = 0
|
1421
1419
|
ee.dy = 0
|
1422
1420
|
ee.ds = 0
|
1423
|
-
return self.make_compound_elem([el_transverse
|
1421
|
+
return self.make_compound_elem([el_transverse], ee)
|
@@ -152,6 +152,9 @@ class TargetInequality(Target):
|
|
152
152
|
self.ineq_sign = ineq_sign
|
153
153
|
self.rhs = rhs
|
154
154
|
|
155
|
+
def __repr__(self):
|
156
|
+
return f'TargetInequality({self.tar} {self.ineq_sign} {self.rhs}, tol={self.tol}, weight={self.weight})'
|
157
|
+
|
155
158
|
def eval(self, tw):
|
156
159
|
val = super().eval(tw)
|
157
160
|
if self.ineq_sign == '<' and val < self.rhs:
|
xtrack-0.38.0/xtrack/_version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '0.38.0'
|
@@ -1,42 +0,0 @@
|
|
1
|
-
// copyright ############################### //
|
2
|
-
// This file is part of the Xtrack Package. //
|
3
|
-
// Copyright (c) CERN, 2021. //
|
4
|
-
// ######################################### //
|
5
|
-
|
6
|
-
#ifndef XTRACK_ZETASHIFT_H
|
7
|
-
#define XTRACK_ZETASHIFT_H
|
8
|
-
|
9
|
-
/*gpufun*/
|
10
|
-
void ZetaShift_track_local_particle(ZetaShiftData el, LocalParticle* part0){
|
11
|
-
|
12
|
-
|
13
|
-
double dzeta = ZetaShiftData_get_dzeta(el);
|
14
|
-
#ifdef XSUITE_BACKTRACK
|
15
|
-
dzeta = -dzeta;
|
16
|
-
#endif
|
17
|
-
|
18
|
-
//start_per_particle_block (part0->part)
|
19
|
-
|
20
|
-
double const beta0 = LocalParticle_get_beta0(part);
|
21
|
-
double const beta = LocalParticle_get_rvv(part)*beta0;
|
22
|
-
double const x = LocalParticle_get_x(part);
|
23
|
-
double const y = LocalParticle_get_y(part);
|
24
|
-
double const px = LocalParticle_get_px(part);
|
25
|
-
double const py = LocalParticle_get_py(part);
|
26
|
-
double const zeta = LocalParticle_get_zeta(part);
|
27
|
-
double const pt = LocalParticle_get_pzeta(part)*beta0;
|
28
|
-
|
29
|
-
double pz = sqrt(1.0 + 2.0*pt/beta + pt*pt - px*px - py*py);
|
30
|
-
double x_hat = x + dzeta*px/pz;
|
31
|
-
double y_hat = y + dzeta*py/pz;
|
32
|
-
double zeta_hat = zeta - dzeta*(1.0/beta+pt)/pz;
|
33
|
-
|
34
|
-
LocalParticle_set_x(part, x_hat);
|
35
|
-
LocalParticle_set_y(part, y_hat);
|
36
|
-
LocalParticle_set_zeta(part,zeta_hat);
|
37
|
-
|
38
|
-
//end_per_particle_block
|
39
|
-
|
40
|
-
}
|
41
|
-
|
42
|
-
#endif
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|