Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7d3531f
[pre-commit.ci] pre-commit autoupdate (#1161)
pre-commit-ci[bot] Sep 29, 2025
a7db4cd
[pre-commit.ci] pre-commit autoupdate (#1165)
pre-commit-ci[bot] Oct 7, 2025
35d4762
Gauss 3D: Fix Push Constants (#1168)
ax3l Oct 7, 2025
1f27719
[pre-commit.ci] pre-commit autoupdate (#1174)
pre-commit-ci[bot] Oct 13, 2025
afdb549
Bump stefanzweifel/git-auto-commit-action from 6 to 7 (#1175)
dependabot[bot] Oct 13, 2025
b821b72
Bump github/codeql-action from 3 to 4 (#1176)
dependabot[bot] Oct 13, 2025
2cc65fc
Fix `BeamMonitor`: Delay Open (#1178)
ax3l Oct 14, 2025
526cbb0
CMake `pip_install`: Package Examples (#1179)
ax3l Oct 14, 2025
0fdf961
Envelope: Silence Warning w/o Space-Charge (#1173)
ax3l Oct 14, 2025
7283642
Release 25.10 (#1180)
ax3l Oct 14, 2025
65e8f58
Update Stub Files
ax3l Oct 14, 2025
b322151
AMReX/ABLASTR/WarpX: development (#1177)
ax3l Oct 14, 2025
a0bb10d
Python: Improve `KnownElementsList` (#1181)
ax3l Oct 15, 2025
8c3f91f
Update Stub Files
ax3l Oct 15, 2025
ad19aa2
Element Selection Syntax (#1182)
ax3l Oct 15, 2025
5b0d8a3
Update Stub Files
ax3l Oct 15, 2025
167fb29
Fix Python import errors (#1186)
EZoni Oct 16, 2025
80b4cfd
Update Stub Files
ax3l Oct 16, 2025
af2ff22
Fix RFCavity edge case (#1185)
cemitch99 Oct 16, 2025
af0df2e
Fix el typing (#1190)
ax3l Oct 17, 2025
f2b642a
Update PALS to 0.2.0 (#1184)
EZoni Oct 17, 2025
222fd80
fix some math issues in examle documentation (#1191)
PrometheusPi Oct 17, 2025
8add9f6
"Starting step" Print: Spaces (#1187)
ax3l Oct 17, 2025
5f73fb7
Element Names: All, `None` (#1189)
ax3l Oct 17, 2025
e827c42
Update Stub Files
cemitch99 Oct 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ jobs:
cmake -S . -B build -DImpactX_FFT=ON -DImpactX_PYTHON=OFF

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
config-file: ./.github/codeql/impactx-codeql.yml
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Build (py)
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4
if: ${{ matrix.language == 'python' }}
env:
IMPACTX_FFT: ON
Expand All @@ -74,7 +74,7 @@ jobs:
cmake --build build -j 4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"
upload: False
Expand All @@ -96,6 +96,6 @@ jobs:
output: sarif-results/${{ matrix.language }}.sarif

- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif
2 changes: 1 addition & 1 deletion .github/workflows/stubs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
run: |
mpiexec -np 1 python3 -m pytest tests/python/ --ignore=tests/python/dashboard

- uses: stefanzweifel/git-auto-commit-action@v6
- uses: stefanzweifel/git-auto-commit-action@v7
name: Commit Updated Stub Files
if: github.event_name == 'push' && github.repository == 'BLAST-ImpactX/impactx' && github.ref == 'refs/heads/development'
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ repos:
# Python: Ruff linter & formatter
# https://docs.astral.sh/ruff/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.1
rev: v0.14.0
hooks:
# Run the linter
- id: ruff-check
Expand Down
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Preamble ####################################################################
#
cmake_minimum_required(VERSION 3.24.0)
project(ImpactX VERSION 25.09)
project(ImpactX VERSION 25.10)

include(${ImpactX_SOURCE_DIR}/cmake/ImpactXFunctions.cmake)

Expand Down Expand Up @@ -492,6 +492,13 @@ if(ImpactX_PYTHON)
pyImpactX
${ImpactX_CUSTOM_TARGET_PREFIX}pip_wheel
)

# copy examples into pip package, e.g., for dashboard GUI
add_custom_command(TARGET pyImpactX POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${ImpactX_SOURCE_DIR}/examples
$<TARGET_FILE_DIR:pyImpactX>/examples
)
endif()


Expand Down
4 changes: 2 additions & 2 deletions cmake/dependencies/ABLASTR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ macro(find_ablastr)
set(COMPONENT_DIM 3D)
set(COMPONENT_PRECISION ${ImpactX_PRECISION} P${ImpactX_PRECISION})

find_package(ABLASTR 25.09 CONFIG REQUIRED COMPONENTS ${COMPONENT_DIM})
find_package(ABLASTR 25.10 CONFIG REQUIRED COMPONENTS ${COMPONENT_DIM})
message(STATUS "ABLASTR: Found version '${ABLASTR_VERSION}'")
endif()

Expand Down Expand Up @@ -178,7 +178,7 @@ set(ImpactX_openpmd_src ""
set(ImpactX_ablastr_repo "https://github.com/BLAST-WarpX/warpx.git"
CACHE STRING
"Repository URI to pull and build ABLASTR from if(ImpactX_ablastr_internal)")
set(ImpactX_ablastr_branch "a76eecf1553f5d0e72ec948c9a67db4111a1544f"
set(ImpactX_ablastr_branch "5dc12e9de9fc1428d4ad4d6c132043abedc8c531"
CACHE STRING
"Repository branch for ImpactX_ablastr_repo if(ImpactX_ablastr_internal)")

Expand Down
4 changes: 2 additions & 2 deletions cmake/dependencies/pyAMReX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function(find_pyamrex)
endif()
elseif(NOT ImpactX_pyamrex_internal)
# TODO: MPI control
find_package(pyAMReX 25.09 CONFIG REQUIRED)
find_package(pyAMReX 25.10 CONFIG REQUIRED)
message(STATUS "pyAMReX: Found version '${pyAMReX_VERSION}'")
endif()
endfunction()
Expand All @@ -74,7 +74,7 @@ option(ImpactX_pyamrex_internal "Download & build pyAMReX" ON)
set(ImpactX_pyamrex_repo "https://github.com/AMReX-Codes/pyamrex.git"
CACHE STRING
"Repository URI to pull and build pyamrex from if(ImpactX_pyamrex_internal)")
set(ImpactX_pyamrex_branch "25.09"
set(ImpactX_pyamrex_branch "de24942c76ebc61ffaa184204c2491aebc357a07"
CACHE STRING
"Repository branch for ImpactX_pyamrex_repo if(ImpactX_pyamrex_internal)")

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def download_with_headers(url, filename):
# built documents.
#
# The short X.Y version.
version = "25.09"
version = "25.10"
# The full version, including alpha/beta/rc tags.
release = "25.09"
release = "25.10"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
54 changes: 54 additions & 0 deletions docs/source/usage/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,60 @@ This module provides elements and methods for the accelerator lattice.
:param pals_line: PALS Python Line with beamline elements
:param nslice: number of slices used for the application of collective effects

.. py:method:: select(kind=None, name=None)

Filter elements by type and/or name.
If both are provided, OR-based logic is applied.

Returns references to original elements, allowing modification and chaining.
Chained ``.select(...).select(...)`` selections are AND-filtered.

:param kind: Element type(s) to filter by. Can be a string (e.g., ``"Drift"``), regex pattern (e.g., ``r".*Quad"``), element type (e.g., ``elements.Drift``), or list/tuple of these.
:param name: Element name(s) to filter by. Can be a string, regex pattern, or ``list``/``tuple`` of these.

**Examples:**

.. code-block:: python

# Filter by element type
drift_elements = lattice.select(kind="Drift")
quad_elements = lattice.select(kind=elements.Quad)

# Filter by regex pattern
all_quads = lattice.select(kind=r".*Quad") # matches Quad, ChrQuad, ExactQuad

# Filter by name
specific_elements = lattice.select(name="quad1")

# Chain filters (AND logic)
drift_named_d1 = lattice.select(kind="Drift").select(name="drift1")

# Modify original elements through references
drift_elements[0].ds = 2.0 # modifies original lattice

.. py:method:: get_kinds()

Get all unique element types in the lattice.

:return: List of unique element types (sorted by name)
:rtype: list[type]

.. py:method:: count_by_kind(kind_pattern)

Count elements of a specific kind.

:param kind_pattern: Element kind to count. Can be string (e.g., "Drift"), regex pattern (e.g., r".*Quad"), or element type (e.g., elements.Drift)
:return: Number of elements of the specified kind
:rtype: int

.. py:method:: has_kind(kind_pattern)

Check if list contains elements of a specific kind.

:param kind_pattern: Element kind to check for. Can be string (e.g., "Drift"), regex pattern (e.g., r".*Quad"), or element type (e.g., elements.Drift)
:return: True if at least one element of the specified kind exists
:rtype: bool

.. py:method:: plot_survey(ref=None, ax=None, legend=True, legend_ncols=5)

Plot over s of all elements in the KnownElementsList.
Expand Down
8 changes: 4 additions & 4 deletions examples/dogleg/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The final expected dispersion is 267 mm.
In this test, the initial and final values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must
agree with nominal values.

In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`\dispersion_x`, and :math:`\dispersion_px` must
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`D_x`, and :math:`D_{px}` must
agree with nominal values.


Expand Down Expand Up @@ -73,7 +73,7 @@ The initial dispersion is taken to be -267 mm.
In this test, the initial and final values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must
agree with nominal values.

In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`\dispersion_x`, and :math:`\dispersion_px` must
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`D_x`, and :math:`D_{px}` must
agree with nominal values.

Run
Expand Down Expand Up @@ -128,10 +128,10 @@ The 2.5% energy offset couples through the lattice R16 (dispersion) to result in
In this test, the initial and final values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must
agree with nominal values.

In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`\dispersion_x`, and :math:`\dispersion_px` must
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`D_x`, and :math:`D_{px}` must
agree with nominal values.

Finally, the values of :math:`\mean_pt`, :math:`\mean_x`, and :math:`\mean_px` must agree with predicted values.
Finally, the values of :math:`\mean_pt`, :math:`\mean_x`, and :math:`\mean_{px}` must agree with predicted values.

Run
---
Expand Down
2 changes: 1 addition & 1 deletion examples/initialize_from_array/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In this example, a custom beam is specified at fixed t, transformed to fixed s,
then loaded in ImpactX.
The custom beam is a ring in x-y,
with radius r=2 mm,
radial width :math:`\sigma_r = 5\ \mu`m;
radial width :math:`\sigma_r = 5\ \mathrm{\mu m}`;
Gaussian in :math:`p_x` and :math:`p_y` with momentum width :math:`\sigma_p=10`;
and chirped in z-pz with bunch length :math:`\sigma_z=1` mm,
mean energy about 10 GeV, 1% uncorrelated energy spread, and z-pz covariance of -0.18.
Expand Down
43 changes: 22 additions & 21 deletions examples/pals/fodo.pals.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
kind: BeamLine
line:
- drift1:
kind: Drift
length: 0.25
- quad1:
MagneticMultipoleP:
Bn1: 1.0
kind: Quadrupole
length: 1.0
- drift2:
kind: Drift
length: 0.5
- quad2:
MagneticMultipoleP:
Bn1: -1.0
kind: Quadrupole
length: 1.0
- drift3:
kind: Drift
length: 0.25
fodo_cell:
kind: BeamLine
line:
- drift1:
kind: Drift
length: 0.25
- quad1:
MagneticMultipoleP:
Bn1: 1.0
kind: Quadrupole
length: 1.0
- drift2:
kind: Drift
length: 0.5
- quad2:
MagneticMultipoleP:
Bn1: -1.0
kind: Quadrupole
length: 1.0
- drift3:
kind: Drift
length: 0.25
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy>=1.15
pals-schema~=0.1.1
pals-schema~=0.2.0
quantiphy~=2.19
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def build_extension(self, ext):
setup(
name="impactx",
# note PEP-440 syntax: x.y.zaN but x.y.z.devN
version="25.09",
version="25.10",
packages=["impactx"],
# Python sources:
package_dir={"": "src/python"},
Expand Down
16 changes: 5 additions & 11 deletions src/elements/Empty.H
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
#include "particles/ImpactXParticleContainer.H"
#include "mixin/thin.H"
#include "mixin/lineartransport.H"
#include "mixin/named.H"
#include "mixin/nofinalize.H"

#include <AMReX_Extension.H>
#include <AMReX_REAL.H>
#include <AMReX_SIMD.H>

#include <stdexcept>
#include <string>
#include <optional>


namespace impactx::elements
{
struct Empty
: public mixin::Thin,
: public mixin::Named,
public mixin::Thin,
public mixin::LinearTransport<Empty>,
public mixin::NoFinalize,
public amrex::simd::Vectorized<amrex::simd::native_simd_size_particlereal>
Expand All @@ -37,6 +38,7 @@ namespace impactx::elements
/** This element does nothing.
*/
Empty ()
: Named(std::nullopt)
{
}

Expand Down Expand Up @@ -118,14 +120,6 @@ namespace impactx::elements

/** This pushes the covariance matrix. */
using LinearTransport::operator();

/** Provide impactx::elements::mixin::Named::name */
AMREX_FORCE_INLINE
std::string name () const { throw std::runtime_error("Name not set on element!"); }

/** Provide impactx::elements::mixin::Named::has_name */
AMREX_FORCE_INLINE
bool has_name () const { return false; }
};

} // namespace impactx
Expand Down
2 changes: 1 addition & 1 deletion src/elements/RFCavity.H
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ namespace RFCavityData
}
else // endpoint of the RF, outsize zlen
{
efieldint = std::copysign(z, z)*zmid*0.5_prt*cos_data[0];;
efieldint = std::copysign(zmid, z)*0.5_prt*cos_data[0];
for (int j=1; j < m_ncoef; ++j)
{
efieldint = efieldint - zlen*sin_data[j] * std::cos(j*pi)/(j*2*pi);
Expand Down
4 changes: 4 additions & 0 deletions src/elements/diagnostics/BeamMonitor.H
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,12 @@ namespace detail
finalize ();

private:
/** Open the openPMD series (on first access) */
void open ();

std::string m_series_name; //! openPMD filename
std::string m_OpenPMDFileType; //! openPMD backend: usually HDF5 (h5) or ADIOS2 (bp/bp4/bp5) or ADIOS2 SST (sst)
std::string m_encoding; //! openPMD iteration encoding: "v"ariable based, "f"ile based, "g"roup based (default)
std::any m_series; //! openPMD::Series that holds potentially multiple outputs
int m_step = 0; //! global step for output

Expand Down
13 changes: 9 additions & 4 deletions src/elements/diagnostics/BeamMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ namespace detail {
}

BeamMonitor::BeamMonitor (std::string series_name, std::string backend, std::string encoding, int period_sample_intervals) :
m_series_name(std::move(series_name)), m_OpenPMDFileType(std::move(backend)), m_period_sample_intervals(period_sample_intervals)
m_series_name(std::move(series_name)), m_OpenPMDFileType(std::move(backend)), m_encoding(std::move(encoding)), m_period_sample_intervals(period_sample_intervals) {
}

void BeamMonitor::open ()
{
#ifdef ImpactX_USE_OPENPMD
// pick first available backend if default is chosen
Expand All @@ -141,11 +144,11 @@ namespace detail {

// encoding of iterations in the series
openPMD::IterationEncoding series_encoding = openPMD::IterationEncoding::groupBased;
if ("v" == encoding)
if ("v" == m_encoding)
series_encoding = openPMD::IterationEncoding::variableBased;
else if ("g" == encoding)
else if ("g" == m_encoding)
series_encoding = openPMD::IterationEncoding::groupBased;
else if ("f" == encoding)
else if ("f" == m_encoding)
series_encoding = openPMD::IterationEncoding::fileBased;

// BP5 does not support groupBased (metadata explosion)
Expand Down Expand Up @@ -310,6 +313,8 @@ namespace detail {
if (period % m_period_sample_intervals != 0)
return;

this->open();

#ifdef ImpactX_USE_OPENPMD
std::string profile_name = "impactx::push::" + std::string(BeamMonitor::type);
BL_PROFILE(profile_name);
Expand Down
4 changes: 3 additions & 1 deletion src/initialization/Warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ bool ImpactX::early_param_check ()
int verbose = 1;
pp_impactx.queryAddWithParser("verbose", verbose);

if (verbose > 0) {
// Print a warning for unused inputs early on, so users are informed and
// might decide to abort their long-running runs, if needed.
if (verbose > 0 && amrex::ParmParse::hasUnusedInputs()) {
amrex::Print() << "\n";
}
amrex::ParmParse::QueryUnusedInputs();
Expand Down
Loading
Loading