Skip to content

Commit 170ecdc

Browse files
authored
Merge pull request #278 from jgray-19/Multipole_Fixes
Element Map Fixes: Multipole
2 parents 505114a + dd3bcdc commit 170ecdc

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/madl_dynmap.mad

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ function M.strex_kickh (elm, m, lw) -- [KICKT] --
504504

505505
m.atdebug(elm, m, lw, 'strex_kickh:0')
506506

507-
local el, eh, tdir, nmul, knl, ksl, beam in m
507+
local el, tdir, nmul, knl, ksl, beam in m
508508
local wchg = lw*tdir*beam.charge
509509
local _beta = 1/beam.beta
510510

@@ -519,10 +519,10 @@ function M.strex_kickh (elm, m, lw) -- [KICKT] --
519519
m[i].py = py + wchg*(bx - ksl[1]*pz)
520520
m[i].t = t - wchg*(knl[1]*x - ksl[1]*y)*(_beta+pt)/pz
521521

522-
-- curvature
523-
if eh ~= 0 then
524-
m[i].px = m[i].px - (knl[1]^2/eh)*x -- eh was el
525-
m[i].py = m[i].py - (ksl[1]^2/eh)*y -- eh was el
522+
-- field curvature
523+
if el ~= 0 then
524+
m[i].px = m[i].px - wchg*(knl[1]^2/el)*x
525+
m[i].py = m[i].py - wchg*(ksl[1]^2/el)*y
526526
end
527527
end
528528

src/madl_etrck.mad

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ local function track_multipole (elm, m)
246246

247247
if m.nmul == 0 then return track_marker(elm, m) end
248248

249-
local angle, ksi, lrad in elm
249+
local angle, ksi, lrad, knl, ksl in elm
250250
local edir in m
251251

252-
m.el, m.eh = 0, lrad ~= 0 and angle/lrad*edir or 0
252+
m.el = lrad
253253

254254
local kick = strex_kick
255-
if abs(angle) >= minang then
255+
if abs(knl[1]) + abs(ksl[1]) >= minang then
256256
kick = strex_kickh
257257
elseif abs(ksi) >= minstr then
258258
m.ksi = ksi

0 commit comments

Comments
 (0)