Skip to content

Add hkick and vkick components to Quadrupole and Sextupole - #652

Open
cr-xu wants to merge 8 commits into
masterfrom
647-add-hv-kick-component-to-quadrupoles
Open

Add hkick and vkick components to Quadrupole and Sextupole#652
cr-xu wants to merge 8 commits into
masterfrom
647-add-hv-kick-component-to-quadrupoles

Conversation

@cr-xu

@cr-xu cr-xu commented Jul 6, 2026

Copy link
Copy Markdown
Member

Description

Add hkick and vkick components to Quadrupole and Sextupole to reflect real-world steering components. The usage is similar to the elegant and bmad syntax, where magnets can have additional hkick and vkick attributes.
They are modeled as half-kicks at entrance and exit.
They are not affected by the magnet tilt, e.g. for a skew quadrupole, and are expected to have pure horizontal and vertical steering.

Motivation and Context

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Checklist

  • I have updated the changelog accordingly (required).
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have reformatted the code and checked that formatting passes (required).
  • I have have fixed all issues found by flake8 (required).
  • I have ensured that all pytest tests pass (required).
  • I have run pytest on a machine with a CUDA GPU and made sure all tests pass (required).
  • I have checked that the documentation builds (required).

Note: We are using a maximum length of 88 characters per line.

@cr-xu cr-xu linked an issue Jul 6, 2026 that may be closed by this pull request
@cr-xu
cr-xu marked this pull request as ready for review July 6, 2026 20:28
@cr-xu

cr-xu commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

I did a quick comparison of speed as discussed
Tracking with 100k particles in CPU
For a single quad the speed difference is pretty undetectable (drown in noise).
For tracking through 1k quads stacked, the difference in time is <1% for cold (without cache), and ~0.3% in warm case (with cached TMs).

       tracking  n_quads scenario  baseline_ms  hvkick_ms  overhead_ms  slowdown
0        linear        1     cold       0.8477     0.7633      -0.0844    0.9005
1        linear        1     warm       0.5954     0.5487      -0.0466    0.9217
2        linear     1000     cold     146.2504   159.8745      13.6241    1.0932
3        linear     1000     warm       7.4148     7.4513       0.0365    1.0049
4  second_order        1     cold       2.6065     2.6199       0.0133    1.0051
5  second_order        1     warm       1.3333     1.3125      -0.0207    0.9845
6  second_order     1000     cold    2479.3091  2495.2812      15.9720    1.0064
7  second_order     1000     warm    1118.2673  1121.6699       3.4026    1.0030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add H/V Kick component to quadrupoles

1 participant