This is a 2D, feedback-loop-first counterpart to the 3D STM scene: instead of rendering an atomic lattice in perspective, it numerically integrates the same tunneling law and draws two flat, literal 2D plots — a top-down topographic image and a real-time line-scan chart — from a PI (proportional–integral) controller that has to fight the exponential in real time, ringing included.
I(d,V) ∝ V · exp(-2κd), κ ≈ 0.51·√φ[eV] (Å⁻¹)
error e = (I − I_set) / I_set
z ← z + (K_p·e + K_i·∫e dt) · dt
Unlike a closed-form "snap to the right height" shortcut, the tip height z here is only ever pushed by that PI law, substepped every animation frame. Cranking feedback gain up doesn't just image faster — past a threshold the loop overshoots the true surface height at every step edge and rings before settling, exactly the artifact real STM operators tune around.
- Work function φ sets the decay constant κ — a bigger barrier makes the current fall off faster per Ångström of gap, so the tip must ride closer for the same setpoint.
- Bias voltage V scales the current linearly (I ∝ V); doubling it doubles the measured current at a fixed gap without changing the tip's standoff distance.
- Feedback gain is the PI controller's Kp/Ki pair, scaled together — low gain tracks slowly but smoothly, high gain tracks fast but overshoots and rings at sharp features.
- Constant-height mode freezes the tip at a fixed reference gap and lets the current itself vary — faster, but the line-scan chart shows just how much the raw current swings over the step and bump.
Real-world relevance: production STM controllers are tuned exactly this way — too little gain and the scan crawls or clips the tip on rough terrain, too much and every atomic step edge leaves a ringing artifact in the topography, a trade-off every real STM operator dials in by hand.