driftlet 0.16.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/docs/device.md +13 -5
- package/docs/kit.md +3 -1
- package/docs/numerics.md +12 -0
- package/docs/statistics.md +2 -1
- package/docs/templates.md +260 -0
- package/llms.txt +106 -300
- package/package.json +15 -3
- package/src/channels.js +6 -4
- package/src/checks.js +7 -2
- package/src/data.js +5 -1
- package/src/device.js +1 -1
- package/src/devices.js +2 -0
- package/src/equation.js +2 -1
- package/src/errors.js +33 -0
- package/src/grid.js +12 -0
- package/src/index.js +17 -7
- package/src/junction.js +3 -1
- package/src/kit.js +1 -1
- package/src/live.js +2 -0
- package/src/particles.js +2 -0
- package/src/plot.js +4 -0
- package/src/polarization.js +2 -1
- package/src/recorder.js +2 -1
- package/src/solution.js +20 -5
- package/src/solver.js +22 -2
- package/src/sources.js +8 -1
- package/src/stack.js +14 -1
- package/src/statistics.js +1 -1
- package/src/traces.js +3 -0
- package/src/types.js +3 -1
- package/types/channels.d.ts +3 -3
- package/types/checks.d.ts +1 -1
- package/types/data.d.ts +3 -3
- package/types/devices.d.ts +1 -1
- package/types/equation.d.ts +1 -1
- package/types/errors.d.ts +8 -0
- package/types/index.d.ts +2 -5
- package/types/junction.d.ts +2 -2
- package/types/kit.d.ts +1 -1
- package/types/live.d.ts +1 -1
- package/types/particles.d.ts +1 -1
- package/types/plot.d.ts +3 -3
- package/types/polarization.d.ts +1 -1
- package/types/recorder.d.ts +1 -1
- package/types/sources.d.ts +7 -7
- package/types/traces.d.ts +1 -1
- package/types/types.d.ts +9 -1
package/src/types.js
CHANGED
|
@@ -218,7 +218,8 @@
|
|
|
218
218
|
* @property {Record<string, { V: number, current: number }>} terminals each terminal (left, right,
|
|
219
219
|
* then the ports by name): its voltage, and its current into the device (A/m²)
|
|
220
220
|
* @property {{ left: ContactResult, right: ContactResult }} contacts
|
|
221
|
-
* @property {{ left?: { V: number, D: number, charge: number }, right?: { V: number, D: number, charge: number } }}
|
|
221
|
+
* @property {{ left?: { V: number, D: number, charge: number }, right?: { V: number, D: number, charge: number } }} plates the charge on a gate or
|
|
222
|
+
* Stern plate at a capacitive contact
|
|
222
223
|
* @property {{ name: string, V: number, flux: Record<string, number>, current: number, x?: Float64Array,
|
|
223
224
|
* area?: Float64Array, rates?: Float64Array[], coverage?: Record<string, Float64Array>, bare?: Float64Array,
|
|
224
225
|
* sigma?: Float64Array, charge?: number }[]} ports what each internal port brings into the device;
|
|
@@ -248,6 +249,7 @@
|
|
|
248
249
|
* @property {{ re: Float64Array, im: Float64Array }} Z impedance −δV/δI, Ω·m²
|
|
249
250
|
* @property {{ phi: ComplexProfile, mu: Record<string, ComplexProfile>, c: Record<string, ComplexProfile> }[]} [profiles]
|
|
250
251
|
* per frequency, per unit excitation (volt, or A/m² in current mode)
|
|
252
|
+
* @property {string[]} warnings the steady state's warnings, which hold for its impedance too
|
|
251
253
|
*/
|
|
252
254
|
|
|
253
255
|
/** @typedef {{ re: Float64Array, im: Float64Array }} ComplexProfile */
|
package/types/channels.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function ghkCurrent(z: any, inside: any, outside: any, V: any, T: any): n
|
|
|
21
21
|
* port along a region: links that are their linear conductances, G = g × area per volume, gated the
|
|
22
22
|
* same, each ion's reversal potential following from the port's bath and the concentrations inside
|
|
23
23
|
* (so `inside`, `outside` and `at` aren't needed).
|
|
24
|
-
* @param {{ inside: object, outside: object, T
|
|
24
|
+
* @param {{ inside: object, outside: object, T: number, g?: { Na?: number, K?: number, leak?: number },
|
|
25
25
|
* leak?: string, leakZ?: number, at?: number, names?: { Na?: string, K?: string }, linear?: boolean, area?: number }} opts concentrations in
|
|
26
26
|
* mol/m³ by species name, K, S/m², V
|
|
27
27
|
* @returns {{ gates: object, species: object }}
|
|
@@ -29,7 +29,7 @@ export function ghkCurrent(z: any, inside: any, outside: any, V: any, T: any): n
|
|
|
29
29
|
export function hodgkinHuxley({ inside, outside, T, g, leak, leakZ, at, names, linear, area }?: {
|
|
30
30
|
inside: object;
|
|
31
31
|
outside: object;
|
|
32
|
-
T
|
|
32
|
+
T: number;
|
|
33
33
|
g?: {
|
|
34
34
|
Na?: number;
|
|
35
35
|
K?: number;
|
|
@@ -44,7 +44,7 @@ export function hodgkinHuxley({ inside, outside, T, g, leak, leakZ, at, names, l
|
|
|
44
44
|
};
|
|
45
45
|
linear?: boolean;
|
|
46
46
|
area?: number;
|
|
47
|
-
}): {
|
|
47
|
+
}, ...args: any[]): {
|
|
48
48
|
gates: object;
|
|
49
49
|
species: object;
|
|
50
50
|
};
|
package/types/checks.d.ts
CHANGED
package/types/data.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export function aqueous(names: string[], { epsr, material }?: {
|
|
10
10
|
epsr?: number;
|
|
11
11
|
material?: string;
|
|
12
|
-
}): {
|
|
12
|
+
}, ...args: any[]): {
|
|
13
13
|
species: object[];
|
|
14
14
|
materials: Record<string, object>;
|
|
15
15
|
};
|
|
@@ -24,7 +24,7 @@ export function aqueous(names: string[], { epsr, material }?: {
|
|
|
24
24
|
*/
|
|
25
25
|
export function semiconductor(name: string, { material }?: {
|
|
26
26
|
material?: string;
|
|
27
|
-
}): {
|
|
27
|
+
}, ...args: any[]): {
|
|
28
28
|
species: object[];
|
|
29
29
|
materials: Record<string, object>;
|
|
30
30
|
};
|
|
@@ -36,7 +36,7 @@ export function semiconductor(name: string, { material }?: {
|
|
|
36
36
|
*/
|
|
37
37
|
export function metal(name: string, { material }?: {
|
|
38
38
|
material?: string;
|
|
39
|
-
}): {
|
|
39
|
+
}, ...args: any[]): {
|
|
40
40
|
species: object[];
|
|
41
41
|
materials: Record<string, object>;
|
|
42
42
|
};
|
package/types/devices.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export function perovskiteCell({ V, light, bulkSRH }?: {
|
|
|
19
19
|
};
|
|
20
20
|
light?: number;
|
|
21
21
|
bulkSRH?: boolean;
|
|
22
|
-
}): import("./types.js").DeviceDefinition;
|
|
22
|
+
}, ...args: any[]): import("./types.js").DeviceDefinition;
|
|
23
23
|
/**
|
|
24
24
|
* A J–V loop's figures of merit, from a transient's trace (`{ t, voltage, current }`, as a
|
|
25
25
|
* recorder or advance() gives it): the loop splits at time `turn` into the sweep before (`rev`)
|
package/types/equation.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export function level(sol: {
|
|
|
78
78
|
fixed?: Record<string, number>;
|
|
79
79
|
}, { standard }?: {
|
|
80
80
|
standard?: boolean;
|
|
81
|
-
}): Float64Array;
|
|
81
|
+
}, ...args: any[]): Float64Array;
|
|
82
82
|
/**
|
|
83
83
|
* The standard hydrogen electrode, 2 H⁺ + 2 e⁻ ⇌ H₂, with μ(H₂) = 0 (the element in its standard
|
|
84
84
|
* state, on the usual table convention). Needs `H+` among the species.
|
package/types/errors.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function's options: a name it doesn't take (a typo) is an error, not silently ignored.
|
|
3
|
+
* @param {string} where the function, for the message
|
|
4
|
+
* @param {unknown} opts
|
|
5
|
+
* @param {string[]} allowed
|
|
6
|
+
* @param {new (message: string) => Error} [Kind]
|
|
7
|
+
*/
|
|
8
|
+
export function checkOptions(where: string, opts: unknown, allowed: string[], Kind?: new (message: string) => Error): void;
|
|
1
9
|
export class DeviceError extends Error {
|
|
2
10
|
constructor(message: any);
|
|
3
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export { DeviceError } from "./device.js";
|
|
1
2
|
export { SolverError } from "./solver.js";
|
|
2
|
-
export { BlockTridiagonal } from "./blockTridiagonal.js";
|
|
3
3
|
export * from "./constants.js";
|
|
4
4
|
/** @typedef {import('./types.js').DeviceDefinition} DeviceDefinition */
|
|
5
5
|
/** @typedef {import('./types.js').Solution} Solution */
|
|
@@ -72,7 +72,7 @@ export class Device {
|
|
|
72
72
|
/**
|
|
73
73
|
* Small-signal impedance Z(f) about the steady state (solved first), at one terminal: its
|
|
74
74
|
* held voltage is perturbed (or its driven current), the others keep their drives.
|
|
75
|
-
* Z = δV/δI with I into the device (Ω·m²)
|
|
75
|
+
* Z = δV/δI with I into the device (Ω·m²), with the steady state's `warnings`.
|
|
76
76
|
* @param {ArrayLike<number>} frequencies Hz
|
|
77
77
|
* @param {{ terminal?: string, profiles?: boolean }} [opts] the terminal (default 'right'), and
|
|
78
78
|
* whether to return complex profiles per frequency
|
|
@@ -110,6 +110,3 @@ export class Device {
|
|
|
110
110
|
}
|
|
111
111
|
export type DeviceDefinition = import("./types.js").DeviceDefinition;
|
|
112
112
|
export type Solution = import("./types.js").Solution;
|
|
113
|
-
export { DeviceError, normalizeDevice } from "./device.js";
|
|
114
|
-
export { buildGrid, gradedCells } from "./grid.js";
|
|
115
|
-
export { bernoulli, bernoulliDerivative } from "./bernoulli.js";
|
package/types/junction.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export function henderson(left: Record<string, number>, right: Record<string, nu
|
|
|
12
12
|
D: number;
|
|
13
13
|
}>, { T }?: {
|
|
14
14
|
T?: number;
|
|
15
|
-
}): number;
|
|
15
|
+
}, ...args: any[]): number;
|
|
16
16
|
/**
|
|
17
17
|
* Planck's liquid-junction potential, φ_R − φ_L (V): the steady state of constrained diffusion,
|
|
18
18
|
* a junction zone held between the two solutions, electroneutral, carrying no current. Solved by
|
|
@@ -29,4 +29,4 @@ export function planck(left: Record<string, number>, right: Record<string, numbe
|
|
|
29
29
|
}>, { T, steps }?: {
|
|
30
30
|
T?: number;
|
|
31
31
|
steps?: number;
|
|
32
|
-
}): number;
|
|
32
|
+
}, ...args: any[]): number;
|
package/types/kit.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export type VacuumSide = {
|
|
|
59
59
|
offset: number;
|
|
60
60
|
};
|
|
61
61
|
export { build, combine, layer, ohmic, bath } from "./stack.js";
|
|
62
|
-
export {
|
|
62
|
+
export { half, SHE, level } from "./equation.js";
|
|
63
63
|
export { traces, speciesRole, typeset } from "./traces.js";
|
|
64
64
|
export { pulse, square, triangle, ramp, injector, recombination, photogeneration } from "./sources.js";
|
|
65
65
|
export { hodgkinHuxley, ghkCurrent } from "./channels.js";
|
package/types/live.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export function live(def: object, { worker, onsolution, maxRamp }?: {
|
|
|
28
28
|
worker?: boolean | (() => any);
|
|
29
29
|
onsolution?: (solution: object, info: object) => void;
|
|
30
30
|
maxRamp?: number;
|
|
31
|
-
}): Live;
|
|
31
|
+
}, ...args: any[]): Live;
|
|
32
32
|
/**
|
|
33
33
|
* What a live device does with each change, on whichever thread solves it: apply, solve warm,
|
|
34
34
|
* ramp from the last good state if that fails, and fall back to the last good solution.
|
package/types/particles.d.ts
CHANGED
package/types/plot.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export function themeColor(role: "electron" | "cation" | "anion" | "redox", slot: number, { dark }?: {
|
|
9
9
|
dark?: boolean;
|
|
10
|
-
}): string;
|
|
10
|
+
}, ...args: any[]): string;
|
|
11
11
|
/**
|
|
12
12
|
* A label split into plain and subscript runs. Labels mark subscripts TeX-style: `V_{e⁻}`, or
|
|
13
13
|
* `C_ox` for a run of letters, digits and charge signs. Everything else is literal.
|
|
@@ -34,7 +34,7 @@ export function levelChart(tr: ReturnType<typeof traces>, { width, height, ylabe
|
|
|
34
34
|
xlim?: [number, number];
|
|
35
35
|
title?: string;
|
|
36
36
|
ytick?: (v: number) => string;
|
|
37
|
-
}): string;
|
|
37
|
+
}, ...args: any[]): string;
|
|
38
38
|
/**
|
|
39
39
|
* A solution's level diagram as an SVG string: each charged species' voltage (thick) and
|
|
40
40
|
* standard level (thin), regions as bands; or with `energy: true`, the familiar energy-up band
|
|
@@ -43,7 +43,7 @@ export function levelChart(tr: ReturnType<typeof traces>, { width, height, ylabe
|
|
|
43
43
|
* @param {Parameters<typeof traces>[1] & Parameters<typeof levelChart>[1]} [opts]
|
|
44
44
|
* @returns {string}
|
|
45
45
|
*/
|
|
46
|
-
export function bandDiagram(sol: import("./types.js").Solution, opts?: Parameters<typeof traces>[1] & Parameters<typeof levelChart>[1]): string;
|
|
46
|
+
export function bandDiagram(sol: import("./types.js").Solution, opts?: Parameters<typeof traces>[1] & Parameters<typeof levelChart>[1], ...args: any[]): string;
|
|
47
47
|
export const THEME: Readonly<{
|
|
48
48
|
light: {
|
|
49
49
|
electron: string[];
|
package/types/polarization.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function polarization(device: import("./index.js").Device, sol: object, w
|
|
|
24
24
|
x?: number;
|
|
25
25
|
}, V: number | ArrayLike<number>, opts?: {
|
|
26
26
|
surface?: "held" | "equilibrium";
|
|
27
|
-
}): {
|
|
27
|
+
}, ...args: any[]): {
|
|
28
28
|
V: Float64Array;
|
|
29
29
|
current: Float64Array;
|
|
30
30
|
bare?: Float64Array;
|
package/types/recorder.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export function recorder(device: import("./index.js").Device, opts?: {
|
|
|
19
19
|
species?: string;
|
|
20
20
|
gate?: string;
|
|
21
21
|
})[];
|
|
22
|
-
}): {
|
|
22
|
+
}, ...args: any[]): {
|
|
23
23
|
advance: (tEnd: number, aopts?: object) => import("./types.js").Solution;
|
|
24
24
|
frame: (t: number) => import("./types.js").Solution;
|
|
25
25
|
frames: import("./types.js").Solution[];
|
package/types/sources.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export function pulse({ start, width, amplitude, rise, base }?: {
|
|
|
13
13
|
amplitude: number;
|
|
14
14
|
rise?: number;
|
|
15
15
|
base?: number;
|
|
16
|
-
}): {
|
|
16
|
+
}, ...args: any[]): {
|
|
17
17
|
t: number[];
|
|
18
18
|
values: number[];
|
|
19
19
|
};
|
|
@@ -27,7 +27,7 @@ export function square({ high, low, period, duty }?: {
|
|
|
27
27
|
low: number;
|
|
28
28
|
period: number;
|
|
29
29
|
duty?: number;
|
|
30
|
-
}): {
|
|
30
|
+
}, ...args: any[]): {
|
|
31
31
|
t: number[];
|
|
32
32
|
values: number[];
|
|
33
33
|
repeat: true;
|
|
@@ -42,7 +42,7 @@ export function triangle({ from, to, period }?: {
|
|
|
42
42
|
from: number;
|
|
43
43
|
to: number;
|
|
44
44
|
period: number;
|
|
45
|
-
}): {
|
|
45
|
+
}, ...args: any[]): {
|
|
46
46
|
t: number[];
|
|
47
47
|
values: number[];
|
|
48
48
|
repeat: true;
|
|
@@ -57,7 +57,7 @@ export function ramp({ from, to, duration, start }?: {
|
|
|
57
57
|
to: number;
|
|
58
58
|
duration: number;
|
|
59
59
|
start?: number;
|
|
60
|
-
}): {
|
|
60
|
+
}, ...args: any[]): {
|
|
61
61
|
t: number[];
|
|
62
62
|
values: number[];
|
|
63
63
|
};
|
|
@@ -84,7 +84,7 @@ export function injector({ name, region, from, to, species, I, headroom }?: {
|
|
|
84
84
|
repeat?: boolean;
|
|
85
85
|
};
|
|
86
86
|
headroom?: number;
|
|
87
|
-
}): object;
|
|
87
|
+
}, ...args: any[]): object;
|
|
88
88
|
/**
|
|
89
89
|
* Band-to-band recombination e⁻ + h⁺ ⇌ 0 in a material, from the minority-carrier lifetime it
|
|
90
90
|
* should give at a majority density: kf = 1/(τ · majority). (The rate is kf (np − n_i²), so τ is
|
|
@@ -96,7 +96,7 @@ export function recombination({ material, tau, majority }?: {
|
|
|
96
96
|
material: string;
|
|
97
97
|
tau: number;
|
|
98
98
|
majority: number;
|
|
99
|
-
}): {
|
|
99
|
+
}, ...args: any[]): {
|
|
100
100
|
equation: string;
|
|
101
101
|
kf: Record<string, number>;
|
|
102
102
|
};
|
|
@@ -122,7 +122,7 @@ export function photogeneration({ material, flux, alpha, mu, from, to, makes }?:
|
|
|
122
122
|
from?: number;
|
|
123
123
|
to: number;
|
|
124
124
|
makes?: string;
|
|
125
|
-
}): {
|
|
125
|
+
}, ...args: any[]): {
|
|
126
126
|
equation: string;
|
|
127
127
|
fixed: Record<string, number>;
|
|
128
128
|
kf: Record<string, {
|
package/types/traces.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -551,7 +551,11 @@ export type Solution = {
|
|
|
551
551
|
left: ContactResult;
|
|
552
552
|
right: ContactResult;
|
|
553
553
|
};
|
|
554
|
-
|
|
554
|
+
/**
|
|
555
|
+
* the charge on a gate or
|
|
556
|
+
* Stern plate at a capacitive contact
|
|
557
|
+
*/
|
|
558
|
+
plates: {
|
|
555
559
|
left?: {
|
|
556
560
|
V: number;
|
|
557
561
|
D: number;
|
|
@@ -665,6 +669,10 @@ export type ImpedanceResult = {
|
|
|
665
669
|
mu: Record<string, ComplexProfile>;
|
|
666
670
|
c: Record<string, ComplexProfile>;
|
|
667
671
|
}[];
|
|
672
|
+
/**
|
|
673
|
+
* the steady state's warnings, which hold for its impedance too
|
|
674
|
+
*/
|
|
675
|
+
warnings: string[];
|
|
668
676
|
};
|
|
669
677
|
export type ComplexProfile = {
|
|
670
678
|
re: Float64Array;
|