Skip to main content

nanohub-padre

A Python library for creating and running PADRE semiconductor device simulations.

Overview

nanohub-padre provides a Pythonic interface to generate PADRE input decks, making it easier to set up complex device simulations programmatically. PADRE is a 2D/3D device simulator that solves the drift-diffusion equations for semiconductor devices.

Features

  • Pythonic Interface: Define meshes, regions, doping profiles, and solver settings using Python objects
  • Device Factory Functions: Pre-built functions to create common devices (PN/PIN diode, NIN/PIP isotype diode, MOSFET, BJT, solar cell, etc.)
  • Complete PADRE Support: Covers mesh generation, material properties, physical models, and solve commands
  • Validation: Built-in parameter validation and helpful error messages
  • Examples: Ready-to-run examples for common device structures

Installation

pip install nanohub-padre

Or install from source:

git clone https://github.com/denphi/nanohub-padre.git
cd nanohub-padre
pip install -e .

Quick Start

from nanohubpadre import create_mosfet, Solve, Log

# Create an NMOS transistor with one line
sim = create_mosfet(
    channel_length=0.05,
    device_type="nmos",
    temperature=300
)

# Add solve commands
sim.add_solve(Solve(initial=True))
sim.add_log(Log(ivfile="idvg"))
sim.add_solve(Solve(v3=0, vstep=0.1, nsteps=15, electrode=3))

# Generate the input deck
print(sim.generate_deck())

Building from Scratch

from nanohubpadre import (
    Simulation, Mesh, Region, Electrode, Doping,
    Contact, Models, System, Solve
)

# Create simulation
sim = Simulation(title="Simple PN Diode")

# Define mesh
sim.mesh = Mesh(nx=100, ny=3)
sim.mesh.add_x_mesh(1, 0)
sim.mesh.add_x_mesh(100, 1.0)
sim.mesh.add_y_mesh(1, 0)
sim.mesh.add_y_mesh(3, 1)

# Define silicon region
sim.add_region(Region(1, ix_low=1, ix_high=100, iy_low=1, iy_high=3, silicon=True))

# Define electrodes
sim.add_electrode(Electrode(1, ix_low=1, ix_high=1, iy_low=1, iy_high=3))
sim.add_electrode(Electrode(2, ix_low=100, ix_high=100, iy_low=1, iy_high=3))

# Define doping
sim.add_doping(Doping(p_type=True, concentration=1e17, uniform=True, x_right=0.5))
sim.add_doping(Doping(n_type=True, concentration=1e17, uniform=True, x_left=0.5))

# Set contacts
sim.add_contact(Contact(all_contacts=True, neutral=True))

# Configure models
sim.models = Models(temperature=300, srh=True, conmob=True, fldmob=True)
sim.system = System(electrons=True, holes=True, newton=True)

# Solve
sim.add_solve(Solve(initial=True))

# Generate and print the input deck
print(sim.generate_deck())

Device Factory Functions

The library includes factory functions for common devices:

Function Description
create_pn_diode PN junction diode (PIN with intrinsic_width)
create_nin_diode NIN/PIP isotype diode — unipolar, non-rectifying
create_mos_capacitor MOS capacitor for C-V analysis
create_mosfet NMOS/PMOS transistor
create_mesfet Metal-semiconductor FET
create_bjt NPN/PNP bipolar transistor
create_schottky_diode Schottky barrier diode
create_solar_cell PN junction solar cell

Examples

Tutorial notebooks (examples/notebooks/)

A twelve-part course that puts every device's textbook theory side by side with a PADRE simulation and states, each time, what differs and why (constants, approximations, 2-D effects, simulator limitations). The analytic formulas use PADRE's own material constants, so remaining differences are physics.

Notebook Topic
00 Introduction drift-diffusion equations, units, textbook vs PADRE constants
01 Library Overview building a deck by hand and with factories; six ways a simulation silently goes wrong
02 PN Diode V_bi, depletion approximation, Shockley short/long base, SRH n→2, generation current
03 Schottky Diode Schottky–Mott, thermionic emission vs Crowell–Sze, Richardson plot
04 MOSFET V_T definitions, swing, DIBL, mobility, velocity saturation, 1/L scaling
05 BJT Gummel numbers, band-gap narrowing and β, Early voltage
06 MOS Capacitor exact classical C-V, C_min, quasi-static LF C-V, flat-band shifts
07 MESFET gradual-channel model, pinch-off and the L_g/a rule
08 NIN / PIP Diode Ohm's law vs Mott–Gurney space-charge-limited current
09 Validating a Simulator n_i, mobility, v_sat, drive-force artefact, mesh convergence, noise floor
10 pntoy Band Diagrams the nanoHUB pntoy diode: textbook band diagram at low bias; high injection, ohmic drop and the V_bi wall at high bias
11 Keeping the Textbook Picture doping, length, area, lifetime and temperature vs the bias range where the textbook band diagram holds

Device scripts (examples/devices/)

Short, runnable companions to the notebooks (pn_diode, schottky_diode, mosfet, bjt, mos_capacitor, mesfet, nin_diode, solar_cell). Each builds the default device, runs PADRE if it is on your PATH (otherwise prints the input deck), and prints the key textbook-vs-PADRE comparisons:

python examples/devices/pn_diode_example.py

Deck translations (examples/*.py)

Python equivalents of classic PADRE input decks (pndiode.py, moscap.py, mosfet_equivalent.py, mesfet.py, single_mosgap.py), each paired with its .in file:

PYTHONPATH=. python3 examples/pndiode.py > pndiode.inp
padre < pndiode.inp > pndiode.out

Supported Commands

nanohub-padre supports all major PADRE commands:

Category Commands
Mesh MESH, X.MESH, Y.MESH, Z.MESH
Structure REGION, ELECTRODE
Doping DOPING (uniform, Gaussian, ERFC, file)
Boundaries CONTACT, INTERFACE, SURFACE
Materials MATERIAL, ALLOY
Models MODELS
Solver SYSTEM, METHOD, LINALG, SOLVE
Output LOG, PLOT.1D, PLOT.2D, PLOT.3D, CONTOUR, VECTOR
Control OPTIONS, LOAD, REGRID, ADAPT

Documentation

Full documentation is available at https://nanohub-padre.readthedocs.io/

Testing

Run the test suite:

pytest tests/ -v

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for nanohub-padre 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanohub-padre 0.0.12
File Size Uploaded Provenance
nanohub_padre-0.0.12.tar.gz 168.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nanohub-padre 0.0.12
File Interpreter ABI Platform
nanohub_padre-0.0.12-py3-none-any.whl Python 3 none any Details

Total release size: 334.0 kB

Release files / nanohub_padre-0.0.12.tar.gz

Download URL nanohub_padre-0.0.12.tar.gz
Size 168.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1046afffbde0886ba9c1f15542ad38390d6fd3e24d7d460d7be8e9abc537ec98
BLAKE2b-256 checksum
How to use checksums
bd774d6d2f6b018625174725ed5a0913746a81114cc9062296c79cd115969f10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / nanohub_padre-0.0.12-py3-none-any.whl

Download URL nanohub_padre-0.0.12-py3-none-any.whl
Size 165.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b123179d5e227d0f2391cea42d368f1249accf3f78f4ff17dbbedac398e1756c
BLAKE2b-256 checksum
How to use checksums
d6c1838078b7c2705f3c6ee591e0fa98fe8c15d6cbd867e154372a28873faadd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for nanohub-padre 0.0.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page