Skip to main content

Idealized 1D quantum tunneling solver with 4 classic test cases

Project description

1d-qt-ideal-solver: 1D Quantum Tunneling Solver

DOI Python License: MIT Numba PyPI

High-performance 1D quantum tunneling solver with absorbing boundary conditions. Implements split-operator Fourier method with Numba acceleration.

Physics

Solves the time-dependent Schrödinger equation:

$$i\frac{\partial \psi}{\partial t} = \hat{H}\psi = \left[-\frac{1}{2}\nabla^2 + V(x,t)\right]\psi$$

Split-operator evolution with absorbing boundaries:

$$\psi(x, t+\delta t) = \mathcal{M}_{\text{abs}} \cdot e^{-iV\delta t/2} \cdot \mathcal{F}^{-1}\left[e^{-ik^2\delta t/2}\mathcal{F}[\psi]\right] \cdot e^{-iV\delta t/2}$$

Absorbing mask:

$$\mathcal{M}(x) = \begin{cases} 1 - s\left[1 - \cos^4\left(\frac{\pi i}{2n_b}\right)\right] & \text{left boundary} \ 1 & \text{safe zone} \ 1 - s\left[1 - \cos^4\left(\frac{\pi(N-i)}{2n_b}\right)\right] & \text{right boundary} \end{cases}$$

Observables:

  • Transmission coefficient: $T$
  • Reflection coefficient: $R$
  • Absorbed probability: $A$
  • Conservation: $T + R + A \approx 1$

Features

  • Absorbing boundary conditions prevent spurious reflections
  • Adaptive time stepping
  • Numba JIT compilation
  • Stochastic environments with noise and decoherence
  • Visualization with zone highlighting
  • NetCDF4 output

Installation

# From PyPI
pip install 1d-qt-ideal-solver

# From source
git clone https://github.com/sandyherho/1d-qt-ideal-solver.git
cd 1d-qt-ideal-solver
pip install -e .

Quick Start

Command line:

# Run single case
qt1d-simulate case1

# Run both cases
qt1d-simulate --all

# Custom parameters
qt1d-simulate case1 --boundary-width 3.0 --cores 8

Python API:

from qt1d_ideal import QuantumTunneling1D, GaussianWavePacket

# Initialize solver
solver = QuantumTunneling1D(
    nx=2048, 
    x_min=-30.0,
    x_max=30.0,
    boundary_width=3.0,
    boundary_strength=0.03
)

# Create initial wavepacket
psi0 = GaussianWavePacket(x0=-8.0, k0=4.0, sigma=0.8)(solver.x)

# Define barrier
V = solver.rectangular_barrier(height=4.5, width=1.0)

# Solve
result = solver.solve(psi0=psi0, V=V, t_final=6.0, n_snapshots=200)

# Results
T = result['transmission_coefficient']
R = result['reflection_coefficient']
A = result['absorbed_probability']
print(f"T = {T:.4f}, R = {R:.4f}, A = {A:.4f}, T+R+A = {T+R+A:.4f}")

Test Cases

Case Barrier Type Height Width Domain
1 Rectangular 4.5 eV 1.0 nm ±30 nm
2 Gaussian 4.0 eV 0.8 nm ±30 nm

Configuration

Key parameters (see configs/ for examples):

# Spatial grid
nx = 2048
x_min = -30.0
x_max = 30.0

# Time integration
t_final = 6.0
n_snapshots = 200

# Absorbing boundaries
boundary_width = 3.0
boundary_strength = 0.03

# Environment
noise_amplitude = 0.0
decoherence_rate = 0.0

Output

Generated files:

  • outputs/*.nc - NetCDF4 with wavefunction data
  • outputs/*.gif - Animated visualization
  • logs/*.log - Simulation diagnostics

Reading NetCDF data:

import netCDF4 as nc

data = nc.Dataset('outputs/case1_rectangular_barrier.nc')
x = data['x'][:]
t = data['t'][:]
psi_real = data['psi_real'][:, :]
psi_imag = data['psi_imag'][:, :]
probability = data['probability'][:, :]
potential = data['potential'][:]

T = data.transmission
R = data.reflection
A = data.absorbed

Advanced Usage

Custom Barriers

# Double barrier
V = solver.double_barrier(height=4.0, width=0.5, separation=2.0)

# Triple barrier
V = solver.triple_barrier(height=3.0, width=0.5, separation=1.5)

# Custom potential
V = 5.0 * (1.0 - np.tanh((solver.x + 2.0) / 0.5)) * \
          (1.0 + np.tanh((solver.x - 2.0) / 0.5))

Environmental Effects

# Stochastic potential
result = solver.solve(
    psi0=psi0, V=V, t_final=6.0,
    noise_amplitude=0.01,
    noise_correlation_time=0.5
)

# Pure dephasing
result = solver.solve(
    psi0=psi0, V=V, t_final=6.0,
    decoherence_rate=0.0001
)

Citation

@software{qt1d_solver_2025,
  author = {Kaban, Siti N. and Herho, Sandy H. S. and 
            Prayogo, Sonny and Anwar, Iwan P.},
  title = {1D Quantum Tunneling Solver with Absorbing Boundaries},
  year = {2025},
  version = {0.0.5},
  url = {https://github.com/sandyherho/1d-qt-ideal-solver},
  doi = {10.5281/zenodo.17299767},
  license = {MIT}
}

Authors

License

MIT License - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

1d_qt_ideal_solver-0.0.5.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

1d_qt_ideal_solver-0.0.5-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file 1d_qt_ideal_solver-0.0.5.tar.gz.

File metadata

  • Download URL: 1d_qt_ideal_solver-0.0.5.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64

File hashes

Hashes for 1d_qt_ideal_solver-0.0.5.tar.gz
Algorithm Hash digest
SHA256 44ca95dc7f230dab30b78ecd7edbd584638023a4dab91b4172a9454cafe37ba5
MD5 a50431ef5d445d84fadb20b1fc4f761a
BLAKE2b-256 605f9c1c96712bf4ef1d0bf8b5fe1e68ea8565073855cdb0a1d901e4ae49fa53

See more details on using hashes here.

File details

Details for the file 1d_qt_ideal_solver-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: 1d_qt_ideal_solver-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64

File hashes

Hashes for 1d_qt_ideal_solver-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b673ea86093feff87e4453f25701db711d2179bfa80702764db739ff0ea9d40f
MD5 bf62dc6f9d7bd7fb49afd9b5d1752e15
BLAKE2b-256 968641772b782fb1805be856a33b6de5a320b32576951ad9b50ea0a44411aaee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page