-
Notifications
You must be signed in to change notification settings - Fork 1
Add planar/FinFET/nanoribbon device geometry support #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
reneotten
merged 1 commit into
claude/negf-dense-recursive-switch-parallel
from
claude/multigate-geometry-support
Jul 25, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| //! Demonstrates the planar/FinFET/nanoribbon presets and the textbook | ||
| //! result they're expected to reproduce: at a fixed (short) channel | ||
| //! length, more gates means better electrostatic control and a | ||
| //! subthreshold swing closer to the ideal thermal limit | ||
| //! (`ln(10)*kT/e = 59.6 mV/decade` at 300 K). | ||
| //! | ||
| //! Run with `cargo run --release --example geometry_comparison -p | ||
| //! negforge-core`. Numbers from this example are quoted in the top-level | ||
| //! README's "Planar, FinFET and nanoribbon devices" section. | ||
|
|
||
| use negforge_core::sweep::{subthreshold_swing, sweep_v_g}; | ||
| use negforge_core::{Device, DeviceParams}; | ||
|
|
||
| fn report(name: &str, mut params: DeviceParams, l_ch: f64) { | ||
| params.l_ch = l_ch; | ||
| params.v_ds = 0.3; | ||
| let dev = Device::new(params); | ||
| let points = sweep_v_g(&dev, 0.0, 0.4, 0.02, None).unwrap(); | ||
| let s = subthreshold_swing(&points, 0.0, 0.4); | ||
| println!( | ||
| "{name:<11} lambda={:>6.3} nm S={:>6.1} mV/decade", | ||
| dev.lambda, | ||
| s * 1000.0 | ||
| ); | ||
| } | ||
|
|
||
| fn main() { | ||
| println!("(ideal thermal limit at 300 K: 59.6 mV/decade)\n"); | ||
| for l_ch in [10.0, 20.0, 40.0] { | ||
| println!("=== l_ch = {l_ch} nm ==="); | ||
| report("planar", DeviceParams::planar(), l_ch); | ||
| report("fin_fet", DeviceParams::fin_fet(), l_ch); | ||
| report("nanoribbon", DeviceParams::nanoribbon(), l_ch); | ||
| println!(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and the
d_ecase is worse than "unbounded loop" suggests — it's a hang, not an error.calc_currentcomputes((e_max - psi_0) / d_e).floor().max(0.0) as usizeand then iterates0..=n_steps. Rust's float-to-int casts saturate, sod_e = 0.0givesinf as usize == usize::MAXand the loop runs ~1.8e19 iterations with no allocation and no panic to stop it.epsilon = 0.0reaches the same place by a different route:epsilon.ln()is-inf, soe_maxis+inf. The same pattern appears innegf_currentand in the self-consistent loop's energy grid.t <= 0is less dramatic but still wrong: it divides by zero in the Fermi functions, givingf = 0everywhere and a silent zero current rather than an error.So the three additions to
validate_paramsare worth having, withepsilonneeding0 < epsilon < 1specifically (it is a Fermi-function tolerance, andlnof anything>= 1putse_maxat or belowe_fs, collapsing the integration window).m_effis the fourth of its kind — it divides intot_hop.Not changing it here (this is #3's branch), but noting for sequencing: #5 will be rebased on top of this branch, so
validate_paramsis where its grid-size and cross-section checks will land too.Generated by Claude Code