Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

g(r) Pair Distribution Viewer

Single-panel viewer for the 2-body g(r) of one supercell or a regime-ladder comparison of several. The same g2_viewer.html template is used for both; behaviour is driven by whether the embedded JSON payload contains a single profiles array (single-cell mode) or a series list (compare mode).

Single-cell mode

# write a standalone HTML file
cell.export_g2_html("mro_g2.html", r_max=8.0, title="Si MRO g(r)")

# or view inline in Jupyter (returns IPython.display.HTML wrapping an iframe)
cell.plot_g2(r_max=8.0, title="Si MRO g(r)")

Controls:

A faint dashed vertical marker at the reference pair_peak from shell_target (if available) helps locate the expected first-shell radius on the current curve.

Compare mode

cells = {
    "liquid":          cells_liquid,
    "amorphous":       cells_amorphous,
    "SRO":             cells_sro,
    "MRO":             cells_mro,
    "ext. MRO":        cells_ext_mro,
    "nanocrystalline": cells_nano,
}

# inline Jupyter display
am.plot_g2_compare(cells, r_max=8.0, title="Silicon regime comparison")

# standalone HTML for docs / sharing
am.export_g2_compare_html(cells, "si_g2_compare.html", r_max=8.0)

Behaviour:

Input shapes

atomode.export_g2_compare_html accepts any of:

# dict (keys become labels; insertion order = stack order)
am.plot_g2_compare({"liquid": c1, "MRO": c2, "NC": c3})

# list of (cell, label) tuples
am.plot_g2_compare([(c1, "liquid"), (c2, "MRO")])

# list of cells (uses each cell.label)
am.plot_g2_compare([c1, c2, c3])

All supplied cells must share the same species set. Measurements reuse the g3 machinery under the hood (phi_num_bins is set low for speed because the compare viewer doesn’t plot angular data).

Example: silicon regime ladder

The SiO₂ example in this repo opens with exactly this compare viewer embedded under its Overview heading; the silicon analogue is visible on the silicon example page. Pair dropdown switches which species pair is shown; the six stacked curves identify each regime by colour and inline label.