Skip to content

Commit

Permalink
Correct calc_super_slave_key logic for an sbend superimposed on a dri…
Browse files Browse the repository at this point in the history
…ft. (#972)
  • Loading branch information
DavidSagan committed May 26, 2024
1 parent cdb1627 commit 9dd649b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions bmad/low_level/calc_super_slave_key.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ subroutine calc_super_slave_key (lord1, lord2, slave, create_jumbo_slave)
slave%key = -1 ! Default if no superimpose possible
slave%sub_key = 0

! * If one element is a drift then slave%key = key of other element.
! * Control elements, etc. cannot be superimposed.

! If one element is a drift then slave%key = key of other element.
! Control elements, naturally zero length elements, etc. cannot be superimposed upon

select case (key1)
case (overlay$, group$, girder$, taylor$, match$, patch$, fiducial$, floor_shift$, multipole$, ab_multipole$, sbend$, rf_bend$); return
case (overlay$, group$, ramper$, girder$, taylor$, match$, patch$, fiducial$, floor_shift$, multipole$, ab_multipole$); return
end select

select case (key2)
case (overlay$, group$, girder$, taylor$, match$, patch$, fiducial$, floor_shift$, multipole$, ab_multipole$, sbend$, rf_bend$); return
case (overlay$, group$, ramper$, girder$, taylor$, match$, patch$, fiducial$, floor_shift$, multipole$, ab_multipole$); return
end select

select case (key1)
Expand All @@ -66,6 +65,8 @@ subroutine calc_super_slave_key (lord1, lord2, slave, create_jumbo_slave)
return
end select

if (key1 == sbend$ .or. key1 == rf_bend$ .or. key2 == sbend$ .or. key2 == rf_bend$) return

! If there are misalignments then no superposition is possible

if (lord1%value(x_offset$) /= 0 .or. lord1%value(y_offset$) /= 0 .or. lord1%value(z_offset$) /= 0 .or. &
Expand All @@ -89,8 +90,6 @@ subroutine calc_super_slave_key (lord1, lord2, slave, create_jumbo_slave)

if (key1 == key2) then
select case (key1)
case (sbend$)
! Bad
case (rfcavity$, wiggler$, undulator$)
slave%key = em_field$
slave%value(constant_ref_energy$) = true$
Expand Down
2 changes: 1 addition & 1 deletion tao/version/tao_version_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
!-

module tao_version_mod
character(*), parameter :: tao_version_date = "2024/05/10 15:23:35"
character(*), parameter :: tao_version_date = "2024/05/25 17:37:46"
end module

0 comments on commit 9dd649b

Please sign in to comment.