Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
c99517f
Introduce NEW1_Species
chillenzer Dec 5, 2025
699724e
Set up infrastructure
chillenzer Dec 5, 2025
e014cfe
Add new_species.py end-to-end test
chillenzer Dec 5, 2025
2641eab
First species definition rendering
chillenzer Dec 5, 2025
22569fd
Make speciesInitialization.param work
chillenzer Dec 5, 2025
dc92534
Make particle.param pass
chillenzer Dec 5, 2025
fbe2074
Make density.param pass
chillenzer Dec 5, 2025
90d6b28
Switch test to iteration over filenames
chillenzer Dec 5, 2025
8c1f864
Add forgotten operation schema
chillenzer Dec 5, 2025
9365476
Update typical_ppc calculation
chillenzer Dec 5, 2025
2c409fd
Broaden Simulation constructor
chillenzer Dec 5, 2025
fb13038
Extract method get_runner
chillenzer Dec 5, 2025
dc64644
Remove some redundant comments
chillenzer Dec 5, 2025
6bf7ff2
Make tests run (update modern plugins)
chillenzer Dec 8, 2025
1860fe8
More robust directory handling in Runner
chillenzer Dec 8, 2025
c8d5f64
Adapt other plugins to new species
chillenzer Dec 8, 2025
b2a09ac
Strip picmi.Simulation from references to the init manager
chillenzer Dec 8, 2025
7eca385
Ionisation introduces a dependency
chillenzer Dec 8, 2025
5b6459d
Make unique SetChargeState
chillenzer Dec 8, 2025
d659d73
Reorder requirements
chillenzer Dec 8, 2025
a1a10a8
Add merging and uniqueness protocol
chillenzer Dec 9, 2025
42f722d
Introduce DelayedConstruction
chillenzer Dec 9, 2025
dfe7444
Fix Ionization stuff
chillenzer Dec 10, 2025
8d35652
LWFA example works
chillenzer Dec 10, 2025
84ef0e9
Add SimpleMomentum
chillenzer Dec 10, 2025
49036ad
Purge auto diagnostics from codebase
chillenzer Dec 10, 2025
bcfe410
Remove reference to initmanager from docs
chillenzer Dec 10, 2025
49c8b7b
Remove init manager and further details
chillenzer Dec 10, 2025
f00851a
Fix RMS velocity handling
chillenzer Dec 10, 2025
4edf24d
Add mass and charge and handle constant conflicts
chillenzer Dec 10, 2025
adb2c2f
Replace old Species with NEW1_Species
chillenzer Dec 10, 2025
3dd7198
Add shape and pusher support
chillenzer Dec 10, 2025
20d3e7b
Move run_constructor responsibility higher up
chillenzer Dec 11, 2025
2fa06fa
Merge LLKR4 and ReducedLandauLifshitz pusher entries
chillenzer Dec 11, 2025
57b0714
Remove some more init_manager-related functions
chillenzer Dec 11, 2025
7d2dbf1
Make the tests run
chillenzer Dec 11, 2025
9a8dc9f
Minor renaming and refactoring
chillenzer Dec 11, 2025
0ec4c2c
Remove picmi.Species tests
chillenzer Dec 11, 2025
2b2cbc5
Infer species name from particle type if not given
chillenzer Dec 11, 2025
e0bb7a0
Remove picmi.Species tests (fix)
chillenzer Dec 11, 2025
61454f3
Fix PICMI tests
chillenzer Dec 11, 2025
3857745
Adapt to new Species.__init__ interface
chillenzer Dec 11, 2025
2e0bc00
More fixes
chillenzer Dec 11, 2025
c4d1d37
Remove pypicongpu tests
chillenzer Dec 15, 2025
3a34fc6
Remove skipped tests
chillenzer Dec 15, 2025
e9b882e
Remove pydantic/inspect deprecation warning
chillenzer Dec 15, 2025
affd990
Re-instantiate restriction of jobs for pypicongpu pic-build call
chillenzer Dec 15, 2025
5fde814
Remove no-ops from pypicongpu
chillenzer Dec 15, 2025
fbe3fb0
Remove temporary new_species test
chillenzer Dec 15, 2025
dde7b31
Remove Auto diagnostic from warm_plasma example
chillenzer Dec 15, 2025
854c131
Fix test_minimal pypicongpu.Simulation test
chillenzer Dec 15, 2025
ff535dd
Reviewer comments
chillenzer Jan 6, 2026
174bfbd
Rename and reorganise resolve_requirements
chillenzer Jan 6, 2026
d9bf5e9
Add tests for resolve_requirements
chillenzer Jan 6, 2026
932e8db
Minor tweak
chillenzer Jan 7, 2026
809baa6
Add species requirement resolution tests
chillenzer Jan 7, 2026
240b575
Switch to resolving_add
chillenzer Jan 7, 2026
c3ba25e
Merge mainline/dev to resolve minor conflicts
chillenzer Jan 7, 2026
0ff04ad
Reviewer comments
chillenzer Jan 9, 2026
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
12 changes: 6 additions & 6 deletions docs/source/usage/picmi/custom_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The output of the picongpu simulation in the default templates is configured in
$USED_CHARGE_CONSERVATION_FLAGS


