Skip to main content

Options

Struct Options 

Source
pub struct Options {
Show 35 fields pub compat: Compat, pub reltol: f64, pub abstol: f64, pub vntol: f64, pub gmin: f64, pub itl1: usize, pub itl2: usize, pub itl4: usize, pub gminsteps: usize, pub srcsteps: usize, pub temp: f64, pub tnom: f64, pub pivtol: f64, pub pivrel: f64, pub noopiter: bool, pub trtol: f64, pub chgtol: f64, pub method: Option<Method>, pub maxord: usize, pub nopage: bool, pub defl: f64, pub defw: f64, pub defad: f64, pub defas: f64, pub max_tran_steps: Option<usize>, pub ltra_break_rate: Option<usize>, pub ltra_fit: bool, pub tmax_divisor: Option<f64>, pub seed: u64, pub notrnoise: bool, pub dev_noise: bool, pub dev_noise_step: Option<f64>, pub load_threads: usize, pub keepopinfo: bool, pub trytocompact: bool,
}

Fields§

§compat: Compat

The defaults profile: what an analysis does where the fields below leave it the choice (Options::method), and whether a transient locates switch events.

§reltol: f64

RELTOL, default 1e-3.

§abstol: f64

ABSTOL, default 1e-12 (amperes).

§vntol: f64

VNTOL, default 1e-6 (volts).

§gmin: f64

GMIN, default 1e-12.

§itl1: usize

ITL1: DC iteration limit, default 100.

§itl2: usize

ITL2: DC transfer-curve iteration limit, default 50.

§itl4: usize

ITL4: transient timepoint iteration limit, default 10 (CKTtranMaxIter).

§gminsteps: usize

Gmin steps in CKTop. 1 (the ngspice-47 default) selects the dynamic Gillespie stepping of the diagonal gmin followed, if it fails, by the “true gmin” stepping of the devices’ gmin; n > 1 runs the 3f5 fixed ladder with n steps; 0 skips gmin stepping (corpus/KNOWN_DIFFS.md).

§srcsteps: usize

Source steps in CKTop. 1 (the ngspice-47 default, cktntask.c) selects Gillespie’s adaptive source ramp; n > 1 runs the 3f5 fixed ladder of n steps (the 3f5 default is 10); 0 skips source stepping (corpus/KNOWN_DIFFS.md).

§temp: f64

Operating temperature in kelvin (TEMP, default 27 °C).

§tnom: f64

Nominal parameter-measurement temperature (TNOM, 27 °C).

§pivtol: f64

PIVTOL, default 1e-13.

§pivrel: f64

PIVREL, default 1e-3.

§noopiter: bool

NOOPITER: go directly to gmin stepping.

§trtol: f64

TRTOL: truncation-error overestimation factor, default 7. What the step control uses is Options::lte_trtol.

§chgtol: f64

CHGTOL: charge tolerance, default 1e-14.

§method: Option<Method>

METHOD: trap, gear or Dune’s trbdf2 (Method::TrBdf2; not a SPICE value). None (default) leaves it to the analysis: see Options::tran_method and Options::pss_method.

§maxord: usize

MAXORD for Gear, default 2.

§nopage: bool

NOPAGE: suppress page breaks in printed output.

§defl: f64

DEFL/DEFW: default MOS channel length/width, meters (CKTdefaultMosL/W, 1e-4).

§defw: f64§defad: f64

DEFAD/DEFAS: default MOS drain/source diffusion area, m² (CKTdefaultMosAD/AS, 0).

§defas: f64§max_tran_steps: Option<usize>

Dune’s transient step budget (not a SPICE option; no .options card sets it): the most internal timepoints — accepted or rejected — one .tran may attempt before it stops with Error::StepLimit. The 3f5 and ngspice-47 both parse ITL5 (“total transient iteration limit”) and ignore it (cktsopt.c: case OPT_ITL5: break;), so neither bounds a run whose breakpoints cascade (D-0022).

None (default): automatic, scaled to the deck — max(TRAN_STEP_FLOOR, TRAN_STEPS_PER_TMAX · ⌈TSTOP/TMAX⌉) with the effective TMAX, i.e. 10 000 steps or 50 per maximum step span, whichever is more (the corpus peaks at 13 per span, ltra_2; a fixed budget cannot work because a cascading LTRA deck costs O(n²) in its history length — D-0022). Some(n): at most n (Some(usize::MAX) is unlimited).

§ltra_break_rate: Option<usize>

