Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAD-X input reader: constants, elements, lines, segments #104

Open
ax3l opened this issue Mar 31, 2022 · 5 comments · May be fixed by #268
Open

MAD-X input reader: constants, elements, lines, segments #104

ax3l opened this issue Mar 31, 2022 · 5 comments · May be fixed by #268
Labels
changes input scripts / defaults Changes the syntax or meaning of input scripts and/or defaults help wanted Extra attention is needed

Comments

@ax3l
Copy link
Member

ax3l commented Mar 31, 2022

We want to support reading accelerator lattices directly from MAD-X input files.
For this, we will need to support at least the following syntax elements:

  • constants
  • elements
  • lines
  • segments
  • simple math

from MAD-X definitions.

For that, we could explore if @janfschmidt's palattice could be used as a library :)
https://github.com/janfschmidt/palattice

References on MAD-X:

Example files for MAD-X lattices:

@ax3l ax3l added this to the First Release Version milestone Mar 31, 2022
@ax3l ax3l changed the title Mad-X input reader MAD-X input reader Mar 31, 2022
@ax3l ax3l changed the title MAD-X input reader MAD-X input reader: constants, elements, lines, segments Apr 5, 2022
@ax3l
Copy link
Member Author

ax3l commented Apr 12, 2022

@qianglbl and @cemitch99 mentioned:
MAD-X also has an "optics" command that can output a simple CSV file with one element per row. IMPACT-Z can read this file in.

We might want to add support to:

  • write the same file format for the lattice from ImpactX
  • read in the same file format to initialize our lattice.

Optics CSV file structure

Columns with names (column 1), type (column 2) and values: meaning of the column depends on the element type (column 2).

Values: note that parameters are not in that CSV file, e.g., fringe-field details.

@ax3l ax3l added the changes input scripts / defaults Changes the syntax or meaning of input scripts and/or defaults label Jul 16, 2022
@ax3l
Copy link
Member Author

ax3l commented Jul 23, 2022

With the new Python layer, we could also implement the first MAD(-X) reader on the Python side.

Warp has some routines we can get logic from (@jlvay):

@n01r n01r self-assigned this Aug 4, 2022
@n01r
Copy link
Member

n01r commented Aug 16, 2022

This is the link to the Python MADX parser that Andreas Adelmann wrote and pushed to a repo
https://gitlab.psi.ch/adelmann/pymadxparser.git

Implemented via #214

@ax3l ax3l mentioned this issue Aug 29, 2022
5 tasks
@ax3l ax3l assigned np-eazy and unassigned n01r Aug 31, 2022
@np-eazy
Copy link
Member

np-eazy commented Sep 16, 2022

https://github.com/MethodicalAcceleratorDesign/MAD-X/blob/master/src/mad_parse.c is the current source code where parsing seems to happen. I'll have to look closer to see what it is parsing into, and how that connects with any notion of a persistent structure of environments.

My planned approach right now is to mod the source code such that it reads MadX scripts normally, but instead of executing on LHC or some other particle accelerator the information is kept in some notion of an environment; upon script end or intended pause, the environment is DFS-traversed and dumped onto a general YAML or JSON.

Right now I intend on only a static implementation of an accelerator's initial state; anything and everything in the MadX file refers to t=0 for the simulation.

@ax3l ax3l linked a pull request Oct 3, 2022 that will close this issue
@np-eazy
Copy link
Member

np-eazy commented Oct 12, 2022

Mad-X Parser Notes.pdf I am no longer working on this issue. Here are my design notes and plans moving forward with implementing this issue.

@ax3l ax3l unassigned np-eazy Dec 9, 2022
@ax3l ax3l added the help wanted Extra attention is needed label Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes input scripts / defaults Changes the syntax or meaning of input scripts and/or defaults help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants