API Reference
Public package API
LWW 1D Wigner-Poisson quantum transport package.
- class lww_transport.ComputeParams(dense_solver='numpy', kernel_backend='auto', use_numba=True, verbose=False)[source]
Performance and debugging options.
- Parameters:
dense_solver (str) – Linear solver backend. Default ‘numpy’.
kernel_backend (str) – Computational kernel implementation. Options: ‘auto’, ‘cpp’, ‘numba’, ‘python’. Default ‘auto’, which selects the fastest available backend.
use_numba (bool) – Enable Numba JIT compilation for hot loops. Default True.
verbose (bool) – Print diagnostic information during solve. Default False.
- dense_solver: str
- kernel_backend: str
- use_numba: bool
- verbose: bool
- class lww_transport.DiscretizationParams(nx=86, n=72)[source]
Spatial and momentum grid parameters.
- Parameters:
nx (int) – Number of spatial grid points. Default 86 matches the reference RTD configuration.
n (int) – Number of momentum grid points. Must be even. Default 72 matches the reference RTD configuration.
- nx: int
- n: int
- class lww_transport.GeometryParams(box=550.0, well=50.0, barrier=30.0, spacer=30.0, pot=0.3)[source]
Double-barrier quantum well (DBQW) geometry.
Describes the device structure: emitter | spacer | barrier | well | barrier | spacer | collector
- Parameters:
box (float) – Total device length [nm]. Default 550 nm.
well (float) – Quantum well width [nm]. Default 50 nm.
barrier (float) – Barrier position/height parameter [nm]. Default 30 nm.
spacer (float) – Spacer region width [nm]. Default 30 nm.
pot (float) – Potential barrier height [eV]. Default 0.3 eV.
- box: float
- well: float
- barrier: float
- spacer: float
- pot: float
- class lww_transport.GeometryRegion(name, start_nm, end_nm, potential_ev, kind)[source]
Named interval in the one-dimensional RTD structure.
- Parameters:
name (str)
start_nm (float)
end_nm (float)
potential_ev (float)
kind (str)
- name: str
- start_nm: float
- end_nm: float
- potential_ev: float
- kind: str
- property width_nm: float
- class lww_transport.LWWConfig(discretization=None, material=None, geometry=None, operating=None, solver=None, compute=None, **flat_overrides)[source]
Unified 1D LWW quantum transport simulator configuration.
Parameters are grouped by discretization, material, geometry, operating conditions, solver controls, and compute backend.
- Parameters:
discretization (DiscretizationParams)
material (MaterialParams)
geometry (GeometryParams)
operating (OperatingConditions)
solver (SolverParams)
compute (ComputeParams)
- discretization
Grid resolution (nx, n).
- Type:
DiscretizationParams
- material
Semiconductor properties (GaAs defaults).
- Type:
MaterialParams
- geometry
Device structure (double-barrier QW).
- Type:
GeometryParams
- operating
Bias voltage and temperature.
- Type:
OperatingConditions
- solver
Numerical solver settings.
- Type:
SolverParams
- compute
Backend and performance options.
- Type:
ComputeParams
Examples
>>> cfg = LWWConfig.standard_rtd() >>> cfg = LWWConfig.quick_test(nx=32, n=32) >>> cfg = LWWConfig( ... discretization=DiscretizationParams(nx=48, n=48), ... material=MaterialParams(temp=300.0), ... operating=OperatingConditions(bias=0.1), ... )
- x: ndarray
- k: ndarray
- discretization: DiscretizationParams
- material: MaterialParams
- geometry: GeometryParams
- operating: OperatingConditions
- solver: SolverParams
- compute: ComputeParams
- property nx: int
- property n: int
- property c: float
- property rmo: float
- property rm: float
- property temp: float
- property rhc: float
- property re: float
- property rno: float
- property ri: float
- property box: float
- property well: float
- property barrier: float
- property spacer: float
- property pot: float
- property irlx: int
- property chemp: float
- property exchange: bool
- property relaxation_tau: float
- property hbar_like: float
- property convergence_eps: float
- property rfa: float
- property poisson_vmax_stop: float
- property density_stop: float
- property dense_solver: str
- property verbose: bool
- property use_numba: bool
- property kernel_backend: str
- property rmass: float
Effective mass [eV·ps²/nm²].
- property bbeta: float
Inverse thermal energy [1/eV].
- property dens: float
Nominal electron density [1/nm³].
- property densi: float
Ionized impurity density [1/nm³].
- property delx: float
Spatial grid spacing [nm].
- property delk: float
Momentum grid spacing [1/nm].
- property size: int
Total Wigner phase-space dimension (nx × n).
- with_bias(bias)[source]
Set the applied bias voltage.
- Parameters:
bias (float)
- Return type:
LWWConfig
- with_temperature(temperature)[source]
Set operating temperature and return self.
- Parameters:
temperature (float)
- Return type:
LWWConfig
- with_grid(nx, n)[source]
Set grid resolution and return self.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- with_exchange(exchange)[source]
Set density-dependent exchange correction.
- Parameters:
exchange (bool)
- Return type:
LWWConfig
- with_verbose(verbose)[source]
Enable/disable verbose output.
- Parameters:
verbose (bool)
- Return type:
LWWConfig
- classmethod quick_test(nx=16, n=16)[source]
Small-grid configuration for unit tests and smoke tests.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- classmethod standard_rtd()[source]
Standard resonant tunneling diode at 77K.
Reproduces the reference 1D RTD LWW configuration. - GaAs at 77K - Full resolution (86×72 grid) - Double-barrier QW geometry
- Return type:
LWWConfig
- classmethod room_temperature_rtd()[source]
RTD configuration at 300 K.
- Return type:
LWWConfig
- classmethod coarse_grid_rtd(nx=32, n=32)[source]
Coarse-grid RTD configuration for parameter sweeps.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- classmethod fine_grid_rtd(nx=128, n=96)[source]
High-resolution RTD configuration.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- classmethod narrow_well_rtd()[source]
RTD configuration with a 25 nm quantum well.
- Return type:
LWWConfig
- classmethod wide_well_rtd()[source]
RTD configuration with a 75 nm quantum well.
- Return type:
LWWConfig
- class lww_transport.LWW1DSimulator(config=None)[source]
One-dimensional LWW simulation workflow.
- Parameters:
config (LWWConfig | None)
- config_summary(extra=None)[source]
Return a human-readable summary for the simulator configuration.
- Parameters:
extra (dict[str, object] | None)
- Return type:
str
- print_config_summary(extra=None)[source]
Print a human-readable summary for the simulator configuration.
- Parameters:
extra (dict[str, object] | None)
- Return type:
None
- save_config_summary(output_dir, filename='config_summary.txt', extra=None)[source]
Save the simulator configuration summary next to simulation output.
- Parameters:
output_dir (str | Path)
filename (str)
extra (dict[str, object] | None)
- Return type:
Path
- zeros_state()[source]
- Return type:
- initial_zero_bias_state(exchange=None)[source]
Compute the zero-bias initial Wigner state.
- Parameters:
exchange (bool | None)
- Return type:
- solve_steady_state(bias=0.0, dbias=0.1, max_iterations=200, initial_state=None, exchange=None)[source]
Run the self-consistent steady-state Wigner-Poisson loop.
- Parameters:
bias (float)
dbias (float)
max_iterations (int)
initial_state (SimulationState | None)
exchange (bool | None)
- Return type:
- run_transient(state, ivn=45, itn=1000, dbias=0.008, exchange=None, sample_every=10, progress_every=50, output_dir=None, transient_prefix='lww_tcurl', state_prefix='lww')[source]
Run the transient bias sweep.
When
cfg.verboseis true, print flushed progress lines at the start and end of each bias point and everyprogress_everyiterations. Ifoutput_diris supplied, transient current trace CSV files are written incrementally as samples are produced, and state checkpoint files are refreshed after each completed bias point.- Parameters:
state (SimulationState)
ivn (int)
itn (int)
dbias (float)
exchange (bool | None)
sample_every (int)
progress_every (int | None)
output_dir (str | Path | None)
transient_prefix (str)
state_prefix (str)
- Return type:
- save_state(state, output_dir, prefix='lww')[source]
Write state arrays in the legacy CSV format.
- Parameters:
state (SimulationState)
output_dir (str | Path)
prefix (str)
- Return type:
None
- load_state(input_dir, prefix='lww')[source]
Load state arrays from the legacy CSV format.
- Parameters:
input_dir (str | Path)
prefix (str)
- Return type:
- save_transient(result, output_dir, prefix='lww_tcurl')[source]
- Parameters:
result (TransientResult)
output_dir (str | Path)
prefix (str)
- Return type:
None
- class lww_transport.MaterialParams(c=2997.92458, rmo=0.0568567517, rm=0.0667, temp=77.0, rhc=1973.29, re=2.0, rno=1e-06, ri=0.3, chemp=0.0863814)[source]
Physical constants and semiconductor band structure.
Defaults are for GaAs-like material at T=77K.
- Parameters:
c (float) – Speed of light [nm/ps]. Default 2997.92.
rmo (float) – Effective mass ratio. Default 0.0569.
rm (float) – Effective mass scaling. Default 0.0667.
temp (float) – Temperature [K]. Default 77.0 K.
rhc (float) – ℏc product [eV·nm]. Default 1973.29.
re (float) – Electron density scaling. Default 2.0.
rno (float) – Nominal doping density [1/nm³]. Default 1e-6.
ri (float) – Ionized impurity ratio. Default 0.3.
chemp (float) – Equilibrium chemical potential [eV]. Default 0.0864 (at 77K).
- c: float
- rmo: float
- rm: float
- temp: float
- rhc: float
- re: float
- rno: float
- ri: float
- chemp: float
- class lww_transport.OperatingConditions(bias=0.0, temperature=77.0)[source]
Bias voltage and thermal settings.
- Parameters:
bias (float) – Applied bias voltage [V]. Default 0.0 V (zero bias).
temperature (float) – Operating temperature [K]. Default 77.0 K (liquid nitrogen).
- bias: float
- temperature: float
- class lww_transport.SolverParams(irlx=4, relaxation_tau=525.5074, hbar_like=0.6582186934, convergence_eps=7e-10, poisson_vmax_stop=0.001, density_stop=3e-09, exchange=False, rfa=650.0)[source]
Convergence and numerical method settings.
- Parameters:
irlx (int) – Relaxation type flag. Default 4.
relaxation_tau (float) – Relaxation time parameter [ps]. Default 525.51.
hbar_like (float) – Planck constant scaling factor. Default 0.6582.
convergence_eps (float) – Density convergence threshold. Default 7e-10. Smaller values tighten convergence and increase runtime.
poisson_vmax_stop (float) – Potential convergence criterion [eV]. Default 0.001.
density_stop (float) – Density convergence criterion [1/nm³]. Default 3e-9.
exchange (bool) – Include optional density-dependent exchange correction. Default False.
rfa (float) – Relaxation factor for Poisson solver. Default 650.0.
- irlx: int
- relaxation_tau: float
- hbar_like: float
- convergence_eps: float
- poisson_vmax_stop: float
- density_stop: float
- exchange: bool
- rfa: float
- class lww_transport.SimulationState(rvs: 'np.ndarray', f: 'np.ndarray', fr: 'np.ndarray', fo: 'np.ndarray', density_previous: 'np.ndarray', current_or_density: 'np.ndarray')[source]
- Parameters:
rvs (ndarray)
f (ndarray)
fr (ndarray)
fo (ndarray)
density_previous (ndarray)
current_or_density (ndarray)
- rvs: ndarray
- f: ndarray
- fr: ndarray
- fo: ndarray
- density_previous: ndarray
- current_or_density: ndarray
- copy()[source]
- Return type:
- class lww_transport.SteadyStateResult(state: 'SimulationState', density: 'np.ndarray', current: 'np.ndarray', iterations: 'int', converged: 'bool', max_density_change: 'float', max_potential_update: 'float')[source]
- Parameters:
state (SimulationState)
density (ndarray)
current (ndarray)
iterations (int)
converged (bool)
max_density_change (float)
max_potential_update (float)
- state: SimulationState
- density: ndarray
- current: ndarray
- iterations: int
- converged: bool
- max_density_change: float
- max_potential_update: float
- class lww_transport.TransientResult(state: 'SimulationState', bias_currents: 'dict[float, pd.DataFrame]')[source]
- Parameters:
state (SimulationState)
bias_currents (dict[float, DataFrame])
- state: SimulationState
- bias_currents: dict[float, DataFrame]
- lww_transport.format_config_summary(cfg, extra=None)[source]
Return a human-readable summary of the configuration.
Examples
>>> cfg = LWWConfig.standard_rtd() >>> print(format_config_summary(cfg))
- Parameters:
cfg (LWWConfig)
extra (Mapping[str, object] | None)
- Return type:
str
- lww_transport.geometry_potential_profile(cfg=None, points=1200)[source]
Return a piecewise RTD geometry potential profile.
- Parameters:
cfg (LWWConfig | None)
points (int)
- Return type:
tuple[ndarray, ndarray]
- lww_transport.plot_rtd_geometry(cfg=None, ax=None, show_labels=True, title='Resonant tunneling diode geometry')[source]
Draw the one-dimensional RTD geometry and return the Matplotlib axes.
- Parameters:
cfg (LWWConfig | None)
show_labels (bool)
title (str | None)
- lww_transport.plot_wigner_phase_space(wigner, cfg=None, ax=None, figsize=(9.0, 6.4), x=None, k=None, title='Wigner phase-space distribution', style='standard', x_unit='um', centered_x=True, scale=1.0, normalize=False, x_lim=None, k_lim=None, z_lim=None, x_buffer=None, k_buffer=None, z_buffer=None, surface_cmap=None, contour_cmap=None, x_projection_cmap='Reds', y_projection_cmap='Blues', contour_levels=40, contour_offset=None, surface_alpha=None, z_projection_alpha=None, x_projection_alpha=None, y_projection_alpha=None, z_projection=True, x_projection=None, y_projection=None, colorbar=None, colorbar_label=None, colorbar_shrink=0.72, colorbar_pad=0.08, colorbar_aspect=18, x_projection_offset=None, y_projection_offset=None, surface_edgecolor='none', surface_linewidth=0.0, transparent_panes=None, show_grid=None, x_label=None, k_label=None, z_label=None, box_aspect=(1.35, 1.0, 0.72), stride=1, elev=None, azim=None)[source]
Draw a 3D Wigner phase-space surface with a contour projection.
wignermay be a flattened simulator vector, a(nx, n)matrix, or a CSV file containing either form. Flattened vectors requirecfgso the phase-space dimensions can be restored.- Parameters:
wigner (str | PathLike[str] | ndarray)
cfg (LWWConfig | None)
figsize (tuple[float, float])
x (Sequence[float] | None)
k (Sequence[float] | None)
title (str | None)
style (str)
x_unit (str)
centered_x (bool)
scale (float)
normalize (bool)
x_lim (tuple[float, float] | None)
k_lim (tuple[float, float] | None)
z_lim (tuple[float, float] | None)
x_buffer (float | tuple[float, float] | None)
k_buffer (float | tuple[float, float] | None)
z_buffer (float | tuple[float, float] | None)
surface_cmap (str | None)
contour_cmap (str | None)
x_projection_cmap (str)
y_projection_cmap (str)
contour_levels (int)
contour_offset (float | None)
surface_alpha (float | None)
z_projection_alpha (float | None)
x_projection_alpha (float | None)
y_projection_alpha (float | None)
z_projection (bool)
x_projection (bool | None)
y_projection (bool | None)
colorbar (bool | None)
colorbar_label (str | None)
colorbar_shrink (float)
colorbar_pad (float)
colorbar_aspect (int)
x_projection_offset (float | None)
y_projection_offset (float | None)
surface_edgecolor (str)
surface_linewidth (float)
transparent_panes (bool | None)
show_grid (bool | None)
x_label (str | None)
k_label (str | None)
z_label (str | None)
box_aspect (tuple[float, float, float] | None)
stride (int)
elev (float | None)
azim (float | None)
- lww_transport.print_config_summary(cfg, extra=None)[source]
Print a human-readable summary of the configuration.
- Parameters:
cfg (LWWConfig)
extra (Mapping[str, object] | None)
- Return type:
None
- lww_transport.rtd_geometry_regions(cfg=None)[source]
Return emitter/spacer/barrier/well/collector regions for the RTD.
- Parameters:
cfg (LWWConfig | None)
- Return type:
list[GeometryRegion]
- lww_transport.save_config_summary(cfg, output_dir, filename='config_summary.txt', extra=None)[source]
Save the human-readable configuration summary and return its path.
- Parameters:
cfg (LWWConfig)
output_dir (str | Path)
filename (str)
extra (Mapping[str, object] | None)
- Return type:
Path
- lww_transport.save_rtd_geometry_image(cfg=None, path='rtd_geometry.png', dpi=160, show_labels=True, title='Resonant tunneling diode geometry')[source]
Save a PNG image of the RTD geometry and return its path.
- Parameters:
cfg (LWWConfig | None)
path (str | Path)
dpi (int)
show_labels (bool)
title (str | None)
- Return type:
Path
- lww_transport.save_wigner_phase_space_image(wigner, path='wigner_phase_space.png', cfg=None, dpi=170, **plot_kwargs)[source]
Save a 3D Wigner phase-space image and return its path.
- Parameters:
wigner (str | PathLike[str] | ndarray)
path (str | Path)
cfg (LWWConfig | None)
dpi (int)
- Return type:
Path
- lww_transport.save_wigner_phase_space_images(wigners, output_dir, cfg=None, prefix='wigner_phase_space', extension='png', dpi=170, **plot_kwargs)[source]
Save phase-space images for multiple Wigner distributions.
- Parameters:
wigners (Mapping[object, str | PathLike[str] | ndarray] | Sequence[str | PathLike[str] | ndarray])
output_dir (str | Path)
cfg (LWWConfig | None)
prefix (str)
extension (str)
dpi (int)
- Return type:
list[Path]
- lww_transport.wigner_phase_space_grids(cfg=None, shape=None, centered_x=True, x_unit='um')[source]
Return spatial and wave-vector axes for Wigner phase-space plots.
- Parameters:
cfg (LWWConfig | None)
shape (tuple[int, int] | None)
centered_x (bool)
x_unit (str)
- Return type:
tuple[ndarray, ndarray]
Configuration
Grouped configuration objects for the LWW quantum transport simulator.
- class lww_transport.config_refactored.ComputeParams(dense_solver='numpy', kernel_backend='auto', use_numba=True, verbose=False)[source]
Bases:
objectPerformance and debugging options.
- Parameters:
dense_solver (str) – Linear solver backend. Default ‘numpy’.
kernel_backend (str) – Computational kernel implementation. Options: ‘auto’, ‘cpp’, ‘numba’, ‘python’. Default ‘auto’, which selects the fastest available backend.
use_numba (bool) – Enable Numba JIT compilation for hot loops. Default True.
verbose (bool) – Print diagnostic information during solve. Default False.
- dense_solver: str
- kernel_backend: str
- use_numba: bool
- verbose: bool
- class lww_transport.config_refactored.DiscretizationParams(nx=86, n=72)[source]
Bases:
objectSpatial and momentum grid parameters.
- Parameters:
nx (int) – Number of spatial grid points. Default 86 matches the reference RTD configuration.
n (int) – Number of momentum grid points. Must be even. Default 72 matches the reference RTD configuration.
- nx: int
- n: int
- class lww_transport.config_refactored.GeometryParams(box=550.0, well=50.0, barrier=30.0, spacer=30.0, pot=0.3)[source]
Bases:
objectDouble-barrier quantum well (DBQW) geometry.
Describes the device structure: emitter | spacer | barrier | well | barrier | spacer | collector
- Parameters:
box (float) – Total device length [nm]. Default 550 nm.
well (float) – Quantum well width [nm]. Default 50 nm.
barrier (float) – Barrier position/height parameter [nm]. Default 30 nm.
spacer (float) – Spacer region width [nm]. Default 30 nm.
pot (float) – Potential barrier height [eV]. Default 0.3 eV.
- box: float
- well: float
- barrier: float
- spacer: float
- pot: float
- class lww_transport.config_refactored.LWWConfig(discretization=None, material=None, geometry=None, operating=None, solver=None, compute=None, **flat_overrides)[source]
Bases:
objectUnified 1D LWW quantum transport simulator configuration.
Parameters are grouped by discretization, material, geometry, operating conditions, solver controls, and compute backend.
- Parameters:
discretization (DiscretizationParams)
material (MaterialParams)
geometry (GeometryParams)
operating (OperatingConditions)
solver (SolverParams)
compute (ComputeParams)
- discretization
Grid resolution (nx, n).
- Type:
DiscretizationParams
- material
Semiconductor properties (GaAs defaults).
- Type:
MaterialParams
- geometry
Device structure (double-barrier QW).
- Type:
GeometryParams
- operating
Bias voltage and temperature.
- Type:
OperatingConditions
- solver
Numerical solver settings.
- Type:
SolverParams
- compute
Backend and performance options.
- Type:
ComputeParams
Examples
>>> cfg = LWWConfig.standard_rtd() >>> cfg = LWWConfig.quick_test(nx=32, n=32) >>> cfg = LWWConfig( ... discretization=DiscretizationParams(nx=48, n=48), ... material=MaterialParams(temp=300.0), ... operating=OperatingConditions(bias=0.1), ... )
- x: ndarray
- k: ndarray
- discretization: DiscretizationParams
- material: MaterialParams
- geometry: GeometryParams
- operating: OperatingConditions
- solver: SolverParams
- compute: ComputeParams
- property nx: int
- property n: int
- property c: float
- property rmo: float
- property rm: float
- property temp: float
- property rhc: float
- property re: float
- property rno: float
- property ri: float
- property box: float
- property well: float
- property barrier: float
- property spacer: float
- property pot: float
- property irlx: int
- property chemp: float
- property exchange: bool
- property relaxation_tau: float
- property hbar_like: float
- property convergence_eps: float
- property rfa: float
- property poisson_vmax_stop: float
- property density_stop: float
- property dense_solver: str
- property verbose: bool
- property use_numba: bool
- property kernel_backend: str
- property rmass: float
Effective mass [eV·ps²/nm²].
- property bbeta: float
Inverse thermal energy [1/eV].
- property dens: float
Nominal electron density [1/nm³].
- property densi: float
Ionized impurity density [1/nm³].
- property delx: float
Spatial grid spacing [nm].
- property delk: float
Momentum grid spacing [1/nm].
- property size: int
Total Wigner phase-space dimension (nx × n).
- with_bias(bias)[source]
Set the applied bias voltage.
- Parameters:
bias (float)
- Return type:
LWWConfig
- with_temperature(temperature)[source]
Set operating temperature and return self.
- Parameters:
temperature (float)
- Return type:
LWWConfig
- with_grid(nx, n)[source]
Set grid resolution and return self.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- with_exchange(exchange)[source]
Set density-dependent exchange correction.
- Parameters:
exchange (bool)
- Return type:
LWWConfig
- with_verbose(verbose)[source]
Enable/disable verbose output.
- Parameters:
verbose (bool)
- Return type:
LWWConfig
- classmethod quick_test(nx=16, n=16)[source]
Small-grid configuration for unit tests and smoke tests.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- classmethod standard_rtd()[source]
Standard resonant tunneling diode at 77K.
Reproduces the reference 1D RTD LWW configuration. - GaAs at 77K - Full resolution (86×72 grid) - Double-barrier QW geometry
- Return type:
LWWConfig
- classmethod room_temperature_rtd()[source]
RTD configuration at 300 K.
- Return type:
LWWConfig
- classmethod coarse_grid_rtd(nx=32, n=32)[source]
Coarse-grid RTD configuration for parameter sweeps.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- classmethod fine_grid_rtd(nx=128, n=96)[source]
High-resolution RTD configuration.
- Parameters:
nx (int)
n (int)
- Return type:
LWWConfig
- classmethod narrow_well_rtd()[source]
RTD configuration with a 25 nm quantum well.
- Return type:
LWWConfig
- classmethod wide_well_rtd()[source]
RTD configuration with a 75 nm quantum well.
- Return type:
LWWConfig
- class lww_transport.config_refactored.MaterialParams(c=2997.92458, rmo=0.0568567517, rm=0.0667, temp=77.0, rhc=1973.29, re=2.0, rno=1e-06, ri=0.3, chemp=0.0863814)[source]
Bases:
objectPhysical constants and semiconductor band structure.
Defaults are for GaAs-like material at T=77K.
- Parameters:
c (float) – Speed of light [nm/ps]. Default 2997.92.
rmo (float) – Effective mass ratio. Default 0.0569.
rm (float) – Effective mass scaling. Default 0.0667.
temp (float) – Temperature [K]. Default 77.0 K.
rhc (float) – ℏc product [eV·nm]. Default 1973.29.
re (float) – Electron density scaling. Default 2.0.
rno (float) – Nominal doping density [1/nm³]. Default 1e-6.
ri (float) – Ionized impurity ratio. Default 0.3.
chemp (float) – Equilibrium chemical potential [eV]. Default 0.0864 (at 77K).
- c: float
- rmo: float
- rm: float
- temp: float
- rhc: float
- re: float
- rno: float
- ri: float
- chemp: float
- class lww_transport.config_refactored.OperatingConditions(bias=0.0, temperature=77.0)[source]
Bases:
objectBias voltage and thermal settings.
- Parameters:
bias (float) – Applied bias voltage [V]. Default 0.0 V (zero bias).
temperature (float) – Operating temperature [K]. Default 77.0 K (liquid nitrogen).
- bias: float
- temperature: float
- class lww_transport.config_refactored.SolverParams(irlx=4, relaxation_tau=525.5074, hbar_like=0.6582186934, convergence_eps=7e-10, poisson_vmax_stop=0.001, density_stop=3e-09, exchange=False, rfa=650.0)[source]
Bases:
objectConvergence and numerical method settings.
- Parameters:
irlx (int) – Relaxation type flag. Default 4.
relaxation_tau (float) – Relaxation time parameter [ps]. Default 525.51.
hbar_like (float) – Planck constant scaling factor. Default 0.6582.
convergence_eps (float) – Density convergence threshold. Default 7e-10. Smaller values tighten convergence and increase runtime.
poisson_vmax_stop (float) – Potential convergence criterion [eV]. Default 0.001.
density_stop (float) – Density convergence criterion [1/nm³]. Default 3e-9.
exchange (bool) – Include optional density-dependent exchange correction. Default False.
rfa (float) – Relaxation factor for Poisson solver. Default 650.0.
- irlx: int
- relaxation_tau: float
- hbar_like: float
- convergence_eps: float
- poisson_vmax_stop: float
- density_stop: float
- exchange: bool
- rfa: float
- lww_transport.config_refactored.format_config_summary(cfg, extra=None)[source]
Return a human-readable summary of the configuration.
Examples
>>> cfg = LWWConfig.standard_rtd() >>> print(format_config_summary(cfg))
- Parameters:
cfg (LWWConfig)
extra (Mapping[str, object] | None)
- Return type:
str
- lww_transport.config_refactored.print_config_summary(cfg, extra=None)[source]
Print a human-readable summary of the configuration.
- Parameters:
cfg (LWWConfig)
extra (Mapping[str, object] | None)
- Return type:
None
- lww_transport.config_refactored.save_config_summary(cfg, output_dir, filename='config_summary.txt', extra=None)[source]
Save the human-readable configuration summary and return its path.
- Parameters:
cfg (LWWConfig)
output_dir (str | Path)
filename (str)
extra (Mapping[str, object] | None)
- Return type:
Path
Simulator
- class lww_transport.simulator.SimulationState(rvs: 'np.ndarray', f: 'np.ndarray', fr: 'np.ndarray', fo: 'np.ndarray', density_previous: 'np.ndarray', current_or_density: 'np.ndarray')[source]
Bases:
object- Parameters:
rvs (ndarray)
f (ndarray)
fr (ndarray)
fo (ndarray)
density_previous (ndarray)
current_or_density (ndarray)
- rvs: ndarray
- f: ndarray
- fr: ndarray
- fo: ndarray
- density_previous: ndarray
- current_or_density: ndarray
- class lww_transport.simulator.SteadyStateResult(state: 'SimulationState', density: 'np.ndarray', current: 'np.ndarray', iterations: 'int', converged: 'bool', max_density_change: 'float', max_potential_update: 'float')[source]
Bases:
object- Parameters:
state (SimulationState)
density (ndarray)
current (ndarray)
iterations (int)
converged (bool)
max_density_change (float)
max_potential_update (float)
- state: SimulationState
- density: ndarray
- current: ndarray
- iterations: int
- converged: bool
- max_density_change: float
- max_potential_update: float
- class lww_transport.simulator.TransientResult(state: 'SimulationState', bias_currents: 'dict[float, pd.DataFrame]')[source]
Bases:
object- Parameters:
state (SimulationState)
bias_currents (dict[float, DataFrame])
- state: SimulationState
- bias_currents: dict[float, DataFrame]
- class lww_transport.simulator.LWW1DSimulator(config=None)[source]
Bases:
objectOne-dimensional LWW simulation workflow.
- Parameters:
config (LWWConfig | None)
- config_summary(extra=None)[source]
Return a human-readable summary for the simulator configuration.
- Parameters:
extra (dict[str, object] | None)
- Return type:
str
- print_config_summary(extra=None)[source]
Print a human-readable summary for the simulator configuration.
- Parameters:
extra (dict[str, object] | None)
- Return type:
None
- save_config_summary(output_dir, filename='config_summary.txt', extra=None)[source]
Save the simulator configuration summary next to simulation output.
- Parameters:
output_dir (str | Path)
filename (str)
extra (dict[str, object] | None)
- Return type:
Path
- initial_zero_bias_state(exchange=None)[source]
Compute the zero-bias initial Wigner state.
- Parameters:
exchange (bool | None)
- Return type:
- solve_steady_state(bias=0.0, dbias=0.1, max_iterations=200, initial_state=None, exchange=None)[source]
Run the self-consistent steady-state Wigner-Poisson loop.
- Parameters:
bias (float)
dbias (float)
max_iterations (int)
initial_state (SimulationState | None)
exchange (bool | None)
- Return type:
- run_transient(state, ivn=45, itn=1000, dbias=0.008, exchange=None, sample_every=10, progress_every=50, output_dir=None, transient_prefix='lww_tcurl', state_prefix='lww')[source]
Run the transient bias sweep.
When
cfg.verboseis true, print flushed progress lines at the start and end of each bias point and everyprogress_everyiterations. Ifoutput_diris supplied, transient current trace CSV files are written incrementally as samples are produced, and state checkpoint files are refreshed after each completed bias point.- Parameters:
state (SimulationState)
ivn (int)
itn (int)
dbias (float)
exchange (bool | None)
sample_every (int)
progress_every (int | None)
output_dir (str | Path | None)
transient_prefix (str)
state_prefix (str)
- Return type:
- save_state(state, output_dir, prefix='lww')[source]
Write state arrays in the legacy CSV format.
- Parameters:
state (SimulationState)
output_dir (str | Path)
prefix (str)
- Return type:
None
- load_state(input_dir, prefix='lww')[source]
Load state arrays from the legacy CSV format.
- Parameters:
input_dir (str | Path)
prefix (str)
- Return type:
- save_transient(result, output_dir, prefix='lww_tcurl')[source]
- Parameters:
result (TransientResult)
output_dir (str | Path)
prefix (str)
- Return type:
None
Core numerical routines
Optimized core routines for the 1D Lattice Weyl-Wigner / Wigner-Poisson model.
Implementation notes: - solve the Wigner linear system directly with LAPACK band storage - avoid converting band matrices to dense Nx*N by Nx*N arrays - vectorize Fermi boundaries, current/density, Poisson charge sums, and potential coefficients - cache kinetic stencil and sine matrix used in the non-local potential
- class lww_transport.core.Params(Nx: 'int' = 86, N: 'int' = 72, c: 'float' = 2997.92458, rmo: 'float' = 0.0568567517, rm: 'float' = 0.0667, temp: 'float' = 77.0, rhc: 'float' = 1973.29, re: 'float' = 2.0, rno: 'float' = 1e-06, ri: 'float' = 0.3, box: 'float' = 550.0, well: 'float' = 50.0, barrier: 'float' = 30.0, spacer: 'float' = 30.0, pot: 'float' = 0.3, chemp: 'float' = 0.0863814)[source]
Bases:
object- Parameters:
Nx (int)
N (int)
c (float)
rmo (float)
rm (float)
temp (float)
rhc (float)
re (float)
rno (float)
ri (float)
box (float)
well (float)
barrier (float)
spacer (float)
pot (float)
chemp (float)
- Nx: int = 86
- N: int = 72
- c: float = 2997.92458
- rmo: float = 0.0568567517
- rm: float = 0.0667
- temp: float = 77.0
- rhc: float = 1973.29
- re: float = 2.0
- rno: float = 1e-06
- ri: float = 0.3
- box: float = 550.0
- well: float = 50.0
- barrier: float = 30.0
- spacer: float = 30.0
- pot: float = 0.3
- chemp: float = 0.0863814
- property rmass: float
- property bbeta: float
- property dens: float
- property densi: float
- property delx: float
- property delk: float
- property x: ndarray
- class lww_transport.core.WignerSolveWorkspace(n, nx, lower_upper, lapack_ab, rhs, rvs_work)[source]
Bases:
objectReusable buffers for the Wigner banded solve.
The LAPACK buffer uses
dgbsvstorage directly. Its lower view has the same shape as SciPy’s compact band format, so the existing assembly kernels can fill it while LAPACK can factor the full buffer without another matrix allocation/copy insidesolve_banded.- Parameters:
n (int)
nx (int)
lower_upper (int)
lapack_ab (ndarray)
rhs (ndarray)
rvs_work (ndarray)
- n: int
- nx: int
- lower_upper: int
- lapack_ab: ndarray
- rhs: ndarray
- rvs_work: ndarray
- property band: ndarray
- lww_transport.core.band_to_agb(a, params=None)[source]
Convert dense square matrix to LAPACK/SciPy general band storage.
- Parameters:
a (ndarray)
params (Params | None)
- Return type:
ndarray
- lww_transport.core.agb_to_band(agb, params=None)[source]
Convert LAPACK/SciPy general band storage to a dense square matrix.
- Parameters:
agb (ndarray)
params (Params | None)
- Return type:
ndarray
- lww_transport.core.integral(x_grid, y, axis=0)[source]
- Parameters:
x_grid (ndarray)
y (ndarray)
axis (int)
- Return type:
ndarray
- lww_transport.core.get_exchange(rho, x_grid=None)[source]
- Parameters:
rho (ndarray)
x_grid (ndarray | None)
- Return type:
ndarray
- lww_transport.core.get_hartree(rho, x_grid, eps=0.1)[source]
- Parameters:
rho (ndarray)
x_grid (ndarray)
eps (float)
- Return type:
ndarray
- lww_transport.core.aicalc(rvs, ai=None, n=72, nx=86, i=1, params=None)[source]
Vectorized non-local potential coefficient for one 1-based spatial index i.
- Parameters:
rvs (ndarray)
ai (ndarray | None)
n (int)
nx (int)
i (int)
params (Params | None)
- Return type:
ndarray
- lww_transport.core.potential(external_rvs, rho, n=72, nx=86, exchange=False, params=None, use_numba=True, kernel_backend='auto')[source]
Return potential matrix directly in banded storage: shape (4*n+1, n*nx).
- Parameters:
external_rvs (ndarray)
rho (ndarray)
n (int)
nx (int)
exchange (bool)
params (Params | None)
use_numba (bool | None)
kernel_backend (str)
- Return type:
ndarray
- lww_transport.core.arelax(S, b, n=72, nx=86, params=None, use_numba=True, kernel_backend='auto')[source]
Relaxation/scattering band matrix. No debug printing.
- Parameters:
S (ndarray)
b (ndarray)
n (int)
nx (int)
params (Params | None)
use_numba (bool | None)
kernel_backend (str)
- Return type:
ndarray
- lww_transport.core.scattering(b, n=72, nx=86, params=None, use_numba=True, kernel_backend='auto')[source]
- Parameters:
b (ndarray)
n (int)
nx (int)
params (Params | None)
use_numba (bool | None)
kernel_backend (str)
- Return type:
ndarray
- lww_transport.core.tridag(a, b, c, r, nx)[source]
Thomas algorithm for tridiagonal systems.
- Parameters:
a (ndarray)
b (ndarray)
c (ndarray)
r (ndarray)
nx (int)
- Return type:
ndarray
Visualization helpers
Visualization helpers for LWW device geometry and phase-space data.
- class lww_transport.visualization.GeometryRegion(name, start_nm, end_nm, potential_ev, kind)[source]
Bases:
objectNamed interval in the one-dimensional RTD structure.
- Parameters:
name (str)
start_nm (float)
end_nm (float)
potential_ev (float)
kind (str)
- name: str
- start_nm: float
- end_nm: float
- potential_ev: float
- kind: str
- property width_nm: float
- lww_transport.visualization.geometry_potential_profile(cfg=None, points=1200)[source]
Return a piecewise RTD geometry potential profile.
- Parameters:
cfg (LWWConfig | None)
points (int)
- Return type:
tuple[ndarray, ndarray]
- lww_transport.visualization.plot_rtd_geometry(cfg=None, ax=None, show_labels=True, title='Resonant tunneling diode geometry')[source]
Draw the one-dimensional RTD geometry and return the Matplotlib axes.
- Parameters:
cfg (LWWConfig | None)
show_labels (bool)
title (str | None)
- lww_transport.visualization.plot_wigner_phase_space(wigner, cfg=None, ax=None, figsize=(9.0, 6.4), x=None, k=None, title='Wigner phase-space distribution', style='standard', x_unit='um', centered_x=True, scale=1.0, normalize=False, x_lim=None, k_lim=None, z_lim=None, x_buffer=None, k_buffer=None, z_buffer=None, surface_cmap=None, contour_cmap=None, x_projection_cmap='Reds', y_projection_cmap='Blues', contour_levels=40, contour_offset=None, surface_alpha=None, z_projection_alpha=None, x_projection_alpha=None, y_projection_alpha=None, z_projection=True, x_projection=None, y_projection=None, colorbar=None, colorbar_label=None, colorbar_shrink=0.72, colorbar_pad=0.08, colorbar_aspect=18, x_projection_offset=None, y_projection_offset=None, surface_edgecolor='none', surface_linewidth=0.0, transparent_panes=None, show_grid=None, x_label=None, k_label=None, z_label=None, box_aspect=(1.35, 1.0, 0.72), stride=1, elev=None, azim=None)[source]
Draw a 3D Wigner phase-space surface with a contour projection.
wignermay be a flattened simulator vector, a(nx, n)matrix, or a CSV file containing either form. Flattened vectors requirecfgso the phase-space dimensions can be restored.- Parameters:
wigner (str | PathLike[str] | ndarray)
cfg (LWWConfig | None)
figsize (tuple[float, float])
x (Sequence[float] | None)
k (Sequence[float] | None)
title (str | None)
style (str)
x_unit (str)
centered_x (bool)
scale (float)
normalize (bool)
x_lim (tuple[float, float] | None)
k_lim (tuple[float, float] | None)
z_lim (tuple[float, float] | None)
x_buffer (float | tuple[float, float] | None)
k_buffer (float | tuple[float, float] | None)
z_buffer (float | tuple[float, float] | None)
surface_cmap (str | None)
contour_cmap (str | None)
x_projection_cmap (str)
y_projection_cmap (str)
contour_levels (int)
contour_offset (float | None)
surface_alpha (float | None)
z_projection_alpha (float | None)
x_projection_alpha (float | None)
y_projection_alpha (float | None)
z_projection (bool)
x_projection (bool | None)
y_projection (bool | None)
colorbar (bool | None)
colorbar_label (str | None)
colorbar_shrink (float)
colorbar_pad (float)
colorbar_aspect (int)
x_projection_offset (float | None)
y_projection_offset (float | None)
surface_edgecolor (str)
surface_linewidth (float)
transparent_panes (bool | None)
show_grid (bool | None)
x_label (str | None)
k_label (str | None)
z_label (str | None)
box_aspect (tuple[float, float, float] | None)
stride (int)
elev (float | None)
azim (float | None)
- lww_transport.visualization.rtd_geometry_regions(cfg=None)[source]
Return emitter/spacer/barrier/well/collector regions for the RTD.
- Parameters:
cfg (LWWConfig | None)
- Return type:
list[GeometryRegion]
- lww_transport.visualization.save_rtd_geometry_image(cfg=None, path='rtd_geometry.png', dpi=160, show_labels=True, title='Resonant tunneling diode geometry')[source]
Save a PNG image of the RTD geometry and return its path.
- Parameters:
cfg (LWWConfig | None)
path (str | Path)
dpi (int)
show_labels (bool)
title (str | None)
- Return type:
Path
- lww_transport.visualization.save_wigner_phase_space_image(wigner, path='wigner_phase_space.png', cfg=None, dpi=170, **plot_kwargs)[source]
Save a 3D Wigner phase-space image and return its path.
- Parameters:
wigner (str | PathLike[str] | ndarray)
path (str | Path)
cfg (LWWConfig | None)
dpi (int)
- Return type:
Path
- lww_transport.visualization.save_wigner_phase_space_images(wigners, output_dir, cfg=None, prefix='wigner_phase_space', extension='png', dpi=170, **plot_kwargs)[source]
Save phase-space images for multiple Wigner distributions.
- Parameters:
wigners (Mapping[object, str | PathLike[str] | ndarray] | Sequence[str | PathLike[str] | ndarray])
output_dir (str | Path)
cfg (LWWConfig | None)
prefix (str)
extension (str)
dpi (int)
- Return type:
list[Path]
- lww_transport.visualization.wigner_phase_space_grids(cfg=None, shape=None, centered_x=True, x_unit='um')[source]
Return spatial and wave-vector axes for Wigner phase-space plots.
- Parameters:
cfg (LWWConfig | None)
shape (tuple[int, int] | None)
centered_x (bool)
x_unit (str)
- Return type:
tuple[ndarray, ndarray]
Linear algebra helpers
- lww_transport.linalg.band_to_agb(a, n, nx)[source]
Convert a dense matrix to general band storage.
- Parameters:
a (ndarray)
n (int)
nx (int)
- Return type:
ndarray