Dune’s LTRA breakpoint hygiene (.options ltrabkrate=N; not a SPICE option, issue #6). The slope rule of LTRAaccept plants a breakpoint one delay after every accepted point where an incident wave’s slope changes; CKTsetBreak merges only within 5e-5·TMAX, so a ringing load can feed it an echo cascade (D-0022). Some(n), n > 0: a slope breakpoint that falls within TMAX/n of one already scheduled is dropped, which caps them at about n per TMAX span. Some(0): faithful, every request scheduled. None (default): the profile’s — LTRA_BREAK_RATE under Compat::Dune, faithful under Compat::Spice3; see Options::ltra_slope_rate.

§ltra_fit: bool

Dune’s opt-in recursive convolution for LTRA lines (.options ltrafit; not a SPICE option, issue #8). The 3f5 recomputes every line’s convolution over the whole accepted history at each timepoint — O(n) per point, quadratic per run. true: the RLC and RC impulse responses become exponential sums (an exact branch-cut quadrature, error budget 1e-6 per kernel, reported in the run’s notes) advanced once per accepted point, with the newest segment kept exact — O(1) per point. false (default): faithful.

§tmax_divisor: Option<f64>

Dune’s transient refinement knob (an API argument, not a SPICE option: no .options card sets it, issue #16). Some(d), d ≥ 1 and finite: every .tran runs with its effective maximum step divided by d — the 4th argument of the card when given, else the default min(TSTEP, (TSTOP−TSTART)/50). Everything derived from TMAX (delmin, the breakpoint merge radius, the step budget) follows, so the run is the one the deck would give with that card’s TMAX edited to TMAX/d. It is not a .options key because TMAX is a parameter of the analysis card, and the divisor applies to every .tran card of the deck whatever TMAX each one carries. Any other value makes .tran fail with Error::Build. None (default): the card’s TMAX as is.

§seed: u64

SEED: the seed of the transient-noise sources (TRNOISE/TRRANDOM, ngspice-47 .options seed=N, which sets its rndseed). Default 1 — ngspice’s start-up rndseed too (main.c) —, so a deck without the option is reproducible. The same seed gives the same noise bits on every platform (see docs/dune-core.md §Ruído transiente); ngspice’s seed=random (a clock seed) is refused with a warning.

§notrnoise: bool

NOTRNOISE (ngspice-47’s notrnoise variable, read by trnoise_state_gen): every TRNOISE source runs with all its noise parameters zeroed — just its DC value, no grid, no breakpoints —, so a deck compares with and without noise without editing it. As in ngspice, TRRANDOM is untouched (its state generator never reads the variable). Default false.

§dev_noise: bool

Dune’s transient device noise (.options devnoise; not a SPICE option — neither the 3f5 nor ngspice has it, issue #20): every generator .noise knows (thermal 4kT·g, shot 2q|I|, flicker KF·…/f^EF) becomes a stochastic current source in .tran, drawn from the counted streams of seed. false (default): devices are noiseless in time, as in SPICE.

§dev_noise_step: Option<f64>

The grid step of the device noise (.options devnt=NT, seconds): white up to 1/(2·NT), a breakpoint every NT. None (default): the .tran card’s TSTEP.

§load_threads: usize

Worker threads for the per-iteration device load (issue #9, lever 1; an API argument, not a SPICE option). 1 (default): the sequential load, exactly the 3f5’s CKTload. 0: one thread per core. n > 1: the devices are split into contiguous runs evaluated on n threads, and their stamps are replayed into the matrix in device order, so every result is bit-identical to 1 whatever the count. It only pays on circuits with many expensive devices (MOS/BSIM); see docs/perf.md for the measured break-even. Needs the parallel feature (native builds); without it (and on wasm32) the value is ignored and the load is sequential.

§keepopinfo: bool

KEEPOPINFO (cktsopt.c): .ac, .pz and .disto (and, as in ngspice-47, .noise and .sp) first emit their operating point as a plot of its own (“AC Operating Point”, “Distortion Operating Point”, “NOISE Operating Point”). Default false.

§trytocompact: bool

TRYTOCOMPACT (cktsopt.c, IF_FLAG; CKTtryToCompact): LTRA lines without an explicit interpolation flag interpolate linearly, and after every accepted timepoint where the last three points of every LTRA port voltage and current lie on a straight line within COMPACTREL/COMPACTABS, the middle point is dropped from the shared history (ltraacct.c). Default false. Ignored under Options::ltra_fit and in .pss.

Implementations§

Source§

impl Options

Source

pub fn spice3() -> Self

The SPICE3f5 defaults (Compat::Spice3).

Source

pub fn tran_method(&self) -> Method

The integration method of a .tran: Options::method when given, else the profile’s — TR-BDF2 under Compat::Dune, the trapezoidal rule under Compat::Spice3.

Source

pub fn lte_trtol(&self) -> f64

The factor the transient step control multiplies its error tolerance by. TRTOL (7 by default) exists because the divided-difference estimate of CKTterr overestimates the local truncation error of the trapezoidal rule and of Gear. The composite TR-BDF2 step carries an embedded estimate that does not, so under Compat::Dune a TR-BDF2 transient is held to TRTOL/7 — the default is the estimate itself — and .options trtol= still scales it (D-0049). Measured on the accuracy ruler: margins sum 1.83 → 1.17 for 3 % more timepoints (mosamp2 0.45 → 0.08). Every other combination uses TRTOL as SPICE does.

Source

pub fn ltra_slope_rate(&self) -> Option<usize>

The LTRA breakpoint hygiene in force (Options::ltra_break_rate): the slope breakpoints allowed per TMAX span, None when every request is scheduled.

Source

pub fn pss_method(&self) -> Method

The integration method of the .pss shooting: Options::method when given, else the profile’s, as for .tran (Options::tran_method).

Source

pub fn pss_stab_method(&self) -> Method

The integration method of the stabilization run of an autonomous .pss (the transient to TSTAB in which the oscillation starts and its period is counted): the trapezoidal rule, whatever Options::method says. That run steps on a grid that does not know the period yet (TMAX = TSTAB/1000, which may exceed it), and the trapezoidal rule is the one method whose growth region is exactly the right half-plane: a mode that grows in the circuit grows in the run at any step. An L-stable method damps it instead (osc_colpitts never starts under TR-BDF2 or Gear there). The run only supplies the shooting’s starting point and period estimate; the result is integrated with Options::pss_method.

Source

pub fn tran_step_budget(&self, tstop: f64, max_step: f64) -> usize

The step budget of a .tran running to tstop with effective maximum step max_step (see Options::max_tran_steps).

Source

pub fn apply(&mut self, params: &[Param], diags: &mut Vec<Diagnostic>)

Apply .options parameters from the IR. Unknown or not-yet-implemented options produce a warning, never an error (the 3f5 front end also lets unknown variables through).

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.