Jinyu Wan , Helena Alamprese , Christian Ratcliff , Ji Qiang , Yue Hao
{"title":"JuTrack: A Julia package for auto-differentiable accelerator modeling and particle tracking","authors":"Jinyu Wan , Helena Alamprese , Christian Ratcliff , Ji Qiang , Yue Hao","doi":"10.1016/j.cpc.2024.109497","DOIUrl":null,"url":null,"abstract":"<div><div>Efficient accelerator modeling and particle tracking are key for the design and configuration of modern particle accelerators. In this work, we present JuTrack, a nested accelerator modeling package developed in the Julia programming language and enhanced with compiler-level automatic differentiation (AD). With the aid of AD, JuTrack enables rapid derivative calculations in accelerator modeling, facilitating sensitivity analyses and optimization tasks. We demonstrate the effectiveness of AD-derived derivatives through several practical applications, including sensitivity analysis of space-charge-induced emittance growth, nonlinear beam dynamics analysis for a synchrotron light source, and lattice parameter tuning of the future Electron-Ion Collider (EIC). Through the incorporation of automatic differentiation, this package opens up new possibilities for accelerator physicists in beam physics studies and accelerator design optimization.</div></div><div><h3>Program summary</h3><div><em>Program Title:</em> JuTrack</div><div><em>CPC Library link to program files:</em> <span><span>https://doi.org/10.17632/r2g5zkwp7s.1</span><svg><path></path></svg></span></div><div><em>Developer's repository link:</em> <span><span>https://github.com/MSU-Beam-Dynamics/JuTrack.jl.git</span><svg><path></path></svg></span></div><div><em>Licensing provisions:</em> MIT</div><div><em>Programming language:</em> Julia</div><div><em>Nature of problem:</em> Derivatives of the physics parameters calculated in accelerator modeling are critical for sensitivity analysis and optimization of the whole system. Traditional numerical approaches often rely on finite differences for derivative computations, which can prone to numerical inaccuracies. In highly nonlinear accelerator systems, like those encountered in synchrotrons and colliders, accurate sensitivity analysis and optimization require a large number of derivative evaluations. Thus, there is a need for more efficient methods to compute these derivatives accurately, especially when optimizing complex accelerator lattices or studying complicated collective effects, such as space-charge effects, wakefield effects, and beam-beam interaction.</div><div><em>Solution method:</em> JuTrack addresses this problem by integrating compiler-level automatic differentiation (AD) into accelerator modeling routines, offering a powerful toolset for rapid derivative computation. Developed in the Julia programming language, JuTrack uses the Enzyme AD package to perform gradient-based analyses with minimal computational overhead. The package provides an efficient way to compute derivatives by directly differentiating through the model code, thus avoiding approximation errors associated with finite difference methods. It is designed to handle complex beam dynamics simulations, including complicated collective effects, such as space-charge effects, wakefield effects, beam-beam interaction, and combination of Truncated Power Series Algebra (TPSA) with AD. It can be applied to lattice optimization and beam dynamics analysis for future accelerators like the Electron-Ion Collider (EIC). Users can easily apply the package to their models, enabling robust optimization and sensitivity analysis in their accelerator studies.</div><div><em>Additional comments including restrictions and unusual features:</em> JuTrack is particularly well-suited for scenarios requiring frequent derivative calculations, such as during beam dynamics optimization, sensitivity analysis, and accelerator tuning. Its integration with the Julia programming language provides excellent performance due to Julia's just-in-time (JIT) compilation capabilities. The modular nature of JuTrack and Julia's easy-to-understand syntax allows for future extensions and custom modifications, making it adaptable to a variety of accelerator configurations.</div></div>","PeriodicalId":285,"journal":{"name":"Computer Physics Communications","volume":"309 ","pages":"Article 109497"},"PeriodicalIF":3.4000,"publicationDate":"2025-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computer Physics Communications","FirstCategoryId":"101","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S001046552400420X","RegionNum":2,"RegionCategory":"物理与天体物理","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2025/1/7 0:00:00","PubModel":"Epub","JCR":"Q1","JCRName":"COMPUTER SCIENCE, INTERDISCIPLINARY APPLICATIONS","Score":null,"Total":0}
引用次数: 0
Abstract
Efficient accelerator modeling and particle tracking are key for the design and configuration of modern particle accelerators. In this work, we present JuTrack, a nested accelerator modeling package developed in the Julia programming language and enhanced with compiler-level automatic differentiation (AD). With the aid of AD, JuTrack enables rapid derivative calculations in accelerator modeling, facilitating sensitivity analyses and optimization tasks. We demonstrate the effectiveness of AD-derived derivatives through several practical applications, including sensitivity analysis of space-charge-induced emittance growth, nonlinear beam dynamics analysis for a synchrotron light source, and lattice parameter tuning of the future Electron-Ion Collider (EIC). Through the incorporation of automatic differentiation, this package opens up new possibilities for accelerator physicists in beam physics studies and accelerator design optimization.
Program summary
Program Title: JuTrack
CPC Library link to program files:https://doi.org/10.17632/r2g5zkwp7s.1
Nature of problem: Derivatives of the physics parameters calculated in accelerator modeling are critical for sensitivity analysis and optimization of the whole system. Traditional numerical approaches often rely on finite differences for derivative computations, which can prone to numerical inaccuracies. In highly nonlinear accelerator systems, like those encountered in synchrotrons and colliders, accurate sensitivity analysis and optimization require a large number of derivative evaluations. Thus, there is a need for more efficient methods to compute these derivatives accurately, especially when optimizing complex accelerator lattices or studying complicated collective effects, such as space-charge effects, wakefield effects, and beam-beam interaction.
Solution method: JuTrack addresses this problem by integrating compiler-level automatic differentiation (AD) into accelerator modeling routines, offering a powerful toolset for rapid derivative computation. Developed in the Julia programming language, JuTrack uses the Enzyme AD package to perform gradient-based analyses with minimal computational overhead. The package provides an efficient way to compute derivatives by directly differentiating through the model code, thus avoiding approximation errors associated with finite difference methods. It is designed to handle complex beam dynamics simulations, including complicated collective effects, such as space-charge effects, wakefield effects, beam-beam interaction, and combination of Truncated Power Series Algebra (TPSA) with AD. It can be applied to lattice optimization and beam dynamics analysis for future accelerators like the Electron-Ion Collider (EIC). Users can easily apply the package to their models, enabling robust optimization and sensitivity analysis in their accelerator studies.
Additional comments including restrictions and unusual features: JuTrack is particularly well-suited for scenarios requiring frequent derivative calculations, such as during beam dynamics optimization, sensitivity analysis, and accelerator tuning. Its integration with the Julia programming language provides excellent performance due to Julia's just-in-time (JIT) compilation capabilities. The modular nature of JuTrack and Julia's easy-to-understand syntax allows for future extensions and custom modifications, making it adaptable to a variety of accelerator configurations.
期刊介绍:
The focus of CPC is on contemporary computational methods and techniques and their implementation, the effectiveness of which will normally be evidenced by the author(s) within the context of a substantive problem in physics. Within this setting CPC publishes two types of paper.
Computer Programs in Physics (CPiP)
These papers describe significant computer programs to be archived in the CPC Program Library which is held in the Mendeley Data repository. The submitted software must be covered by an approved open source licence. Papers and associated computer programs that address a problem of contemporary interest in physics that cannot be solved by current software are particularly encouraged.
Computational Physics Papers (CP)
These are research papers in, but are not limited to, the following themes across computational physics and related disciplines.
mathematical and numerical methods and algorithms;
computational models including those associated with the design, control and analysis of experiments; and
algebraic computation.
Each will normally include software implementation and performance details. The software implementation should, ideally, be available via GitHub, Zenodo or an institutional repository.In addition, research papers on the impact of advanced computer architecture and special purpose computers on computing in the physical sciences and software topics related to, and of importance in, the physical sciences may be considered.