Skip to content

Snng Workflow

Fit tabulated ferroelectric switching data with the SNNG model.

Accept switched fractions, polarization, or per-domain polarities and export normalized data, fit parameters, metrics, sweep results, and PNG plots.

Command: fit-snng-switching

Fit the site-saturated nucleation with nucleation and growth (SNNG) model to a CSV or Excel table.

Estimate nucleation and growth kinetics from switched fractions or normalized polarization. Optionally derive density or wall velocity from the fitted prefactor and supplied physical inputs. Fit existing data only; write result tables and PNG plots in a unique run folder.

[Note] Model time zero represents electric-field onset only when the time origin is set correctly. With --field-start-time T, fitted/exported/plotted time is input time minus T; rows before T are excluded, and the first retained sample may have positive time. Without this flag, time zero is the earliest input sample in each group, which must correspond to field onset for a physical switching-time interpretation. If timestamps are already relative to field onset, use --field-start-time 0 to preserve that origin, including when the first recorded sample is later than zero. Specify T in the input time column's units; --time-unit only labels plots.

Examples


  1. Fit an existing switched-fraction curve:
     reaxkit fit-snng-switching --input switching.csv --data-kind fraction --value-column fraction

  2. Normalize polarization and fit each applied field separately:
     reaxkit fit-snng-switching --input switching.xlsx --sheet pulses --data-kind polarization --value-column Pz --group-column field

  3. Fit the fraction of domains whose polarity has reversed:
     reaxkit fit-snng-switching --input domains.csv --data-kind polarity-columns --polarity-columns d1 d2 d3

  4. Refit at fixed parameter values and export tables to a directory:
     reaxkit fit-snng-switching --input switching.csv --data-kind fraction --value-column fraction --sweep m=1,2,3 --output snng_fits

  5. Fit switching after the field is applied at time 125:
     reaxkit fit-snng-switching --input switching.csv --data-kind fraction --value-column fraction --field-start-time 125

Arguments

Scientific choices

Flag Required Default Help Choices
--time-column No time Select numeric times; curves are sorted and shifted relative to field onset, or the first sample when onset is omitted, without unit conversion. Example: --time-column time_ns, fit using time_ns.
--field-start-time No Set field onset in input time units for every group; exclude earlier rows and subtract onset. Use the last sample at or before onset as baseline, or the earliest if none exists. Default: shift each curve by its first time. Example: --field-start-time 125, fit only times at least 125 using time minus 125.
--data-kind Yes Choose fraction, polarization, or per-domain polarity input. Example: --data-kind polarization, normalize the selected value column to switched fractions. fraction, polarization, polarity-columns
--value-column No Select the required value column for fraction or polarization input. Example: --value-column Pz, normalize Pz in polarization mode.
--polarity-columns No Select domain columns for polarity-columns input; unlisted domains are excluded and initial signs must be nonzero. Example: --polarity-columns d1 d2 d3, count sign reversals across these three domains.
--group-column No Fit every distinct column value as a separate curve; otherwise fit all rows together. Example: --group-column field, fit each applied field independently.
--initial-polarization No Override the polarization baseline selected at field onset, or the earliest value when onset is omitted. Example: --initial-polarization -100, map -100 to zero switched fraction.
--final-polarization No Set the polarization normalization endpoint instead of estimating its plateau. Example: --final-polarization 100, map 100 to unit switched fraction.
--tail-fraction No 0.1 Set the fraction of final time-sorted rows used for the median polarization plateau, in (0, 1]; ignored with --final-polarization. Example: --tail-fraction 0.2, use the last 20 percent of each curve.
--clip-fraction No False Clip normalized fractions to [0, 1] instead of rejecting values outside the numerical tolerance. Example: --clip-fraction, clamp overshoots before fitting.
--fixed No Fix [MODEL.]NAME=VALUE; repeat as needed. Only KAI t0 accepts an omitted value or auto for the 63.2 percent crossing estimate. Example: --fixed kai.t0, infer and fix KAI t0 when KAI is selected.
--bounds No Override positive bounds with [MODEL.]NAME=LOW:HIGH; repeat as needed. Example: --bounds n=0.5:8, constrain n in selected KAI or NLS fits.
--initial No Override a starting guess with [MODEL.]NAME=VALUE; repeat as needed. Example: --initial n=2, start n at 2 in selected KAI or NLS fits.
--sweep No Fix one parameter at each value and refit the others; accept lists or inclusive START:STOP[:STEP] ranges and repeat for independent sweeps. Example: --sweep snng.m=1:3:0.5, refit selected SNNG at five m values.
--fit-nls-amplitude No False Fit NLS amplitude instead of fixing it at 1; explicit --fixed amplitude takes precedence. Ignored without NLS. Example: --fit-nls-amplitude, estimate amplitude from the curve.
--starts No 12 Set optimization starts per fit; more starts increase search effort and runtime. Example: --starts 24, try 24 starting parameter sets.
--seed No 0 Set the seed for reproducible multi-start initialization. Example: --seed 7, reuse randomized guesses for otherwise identical fits.
--loss No linear Choose the least-squares optimization loss. Example: --loss soft_l1, reduce the influence of large residuals compared with linear loss. linear, soft_l1, huber, cauchy, arctan
--thickness No Supply positive SNNG thickness to derive density or velocity using consistent length and time units; does not constrain fitting. Example: --thickness 100e-9, use a 100 nm film when lengths are in metres.
--wall-velocity No Supply positive SNNG wall velocity and --thickness to derive nucleation density from the fitted prefactor. Example: --wall-velocity 2.5, use 2.5 length units per input time unit.
--nucleation-density No Supply positive SNNG nucleation density and --thickness to derive wall velocity from the fitted prefactor. Example: --nucleation-density 1e12, use 1e12 per cubic length unit.
--time-unit No input units Label plot time axes without rescaling times or fitted parameters. Example: --time-unit ps, label plotted times as picoseconds.

