How to Add a Species Constant (“Flag”)
Species constants are constants associated to all particles of a species. Hence they are included in the PIConGPU species type definition, located in the “Species Flags”.
Replace
CONST
with your new constant.
add constant in
lib/python/picongpu/pypicongpu/species/constant/CONST.py
inherit from
Constant
add test, checking at least for:
rendering from
get_rendering_context()
check (even if check is empty)
typesafety
(possibly empty) dependencies on species, attributes, other constants
(implement tests, add schema)
add constant passthrough test in species test
add constant in map
expected_const_by_name
in testtest_rendering_constants()
background: constants are not automatically exposed by the PyPIConGPU species class
(implement test by adding passthrough from species.py)
write PICMI test
new constant is created from PICMI
(implement test)
adjust code generation
keep in mind that your new constant is optional, i.e. use
{{#constants.CONST}} my-code-to-generate-CONST = {{{value}}}; {{/constants.CONST}}
create & compile an example
Note that constants are not stored in a list, but every constant type has a key in a dictionary associated to it. This means when adding a new constant the species class has to be adjusted to pass the new constant into its rendering context.