{{#species_initmanager.species}}
{{#species}}
--{{{name}}}_macroParticlesCount.period {{{period}}}

--{{{name}}}_energy.period {{{period}}}
Expand All @@ -92,7 +92,7 @@ The output of the picongpu simulation in the default templates is configured in
--{{{name}}}_png.slicePoint 0.5
--{{{name}}}_png.folder png_{{{name}}}_{{{axis}}}
{{/png_axis}}
{{/species_initmanager.species}}
{{/species}}

{{/output.auto}}

Expand Down Expand Up @@ -148,9 +148,9 @@ Instead of hard coding the output we might want to automatically generate one in
--Cu_energyHistogram.minEnergy 0
--Cu_energyHistogram.maxEnergy 256000

{{#species_initmanager.species}}
{{#species}}
--{{{name}}}_macroParticlesCount.period 1
{{/species_initmanager.species}}
{{/species}}
{{/output.auto}}

Let's go in detail through the above example.
Expand Down Expand Up @@ -218,9 +218,9 @@ And of course it will be available as such in the rendering of the template whic
--Cu_energyHistogram.minEnergy 0
--Cu_energyHistogram.maxEnergy 256000

{{#species_initmanager.species}}
{{#species}}
--{{{name}}}_macroParticlesCount.period 1
{{/species_initmanager.species}}
{{/species}}
{{/output.auto}}

.. warning::
Expand Down
6 changes: 5 additions & 1 deletion lib/python/picongpu/picmi/copy_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ def copy_attributes(
"""
assignments = {
to_name: _value_generator(from_name)
for from_name, _ in inspect.getmembers(from_instance)
for from_name, _ in (
type(from_instance).model_fields.items()
if isinstance(from_instance, BaseModel)
else inspect.getmembers(from_instance)
)
if from_name not in ignore
and not from_name.startswith("_")
and has_attribute(to, to_name := from_name.removeprefix(remove_prefix))
Expand Down
2 changes: 0 additions & 2 deletions lib/python/picongpu/picmi/diagnostics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
License: GPLv3+
"""

from .auto import Auto
from .binning import Binning, BinningAxis, BinSpec
from .phase_space import PhaseSpace
from .energy_histogram import EnergyHistogram
Expand All @@ -19,7 +18,6 @@
from .unit_dimension import UnitDimension

__all__ = [
"Auto",
"BackendConfig",
"OpenPMDConfig",
"Binning",
Expand Down
32 changes: 0 additions & 32 deletions lib/python/picongpu/picmi/diagnostics/auto.py

This file was deleted.

17 changes: 4 additions & 13 deletions lib/python/picongpu/picmi/diagnostics/binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
from pathlib import Path
from ..copy_attributes import default_converts_to

import typeguard

from picongpu.picmi.diagnostics.backend_config import OpenPMDConfig

from ...pypicongpu.output.binning import Binning as PyPIConGPUBinning
from ...pypicongpu.output.binning import BinningAxis as PyPIConGPUBinningAxis
from ...pypicongpu.output.binning import BinSpec as PyPIConGPUBinSpec
from ...pypicongpu.species.species import Species as PyPIConGPUSpecies
from ..species import Species as PICMISpecies
from ..species import Species as Species
from .particle_functor import ParticleFunctor as BinningFunctor
from .timestepspec import TimeStepSpec

Expand All @@ -30,7 +28,6 @@ def __init__(self, kind, start, stop, nsteps):
self.nsteps = nsteps


@typeguard.typechecked
class BinningAxis:
def __init__(
self,
Expand All @@ -53,14 +50,13 @@ def get_as_pypicongpu(self) -> PyPIConGPUBinningAxis:
)


@typeguard.typechecked
class Binning:
def __init__(
self,
name: str,
deposition_functor: BinningFunctor,
axes: list[BinningAxis],
species: PICMISpecies | list[PICMISpecies],
species: Species | list[Species],
period: TimeStepSpec | None = None,
openPMD: dict | None = None,
openPMDExt: str | None = None,
Expand All @@ -70,7 +66,7 @@ def __init__(
self.name = name
self.deposition_functor = deposition_functor
self.axes = axes
if isinstance(species, PICMISpecies):
if isinstance(species, Species):
species = [species]
self.species = species
self.period = period or TimeStepSpec[:]
Expand All @@ -86,19 +82,14 @@ def result_path(self, prefix_path):

def get_as_pypicongpu(
self,
dict_species_picmi_to_pypicongpu: dict[PICMISpecies, PyPIConGPUSpecies],
time_step_size,
num_steps,
) -> PyPIConGPUBinning:
if len(not_found := [s for s in self.species if s not in dict_species_picmi_to_pypicongpu.keys()]) > 0:
raise ValueError(f"Species {not_found} are not known to Simulation")
pypic_species = list(map(dict_species_picmi_to_pypicongpu.get, self.species))

return PyPIConGPUBinning(
name=self.name,
deposition_functor=self.deposition_functor.get_as_pypicongpu(),
axes=list(map(BinningAxis.get_as_pypicongpu, self.axes)),
species=pypic_species,
species=[s.get_as_pypicongpu() for s in self.species],
period=self.period.get_as_pypicongpu(time_step_size, num_steps),
openPMD=self.openPMD,
openPMDExt=self.openPMDExt,
Expand Down
39 changes: 16 additions & 23 deletions lib/python/picongpu/picmi/diagnostics/energy_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
License: GPLv3+
"""

import typeguard
from pydantic import BaseModel

from picongpu.picmi.copy_attributes import default_converts_to

from picongpu.picmi.diagnostics.util import diagnostic_converts_to

from ...pypicongpu.output.energy_histogram import (
EnergyHistogram as PyPIConGPUEnergyHistogram,
)
from ..species import Species as PICMISpecies
from ..species import Species as Species
from .timestepspec import TimeStepSpec


@diagnostic_converts_to(PyPIConGPUEnergyHistogram)
@typeguard.typechecked
class EnergyHistogram:
@default_converts_to(PyPIConGPUEnergyHistogram)
class EnergyHistogram(BaseModel):
"""
Specifies the parameters for the output of Energy Histogram of species such as electrons.

Expand Down Expand Up @@ -53,24 +53,17 @@ class EnergyHistogram:
Optional name for the energy histogram plugin.
"""

def check(self, dict_species_picmi_to_pypicongpu, *args, **kwargs):
def check(self, *args, **kwargs):
if self.min_energy >= self.max_energy:
raise ValueError("min_energy must be less than max_energy")
if self.bin_count <= 0:
raise ValueError("bin_count must be > 0")
if self.species not in dict_species_picmi_to_pypicongpu.keys():
raise ValueError(f"Species {self.species} is not known to Simulation")

def __init__(
self,
species: PICMISpecies,
period: TimeStepSpec,
bin_count: int,
min_energy: float,
max_energy: float,
):
self.species = species
self.period = period
self.bin_count = bin_count
self.min_energy = min_energy
self.max_energy = max_energy

species: Species
period: TimeStepSpec
bin_count: int
min_energy: float
max_energy: float

class Config:
arbitrary_types_allowed = True
25 changes: 9 additions & 16 deletions lib/python/picongpu/picmi/diagnostics/macro_particle_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@
License: GPLv3+
"""

import typeguard
from pydantic import BaseModel

from picongpu.picmi.diagnostics.util import diagnostic_converts_to
from picongpu.picmi.copy_attributes import default_converts_to

from ...pypicongpu.output.macro_particle_count import (
MacroParticleCount as PyPIConGPUMacroParticleCount,
)
from ...pypicongpu.species.species import Species as PyPIConGPUSpecies
from ..species import Species as PICMISpecies
from ..species import Species as Species
from .timestepspec import TimeStepSpec


@diagnostic_converts_to(PyPIConGPUMacroParticleCount)
@typeguard.typechecked
class MacroParticleCount:
@default_converts_to(PyPIConGPUMacroParticleCount)
class MacroParticleCount(BaseModel):
"""
Specifies the parameters for counting the total number of macro particles of a given species.

Expand All @@ -39,13 +37,8 @@ class MacroParticleCount:
Optional name for the macro particle count plugin.
"""

def __init__(self, species: PICMISpecies, period: TimeStepSpec):
self.species = species
self.period = period
species: Species
period: TimeStepSpec

def check(self, dict_species_picmi_to_pypicongpu: dict[PICMISpecies, PyPIConGPUSpecies], *args, **kwargs):
if self.species not in dict_species_picmi_to_pypicongpu.keys():
raise ValueError(f"Species {self.species} is not known to Simulation")
pypicongpu_species = dict_species_picmi_to_pypicongpu.get(self.species)
if pypicongpu_species is None:
raise ValueError(f"Species {self.species} is not mapped to a PyPIConGPUSpecies.")
class Config:
arbitrary_types_allowed = True
2 changes: 1 addition & 1 deletion lib/python/picongpu/picmi/diagnostics/particle_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from pydantic import BaseModel

from picongpu.picmi.species import Species
from picongpu.picmi.species import Species as Species

from .backend_config import BackendConfig, OpenPMDConfig
from .timestepspec import TimeStepSpec
Expand Down
45 changes: 15 additions & 30 deletions lib/python/picongpu/picmi/diagnostics/phase_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@

from typing import Literal

import typeguard
from pydantic import BaseModel

from picongpu.picmi.diagnostics.util import diagnostic_converts_to
from picongpu.picmi.copy_attributes import default_converts_to

from ...pypicongpu.output.phase_space import PhaseSpace as PyPIConGPUPhaseSpace
from ..species import Species as PICMISpecies
from ..species import Species as Species
from .timestepspec import TimeStepSpec


@diagnostic_converts_to(PyPIConGPUPhaseSpace)
@typeguard.typechecked
class PhaseSpace:
@default_converts_to(PyPIConGPUPhaseSpace)
class PhaseSpace(BaseModel):
"""
Specifies the parameters for the output of Phase Space of species such as electrons.

Expand Down Expand Up @@ -52,30 +51,16 @@ class PhaseSpace:
Optional name for the phase-space plugin.
"""

def check(self, dict_species_picmi_to_pypicongpu, *args, **kwargs):
species: Species
period: TimeStepSpec
spatial_coordinate: Literal["x", "y", "z"]
momentum_coordinate: Literal["px", "py", "pz"]
min_momentum: float
max_momentum: float

def check(self, *args, **kwargs):
if self.min_momentum >= self.max_momentum:
raise ValueError("min_momentum must be less than max_momentum")

if self.species not in dict_species_picmi_to_pypicongpu.keys():
raise ValueError(f"Species {self.species} is not known to Simulation")

# checks if PICMISpecies instance exists in the dictionary. If yes, it returns the corresponding PyPIConGPUSpecies instance.
# self.species refers to the species attribute of the class PhaseSpace(picmistandard.PICMI_PhaseSpace).
if dict_species_picmi_to_pypicongpu.get(self.species) is None:
raise ValueError(f"Species {self.species} is not mapped to a PyPIConGPUSpecies.")

def __init__(
self,
species: PICMISpecies,
period: TimeStepSpec,
spatial_coordinate: Literal["x", "y", "z"],
momentum_coordinate: Literal["px", "py", "pz"],
min_momentum: float,
max_momentum: float,
):
self.species = species
self.period = period
self.spatial_coordinate = spatial_coordinate
self.momentum_coordinate = momentum_coordinate
self.min_momentum = min_momentum
self.max_momentum = max_momentum
class Config:
arbitrary_types_allowed = True
Loading