Skip to content

Publish to SpiceBook

Take an LTspice circuit, convert it to ngspice format, and publish it as an interactive notebook on SpiceBook --- shareable via URL and runnable in the browser.

  1. Create and simulate the circuit locally

    Start by building the circuit with mcltspice and verifying it works in LTspice. Here we use the built-in RC lowpass template:

    // create_from_template
    {
    "template": "rc_lowpass",
    "params": { "r": "10k", "c": "1n" }
    }

    Then simulate:

    // simulate_netlist
    {
    "netlist_path": "/tmp/rc_lowpass.cir"
    }

    Confirm the simulation succeeds and check the frequency response with measure_bandwidth to verify the cutoff is around 15.9 kHz (1 / (2 * pi * 10k * 1n)).

  2. Test ngspice compatibility

    LTspice and ngspice have dialect differences. Before publishing, do a dry run on SpiceBook’s ngspice engine:

    // spicebook_simulate
    {
    "netlist_path": "/tmp/rc_lowpass.cir"
    }

    Check the result for errors. If conversion_warnings appears, the converter handled known LTspice-isms automatically (.backanno, Rser=, Windows paths). If the simulation fails, adjust the netlist to remove any unsupported constructs.

  3. Publish the notebook

    Once ngspice compatibility is confirmed, publish with a descriptive title and tags:

    // spicebook_publish
    {
    "netlist_path": "/tmp/rc_lowpass.cir",
    "title": "RC Lowpass Filter - 15.9 kHz Cutoff",
    "description": "First-order RC lowpass with R=10k, C=1n. AC analysis from 1 Hz to 1 MHz.",
    "tags": ["filter", "lowpass", "analog", "first-order"]
    }

    The response includes a direct URL to the notebook:

    {
    "notebook_id": "rc-lowpass-filter-15-9-khz-cutoff-a1b2c3d4",
    "url": "https://spicebook.warehack.ing/notebooks/rc-lowpass-filter-15-9-khz-cutoff-a1b2c3d4",
    "cell_count": 2,
    "conversion_warnings": []
    }
  4. Verify the published notebook

    Retrieve the notebook to confirm it was created correctly:

    // spicebook_get
    {
    "notebook_id": "rc-lowpass-filter-15-9-khz-cutoff-a1b2c3d4"
    }

    The notebook is now live at the URL and can be shared with anyone. Visitors can view the netlist, modify it, and run simulations directly in the browser.

Use spicebook_list to see all published notebooks, and spicebook_delete to remove any that are no longer needed --- useful for cleaning up test notebooks.

The publish tool automatically converts four LTspice-specific constructs to ngspice-compatible equivalents:

LTspice constructWhat happens
.backannoStripped (LTspice annotation directive)
.options plotwinsize=0Stripped (LTspice buffer setting)
.lib / .include with Windows pathsCommented out with a warning
Rser= on capacitors or inductorsStripped with a warning

All changes are reported in conversion_warnings so you know exactly what was modified. Standard SPICE passes through untouched.

The full workflow --- design, simulate, verify, publish --- can happen in a single MCP session. SpiceBook notebooks are interactive: anyone with the URL can view, edit, and re-run the circuit without installing LTspice.