pymiediff.Particle.__init__#
- Particle.__init__(r_layers=None, eps_layers=None, mat_layers=None, mat_env=1.0, device=None, r_core=None, mat_core=None, r_shell=None, mat_shell=None)#
Create a spherical particle model.
- Parameters:
r_layers (torch.Tensor/array-like, optional) – Layer outer radii (nm), ordered from inner to outermost layer. This is the preferred multilayer input.
eps_layers (torch.Tensor/array-like, optional) – Layer permittivities corresponding to
r_layers. Supported shapes are those accepted bypymiediff.multishellfunctions (e.g.(L,),(L, N_k0),(N_part, L, N_k0)for batched use). This is the preferred multilayer input.mat_layers (list, optional) – Layer materials corresponding to
r_layers(one per layer). Entries can be pymiediff material objects or scalar refractive indices (converted toMatConstant). This is an alternative toeps_layersfor multilayer particles.mat_env (pymiediff.materials.Material or float/int/complex/torch.Tensor, optional) – Surrounding (environment) material. Defaults to a refractive index of
1.0(air). Scalars are converted to a constant‑index material.r_core (float or torch.Tensor, optional) – Legacy core radius (nm), used when multilayer inputs are not given.
mat_core (pymiediff.materials.Material or float/int/complex/torch.Tensor, optional) – Legacy core material. If a scalar is supplied, a constant-index material
pymiediff.materials.MatConstantis created from the value (interpreted as refractive index).r_shell (float or torch.Tensor, optional) – Legacy shell radius (nm). Must be supplied together with
mat_shell.mat_shell (pymiediff.materials.Material or float/int/complex/torch.Tensor, optional) – Legacy shell material.
device (str or torch.device, optional) – Torch device on which all tensors will be allocated. If omitted, defaults to
'cpu'.
Notes
Preferred mode is multilayer (
r_layerswitheps_layersormat_layers). Legacy core/shell arguments are kept for backward compatibility.Examples
>>> import pymiediff as pmd >>> p = pmd.Particle(r_layers=[50, 80], eps_layers=[2.25, 4.0], mat_env=1.0)