diff --git a/docs/source/usage/parameters.rst b/docs/source/usage/parameters.rst index a5b2efc87..4d4c5be6b 100644 --- a/docs/source/usage/parameters.rst +++ b/docs/source/usage/parameters.rst @@ -135,8 +135,8 @@ Lattice Elements * ``.dx`` (``float``, in meters) horizontal translation error * ``.dy`` (``float``, in meters) vertical translation error * ``.rotation`` (``float``, in degrees) rotation error in the transverse plane - * ``.x_aperture`` (``float``, in meters) horizontal half-aperture (elliptical) - * ``.y_aperture`` (``float``, in meters) vertical half-aperture (elliptical) + * ``.aperture_x`` (``float``, in meters) horizontal half-aperture (elliptical) + * ``.aperture_y`` (``float``, in meters) vertical half-aperture (elliptical) * ``.nslice`` (``integer``) number of slices used for the application of space charge (default: ``1``) * ``drift_chromatic`` for a free drift, with chromatic effects included. diff --git a/docs/source/usage/python.rst b/docs/source/usage/python.rst index a8ae412d5..8bdcd1dbe 100644 --- a/docs/source/usage/python.rst +++ b/docs/source/usage/python.rst @@ -570,7 +570,7 @@ This module provides elements for the accelerator lattice. :param rotation: rotation error in the transverse plane [degrees] :param name: an optional name for the element -.. py:class:: impactx.elements.Drift(ds, dx=0, dy=0, rotation=0, x_aperture=0, y_aperture=0, nslice=1, name=None) +.. py:class:: impactx.elements.Drift(ds, dx=0, dy=0, rotation=0, aperture_x=0, aperture_y=0, nslice=1, name=None) A drift. @@ -578,8 +578,8 @@ This module provides elements for the accelerator lattice. :param dx: horizontal translation error in m :param dy: vertical translation error in m :param rotation: rotation error in the transverse plane [degrees] - :param x_aperture: horizontal half-aperture (elliptical) in m - :param y_aperture: vertical half-aperture (elliptical) in m + :param aperture_x: horizontal half-aperture (elliptical) in m + :param aperture_y: vertical half-aperture (elliptical) in m :param nslice: number of slices used for the application of space charge :param name: an optional name for the element diff --git a/examples/aperture/input_aperture_thick.in b/examples/aperture/input_aperture_thick.in index 339c0de16..0921240b0 100644 --- a/examples/aperture/input_aperture_thick.in +++ b/examples/aperture/input_aperture_thick.in @@ -29,8 +29,8 @@ monitor.backend = h5 drift.type = drift drift.ds = 0.123 -drift.x_aperture = 1.0e-3 -drift.y_aperture = 1.5e-3 +drift.aperture_x = 1.0e-3 +drift.aperture_y = 1.5e-3 ############################################################################### diff --git a/examples/aperture/run_aperture_thick.py b/examples/aperture/run_aperture_thick.py index 11895b180..6184c7946 100755 --- a/examples/aperture/run_aperture_thick.py +++ b/examples/aperture/run_aperture_thick.py @@ -49,7 +49,7 @@ sim.lattice.extend( [ monitor, - elements.Drift(name="drift", ds=0.123, x_aperture=1.0e-3, y_aperture=1.5e-3), + elements.Drift(name="drift", ds=0.123, aperture_x=1.0e-3, aperture_y=1.5e-3), monitor, ] ) diff --git a/src/initialization/InitElement.cpp b/src/initialization/InitElement.cpp index 3777e7013..aba8cdcb3 100644 --- a/src/initialization/InitElement.cpp +++ b/src/initialization/InitElement.cpp @@ -94,22 +94,22 @@ namespace detail return values; } - /** Read the Aperture parameters x_aperture and y_aperture from inputs + /** Read the Aperture parameters aperture_x and aperture_y from inputs * * @param pp_element the element being read - * @return key-value pairs for x_aperture and y_aperture + * @return key-value pairs for aperture_x and aperture_y */ std::map query_aperture (amrex::ParmParse& pp_element) { - amrex::ParticleReal x_aperture = 0; - amrex::ParticleReal y_aperture = 0; - pp_element.query("x_aperture", x_aperture); - pp_element.query("y_aperture", y_aperture); + amrex::ParticleReal aperture_x = 0; + amrex::ParticleReal aperture_y = 0; + pp_element.query("aperture_x", aperture_x); + pp_element.query("aperture_y", aperture_y); std::map values = { - {"x_aperture", x_aperture}, - {"y_aperture", y_aperture} + {"aperture_x", aperture_x}, + {"aperture_y", aperture_y} }; return values; @@ -152,7 +152,7 @@ namespace detail auto a = detail::query_alignment(pp_element); auto b = detail::query_aperture(pp_element); - m_lattice.emplace_back( Drift(ds, a["dx"], a["dy"], a["rotation_degree"], b["x_aperture"], b["y_aperture"], nslice, element_name) ); + m_lattice.emplace_back( Drift(ds, a["dx"], a["dy"], a["rotation_degree"], b["aperture_x"], b["y_aperture"], nslice, element_name) ); } else if (element_type == "sbend") { auto const [ds, nslice] = detail::query_ds(pp_element, nslice_default); diff --git a/src/particles/elements/Drift.H b/src/particles/elements/Drift.H index 43b0120ef..129f3412f 100644 --- a/src/particles/elements/Drift.H +++ b/src/particles/elements/Drift.H @@ -44,8 +44,8 @@ namespace impactx * @param dx horizontal translation error in m * @param dy vertical translation error in m * @param rotation_degree rotation error in the transverse plane [degrees] - * @param x_aperture horizontal half-aperture in m - * @param y_aperture vertical half-aperture in m + * @param aperture_x horizontal half-aperture in m + * @param aperture_y vertical half-aperture in m * @param nslice number of slices used for the application of space charge * @param name a user defined and not necessarily unique name of the element */ @@ -54,15 +54,15 @@ namespace impactx amrex::ParticleReal dx = 0, amrex::ParticleReal dy = 0, amrex::ParticleReal rotation_degree = 0, - amrex::ParticleReal x_aperture = 0, - amrex::ParticleReal y_aperture = 0, + amrex::ParticleReal aperture_x = 0, + amrex::ParticleReal aperture_y = 0, int nslice = 1, std::optional name = std::nullopt ) : Named(std::move(name)), Thick(ds, nslice), Alignment(dx, dy, rotation_degree), - Aperture(x_aperture, y_aperture) + Aperture(aperture_x, aperture_y) { } diff --git a/src/particles/elements/mixin/aperture.H b/src/particles/elements/mixin/aperture.H index 6674f4ea1..f77f6c2fe 100644 --- a/src/particles/elements/mixin/aperture.H +++ b/src/particles/elements/mixin/aperture.H @@ -26,14 +26,14 @@ namespace impactx::elements /** A finite-length element * - * @param x_aperture horizontal half-aperture size in m - * @param y_aperture vertical half-aperture size in m + * @param aperture_x horizontal half-aperture size in m + * @param aperture_y vertical half-aperture size in m */ Aperture ( - amrex::ParticleReal x_aperture, - amrex::ParticleReal y_aperture + amrex::ParticleReal aperture_x, + amrex::ParticleReal aperture_y ) - : m_x_aperture(x_aperture), m_y_aperture(y_aperture) + : m_aperture_x(aperture_x), m_aperture_y(aperture_y) { } @@ -59,12 +59,12 @@ namespace impactx::elements ) const { using namespace amrex::literals; // for _rt and _prt - // skip aperture application if x_aperture <= 0 or y_aperture <= 0 - if (m_x_aperture > 0 && m_y_aperture > 0) { + // skip aperture application if aperture_x <= 0 or aperture_y <= 0 + if (m_aperture_x > 0 && m_aperture_y > 0) { // scale horizontal and vertical coordinates - amrex::ParticleReal const u = x / m_x_aperture; - amrex::ParticleReal const v = y / m_y_aperture; + amrex::ParticleReal const u = x / m_aperture_x; + amrex::ParticleReal const v = y / m_aperture_y; // compare against the aperture boundary if (std::pow(u,2) + std::pow(v,2) > 1_prt) { @@ -79,9 +79,9 @@ namespace impactx::elements * @return horizontal aperture size in m */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::ParticleReal x_aperture () const + amrex::ParticleReal aperture_x () const { - return m_x_aperture; + return m_aperture_x; } /** Vertical aperture size @@ -89,13 +89,13 @@ namespace impactx::elements * @return vertical aperture size in m */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::ParticleReal y_aperture () const + amrex::ParticleReal aperture_y () const { - return m_y_aperture; + return m_aperture_y; } - amrex::ParticleReal m_x_aperture = 0; //! horizontal aperture size [m] - amrex::ParticleReal m_y_aperture = 0; //! vertical aperture size [m] + amrex::ParticleReal m_aperture_x = 0; //! horizontal aperture size [m] + amrex::ParticleReal m_aperture_y = 0; //! vertical aperture size [m] }; } // namespace impactx::elements diff --git a/src/python/elements.cpp b/src/python/elements.cpp index 670e13061..58d1e8358 100644 --- a/src/python/elements.cpp +++ b/src/python/elements.cpp @@ -219,12 +219,12 @@ void init_elements(py::module& m) .def(py::init<>(), "Mixin class for lattice elements with a transverse aperture." ) - .def_property_readonly("x_aperture", - &elements::Aperture::x_aperture, + .def_property_readonly("aperture_x", + &elements::Aperture::aperture_x, "horizontal aperture in m" ) - .def_property_readonly("y_aperture", - &elements::Aperture::y_aperture, + .def_property_readonly("aperture_y", + &elements::Aperture::aperture_y, "vertical aperture in m" ) ; @@ -693,8 +693,8 @@ void init_elements(py::module& m) py::arg("dx") = 0, py::arg("dy") = 0, py::arg("rotation") = 0, - py::arg("x_aperture") = 0, - py::arg("y_aperture") = 0, + py::arg("aperture_x") = 0, + py::arg("aperture_y") = 0, py::arg("nslice") = 1, py::arg("name") = py::none(), "A drift."