Species

The Species class is the generic class for all species. Electron and Proton are the short cuts for the most common species.

pydantic model lambdapic.core.species.SpeciesConfig[source]

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field name: str [Required]

Name of the particle species

field charge: int [Required]

Charge number (e.g. -1 for electron, +1 for proton)

field mass: float [Required]

Mass in units of electron mass

field density: Callable | None = None

Function defining particle density distribution

field density_min: float = 0

Minimum density threshold

field ppc: int | Callable = 0

Particles per cell (constant int or coordinate-based function)

field momentum: tuple[Callable[[float, float, float], float] | Callable[[float, float], float] | None, Callable[[float, float, float], float] | Callable[[float, float], float] | None, Callable[[float, float, float], float] | Callable[[float, float], float] | None] | None = (None, None, None)

Tuple of functions defining momentum distribution in x,y,z directions

field polarization: tuple[float, float, float] | None = None

Polarization vector (x,y,z components) for spin particles

field pusher: Literal['boris', 'photon', 'boris+tbmt'] = 'boris'

Particle pusher algorithm to use

class lambdapic.core.species.Species(*, name: str, charge: int, mass: float, density: Callable | None = None, density_min: float = 0, ppc: int | Callable = 0, momentum: tuple[Callable[[float, float, float], float] | Callable[[float, float], float] | None, Callable[[float, float, float], float] | Callable[[float, float], float] | None, Callable[[float, float, float], float] | Callable[[float, float], float] | None] | None = (None, None, None), polarization: tuple[float, float, float] | None = None, pusher: Literal['boris', 'photon', 'boris+tbmt'] = 'boris')[source]

Bases: EnableMixin

Base Species class

Parameters:
  • name (str) – Particle species name

  • charge (int) – Particle charge

  • mass (float) – Particle mass in units of electron mass

  • density (Callable, optional) – Density function

  • density_min (float) – Minimum density threshold”

  • ppc (int or Callable) – Particles per cell (constant or function)

  • momentum (tuple) – Momentum distribution functions

  • polarization (tuple, optional) – Spin polarization vector

  • pusher (str) – Particle pusher algorithm

name: str
charge: int
mass: float
density: Callable | None = None
density_min: float = 0
ppc: int | Callable = 0
momentum: tuple[Callable[[float, float, float], float] | Callable[[float, float], float] | None, Callable[[float, float, float], float] | Callable[[float, float], float] | None, Callable[[float, float, float], float] | Callable[[float, float], float] | None] | None = (None, None, None)
polarization: tuple[float, float, float] | None = None
pusher: Literal['boris', 'photon', 'boris+tbmt'] = 'boris'
property ispec: int
static compile_jit(func_or_val: Callable | Dispatcher | float | int, dimension: Literal[2, 3]) LambdaType[source]
create_particles(ipatch: int | None = None, rank: int | None = None) ParticlesBase[source]

Create Particles from the species.

Particles class holds the particle data.

Called by patch.

Then particles are created within the patch.

class lambdapic.core.species.Electron(*, name: str = 'electron', density: Callable | None = None, density_min: float = 0, ppc: int | Callable = 0, momentum: tuple[Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType]] | None = (None, None, None), polarization: tuple[float, float, float] | None = None, pusher: Literal['boris', 'photon', 'boris+tbmt'] = 'boris', radiation: Literal['ll', 'photons'] | None = None)[source]

Bases: Species

name: str = 'electron'
radiation: Literal['ll', 'photons'] | None = None
charge: int = -1
mass: float = 1
photon: Species | None = None
set_photon(photon: Species)[source]
create_particles(ipatch: int | None = None, rank: int | None = None) ParticlesBase[source]

Create Particles from the species.

Particles class holds the particle data.

Called by patch.

Then particles are created within the patch.

class lambdapic.core.species.Positron(*, name: str = 'positron', density: Callable | None = None, density_min: float = 0, ppc: int | Callable = 0, momentum: tuple[Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType]] | None = (None, None, None), polarization: tuple[float, float, float] | None = None, pusher: Literal['boris', 'photon', 'boris+tbmt'] = 'boris', radiation: Literal['ll', 'photons'] | None = None)[source]

Bases: Electron

name: str = 'positron'
charge: int = 1
class lambdapic.core.species.Proton(*, name: str = 'proton', density: Callable | None = None, density_min: float = 0, ppc: int | Callable = 0, momentum: tuple[Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType]] | None = (None, None, None), polarization: tuple[float, float, float] | None = None, pusher: Literal['boris', 'photon', 'boris+tbmt'] = 'boris')[source]

Bases: Species

name: str = 'proton'
charge: int = 1
mass: float = 1836.1526734215265
class lambdapic.core.species.Photon(*, name: str = 'photon', density: Callable | None = None, density_min: float = 0, ppc: int | Callable = 0, momentum: tuple[Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType], Union[Callable[[float, float, float], float], Callable[[float, float], float], NoneType]] | None = (None, None, None), polarization: tuple[float, float, float] | None = None)[source]

Bases: Species

name: str = 'photon'
charge: int = 0
mass: float = 0
pusher: Literal['boris', 'photon', 'boris+tbmt'] = 'photon'
electron: Species | None = None
positron: Species | None = None
set_bw_pair(*, electron: Species, positron: Species)[source]
create_particles(ipatch: int | None = None, rank: int | None = None) ParticlesBase[source]

Create Particles from the species.

Particles class holds the particle data.

Called by patch.

Then particles are created within the patch.