Input and file selection

Flag Required Default Help Choices
--input Yes Read switching data from a CSV or Excel table. Example: --input switching.xlsx, read curves from that workbook.

Outputs and plots

Flag Required Default Help Choices
--sheet No 0 Select an Excel sheet by zero-based index or name; ignored for CSV. Example: --sheet pulses, read only the pulses sheet.
--figure-dpi No 180 Set positive PNG resolution in dots per inch; larger values produce more pixels. Example: --figure-dpi 300, export plots at 300 dpi.
--output No Name an .xlsx/.xlsm workbook, or use a suffix-free name to select CSV files directly in the unique run folder; parent paths are ignored. Defaults to _switching_fits.xlsx. Example: --output kai_fit, write CSV files in the run folder without an extra subdirectory.
--plot-style No default Plot appearance: default preserves existing styling; publication uses clear fonts and an accessible palette; publication-bold uses larger bold text and heavier lines. Example: --plot-style publication-bold, which improves readability when figures are reduced in a manuscript. default, publication, publication-bold
--color-style No default Color treatment: default preserves existing colors; light-fill uses lighter bar and marker interiors with the original outlines and lines. Example: --color-style light-fill, which adds contrast between fills and borders. default, light-fill
--detail-format No Optional detail format (default: Parquet; legacy: CSV). Example: --detail-format csv, which writes requested detail tables as CSV. parquet, csv

Execution

Flag Required Default Help Choices
--execution No auto Execution backend; unsupported backends fall back to serial with a logged reason. Example: --execution serial, which processes work sequentially. auto, serial, threads, processes
--workers No 0 Frame workers: auto or N (default: auto). Example: --workers 4, which requests four frame workers.
--chunk-size No 0 Maximum in-flight frames: auto or N. Example: --chunk-size 8, which limits concurrent frame processing to eight frames.

Storage and cache

Flag Required Default Help Choices
--profile No False Record deterministic function calls and timings for all Python threads (requires --diagnostics and reaxkit[profiling]).
--profile-clock No wall Profiler timer: elapsed wall time (default) or thread CPU time. Requires --profile to record. wall, cpu
--diagnostics, --no-diagnostics No False Enable a per-command report, console log, resource samples, and periodic Python stacks under logs/diagnostics (disabled by default).
--diagnostic-interval-seconds No 60.0 Python stack sampling interval (default: 60 seconds). Example: --diagnostic-interval-seconds 30.
--checkpoint, --no-checkpoint No Enable durable result batches for audited commands. Example: --no-checkpoint, disables recovery storage.
--resume No Resume a compatible result checkpoint; repeat the original scientific options. Example: --resume ./checkpoint, skips committed calculations.
--checkpoint-buffer-mb No 32 Result buffer in MiB, plus one oversized frame. Example: --checkpoint-buffer-mb 32, bounds pending result payloads to approximately 32 MiB.
--checkpoint-interval-seconds No 30 Flush at the next completed frame after this interval. Example: --checkpoint-interval-seconds 30, commits roughly every 30 seconds.
--output-profile No standard Artifact profile (default: standard). Example: --output-profile full, which includes declared optional detail artifacts. standard, minimal, full, legacy

Diagnostics and compatibility

Flag Required Default Help Choices
-h, --help No show this help message and exit
--help-all, --all-flags No Show every option, grouped by purpose. Example: --help-all, which includes advanced flags in the help output.

Common Runtime and Presentation Arguments

These are shared workflow-level CLI flags added before command-specific options, covering runtime context (engine/input/storage) and output presentation/export behavior.

Each command table above includes its shared and inherited options.