Open
Conversation
Sudo Vibe me a MAD-X parser.
Elements can specify at=X, FROM=other_element: position relative to another element, not absolute.
MAD-X fills gaps with drifts
Unsupported. Open a ticket if needed.
MAD-X allows multiple BEAM commands (different beams for different sequences).
MAD-X is super chill about div by zero.
ax3l
commented
Mar 26, 2026
One test per major feature added.
Format similar to parser warnings
Track more carefully
Very common and universally accepted to be 0
- search more eager for include files: current file dir, root dir of top-level file, pwd - `mqxa.1r1, k1 := kqx.r1+ktqx1.r1, polarity=+1`
Not implemented, but used in LHC lattice for a loop afterwards.
Before we hard-coded monitors in MAD-X to read "monitor". Now we honor their true name in the MAD-X file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR overhauls two files:
MADXParser.py: a tokenizer and parser that tries to truthfully reimplement the MAD-X C parser, ultimately returning a flattened MAD-X lattice. This file is best written with a powerful LLM (mostly Claude 4.6 was used). It is covered by unit tests for central MAD-X input language features and should not require much updates in the future.madx_to_impactx.py: the actual translator from MAD-X element to ImpactX element(s). This file we need to be able to maintain "by hand" as we add new elements and handle physics translation corner-cases.To Do
ring_seq_bb_spch_thin (2).madx(GDrive)pip-ii-booster-combined.madxacc-models-lhc/scenarios/cycle/pp/ramp/1178/model.madx(gitlab)from_file(...)Call, FILENAMESupport #512: MAD-X: Call, FILENAME Support