Skip to content

Live examples ​

Every function of the WebAssembly package has a runnable example here — one per function. Press Run and the calculation happens in your browser, with the compiled sci-form-wasm package built for this release (the same code as the npm package, in its single-threaded build); nothing is sent to a server.

Each example gets the same starting variables, so the code stays short:

VariableValue
scithe compiled module
smiles"CCO" (ethanol)
elements, coordsJSON strings with the atomic numbers and the flat x, y, z (Å) of ethanol, embedded with seed 42
waterEl, waterCothe same for a fixed water geometry (used by the slower methods)
JJSON.stringify

Every function returns a JSON string, so most examples simply return sci.<function>(…) and the page prints the parsed result. Use the same calls in your own code:

ts
import init, * as sci from 'sci-form-wasm'
await init()
const mol = JSON.parse(sci.embed('CCO', 42))
const pm3 = JSON.parse(sci.compute_pm3(JSON.stringify(mol.elements), JSON.stringify(mol.coords)))

Structures & conformers

3D structure from SMILES embed
3D structure from SMILESembed

Builds 3D coordinates with ETKDG distance geometry. Same seed, same structure.

return sci.embed(smiles, 42);
Many molecules at once embed_batch
Many molecules at onceembed_batch

Embeds a list of SMILES; failures are reported per molecule, not thrown.

return sci.embed_batch(J(["CCO","c1ccccc1","CC(=O)O"]), 42);
Diverse conformer ensemble embed_diverse
Diverse conformer ensembleembed_diverse

Generates conformers and keeps one per RMSD cluster (Butina).

return sci.embed_diverse("CCCC", 8, 0.5, 42n);
UFF-ranked conformer search search_conformers_with_uff
UFF-ranked conformer searchsearch_conformers_with_uff

Samples conformers, minimises each with UFF and ranks them by energy.

return sci.search_conformers_with_uff("CCCC", 6, 42, 0.3);
Parse a SMILES parse_smiles
Parse a SMILESparse_smiles

Atoms and bonds of the molecular graph, no 3D needed.

return sci.parse_smiles("c1ccccc1O");
Canonical SMILES to_canonical_smiles
Canonical SMILESto_canonical_smiles

Different spellings of one molecule give one string.

return J({ input: "OCC", canonical: sci.to_canonical_smiles("OCC") });
Smallest set of smallest rings compute_sssr
Smallest set of smallest ringscompute_sssr

Ring perception of a fused system (naphthalene).

return sci.compute_sssr("c1ccc2ccccc2c1");
Stereochemistry analyze_stereo
Stereochemistryanalyze_stereo

R/S centres and E/Z bonds, from the graph and optionally from 3D coordinates.

return sci.analyze_stereo("C(F)(Cl)(Br)I", "[]");
Graph features analyze_graph_features
Graph featuresanalyze_graph_features

Aromaticity, hybridisation and other per-atom perception results.

return sci.analyze_graph_features("c1ccccc1");
Topology from coordinates compute_topology
Topology from coordinatescompute_topology

Infers bonds from a 3D geometry alone.

return sci.compute_topology(elements, coords);
Bond orders compute_bond_orders
Bond orderscompute_bond_orders

Bond orders from the Extended Hückel density.

return sci.compute_bond_orders(elements, coords);
RMSD after alignment compute_rmsd
RMSD after alignmentcompute_rmsd

Kabsch-aligned RMSD between two geometries (here ethanol against a re-embedded copy).

const other = J(JSON.parse(sci.embed_coords(smiles, 7)).coords); return sci.compute_rmsd(coords, other);
Pairwise RMSD matrix compute_rmsd_matrix
Pairwise RMSD matrixcompute_rmsd_matrix

All-pairs RMSD for a set of conformers.

const c = JSON.parse(sci.embed_diverse("CCCC", 4, 0.1, 42n)); return sci.compute_rmsd_matrix(J(c.map(x => x.coords)));
Butina clustering butina_cluster
Butina clusteringbutina_cluster

Clusters conformers by RMSD.

const c = JSON.parse(sci.embed_diverse("CCCC", 4, 0.1, 42n)); return sci.butina_cluster(J(c.map(x => x.coords)), 0.5);
Keep the diverse conformers filter_diverse
Keep the diverse conformersfilter_diverse

Drops conformers that are within the RMSD cutoff of one already kept.

const c = JSON.parse(sci.embed_diverse("CCCC", 4, 0.1, 42n)); return sci.filter_diverse(J(c.map(x => x.coords)), 0.5);

Charges, fingerprints & descriptors

Gasteiger–Marsili charges compute_charges
Gasteiger–Marsili chargescompute_charges

Partial charges from electronegativity equalisation on the graph.

return sci.compute_charges("CCO");
Charges with your own parameters compute_charges_configured
Charges with your own parameterscompute_charges_configured

Same method with iteration count, damping and tolerance exposed.

return sci.compute_charges_configured("CCO", 12, 0.5, 1e-6);
EEQ charges (3D) compute_eeq_charges
EEQ charges (3D)compute_eeq_charges

Geometry-dependent charges from the electronegativity-equalisation model.

return sci.compute_eeq_charges(elements, coords, 0);
EEQ electrostatic energy compute_eeq_energy
EEQ electrostatic energycompute_eeq_energy

Energy of the EEQ charge distribution.

return sci.compute_eeq_energy(elements, coords, 0);
Empirical pKa compute_empirical_pka
Empirical pKacompute_empirical_pka

Group-contribution pKa estimate for the acidic/basic sites.

return sci.compute_empirical_pka("CC(=O)O");
Molecular descriptors compute_molecular_descriptors
Molecular descriptorscompute_molecular_descriptors

Weight, logP-like and topological descriptors.

return sci.compute_molecular_descriptors("CC(=O)Oc1ccccc1C(=O)O");
ML descriptor vector compute_ml_descriptors
ML descriptor vectorcompute_ml_descriptors

The feature vector the property models consume.

return sci.compute_ml_descriptors("CCO");
Fast property estimates compute_ml_properties
Fast property estimatescompute_ml_properties

logP, solubility and drug-likeness from the descriptor model.

return sci.compute_ml_properties("CCO");
Property prediction predict_ml_properties
Property predictionpredict_ml_properties

Same models through the prediction entry point.

return sci.predict_ml_properties("CCO");
Ensemble prediction with uncertainty predict_ensemble
Ensemble prediction with uncertaintypredict_ensemble

Several models voting, with the spread as a confidence signal.

return sci.predict_ensemble("CCO");
ECFP fingerprint compute_ecfp
ECFP fingerprintcompute_ecfp

Morgan/ECFP bit vector (radius 2, 1024 bits).

return sci.compute_ecfp("CCO", 2, 1024);
Fingerprints for a list compute_ecfp_batch
Fingerprints for a listcompute_ecfp_batch

ECFP for many SMILES in one call.

return sci.compute_ecfp_batch(J(["CCO","CCN","c1ccccc1"]), 2, 1024);
Tanimoto similarity compute_tanimoto
Tanimoto similaritycompute_tanimoto

Similarity of two fingerprints (ethanol vs. ethylamine).

const a = sci.compute_ecfp("CCO", 2, 1024), b = sci.compute_ecfp("CCN", 2, 1024); return sci.compute_tanimoto(a, b);
Topological polar surface area compute_tpsa
Topological polar surface areacompute_tpsa

Polar surface in Ų from fragment contributions.

return sci.compute_tpsa("CCO");
WHIM 3D descriptors compute_whim
WHIM 3D descriptorscompute_whim

Weighted holistic invariant descriptors of the 3D shape.

return sci.compute_whim(elements, coords, "mass");
RDF descriptors compute_rdf
RDF descriptorscompute_rdf

Radial distribution function descriptor of the geometry.

return sci.compute_rdf(elements, coords, "[]", 100.0, 8.0, 20);
GETAWAY descriptors compute_getaway
GETAWAY descriptorscompute_getaway

Geometry, topology and atom-weights assembly descriptors.

const bonds = JSON.parse(sci.compute_topology(elements, coords)).bonds ?? []; return sci.compute_getaway(elements, coords, J(bonds), 3);
Atomic environment vectors compute_aevs_tm
Atomic environment vectorscompute_aevs_tm

Per-atom symmetry-function vectors used by the ANI potentials (24 elements).

return sci.compute_aevs_tm(elements, coords);
HOSE codes compute_hose_codes
HOSE codescompute_hose_codes

Hierarchically ordered spherical environments of each atom.

return sci.compute_hose_codes("CCO", 3);

Force fields & optimisation

UFF energy compute_uff_energy
UFF energycompute_uff_energy

Universal force field energy of the geometry, in kcal/mol.

return sci.compute_uff_energy(smiles, coords);
UFF energy by term compute_uff_energy_breakdown
UFF energy by termcompute_uff_energy_breakdown

Bond, angle, torsion, inversion and van der Waals contributions.

return sci.compute_uff_energy_breakdown(smiles, coords);
UFF with aromatic heuristics compute_uff_energy_with_aromatic_heuristics
UFF with aromatic heuristicscompute_uff_energy_with_aromatic_heuristics

UFF energy using the aromatic bond-order heuristic.

const b = JSON.parse(sci.embed("c1ccccc1", 42)); return sci.compute_uff_energy_with_aromatic_heuristics("c1ccccc1", J(b.coords));
MMFF94 energy compute_mmff94_energy
MMFF94 energycompute_mmff94_energy

Merck force field energy in kcal/mol.

return sci.compute_mmff94_energy(smiles, coords);
MMFF94 energy by term compute_mmff94_energy_breakdown
MMFF94 energy by termcompute_mmff94_energy_breakdown

Stretch, bend, stretch-bend, torsion, out-of-plane, vdW and electrostatic parts.

return sci.compute_mmff94_energy_breakdown(smiles, coords);
BFGS geometry optimisation optimize_framework
BFGS geometry optimisationoptimize_framework

Minimises the UFF energy with the shared BFGS engine.

return sci.optimize_framework(smiles, coords, "bfgs", 50, 0.05, 1e-6, 0.2, "[]", "");
Optimise on the EHT surface optimize_geometry_eht
Optimise on the EHT surfaceoptimize_geometry_eht

Geometry optimisation with Extended Hückel forces.

return sci.optimize_geometry_eht(waterEl, waterCo, 20, 0.05, 1e-6, 0.1);
EHT gradient compute_eht_gradient
EHT gradientcompute_eht_gradient

Energy gradient by central differences of the EHT energy.

return sci.compute_eht_gradient(waterEl, waterCo);
PM3 gradient compute_pm3_gradient
PM3 gradientcompute_pm3_gradient

Central differences of the PM3 energy: it always matches the reported energy (eV/Å).

return sci.compute_pm3_gradient(waterEl, waterCo);
xTB (GFN2) gradient compute_xtb_gradient
xTB (GFN2) gradientcompute_xtb_gradient

Central differences of the GFN2 energy (eV/Å).

return sci.compute_xtb_gradient(waterEl, waterCo);

Quantum chemistry

Extended Hückel theory eht_calculate
Extended Hückel theoryeht_calculate

Orbital energies, HOMO/LUMO and gap from a minimal-basis Hückel model.

return sci.eht_calculate(elements, coords, 1.75);
EHT, full solution solve_eht
EHT, full solutionsolve_eht

Same method returning coefficients and the overlap matrix as well.

return sci.solve_eht(waterEl, waterCo, 1.75);
PM3 semi-empirical compute_pm3
PM3 semi-empiricalcompute_pm3

MOPAC-style PM3: total energy (eV), heat of formation (kcal/mol), orbitals.

return sci.compute_pm3(waterEl, waterCo);
xTB (GFN2-xTB) compute_xtb
xTB (GFN2-xTB)compute_xtb

`xtb` is GFN2-xTB in every part of the library.

return sci.compute_xtb(waterEl, waterCo);
GFN1-xTB compute_gfn1
GFN1-xTBcompute_gfn1

Tight-binding with shell-resolved SCC.

return sci.compute_gfn1(waterEl, waterCo);
GFN2-xTB compute_gfn2
GFN2-xTBcompute_gfn2

Tight-binding with multipole electrostatics and D4 dispersion.

return sci.compute_gfn2(waterEl, waterCo);
HF-3c compute_hf3c
HF-3ccompute_hf3c

Minimal-basis Hartree–Fock with the three corrections (D3, gCP, SRB).

return sci.compute_hf3c(waterEl, waterCo);
HF-3c with options compute_hf3c_custom
HF-3c with optionscompute_hf3c_custom

SCF iteration limit, CIS states and the corrections switch.

return sci.compute_hf3c_custom(waterEl, waterCo, 100, 0, true);
Unrestricted Hartree–Fock compute_uhf
Unrestricted Hartree–Fockcompute_uhf

Open-shell SCF: the methyl radical as a doublet.

return sci.compute_uhf("[6,1,1,1]", "[0,0,0,1.09,0,0,-0.36,1.03,0,-0.36,-0.52,0.89]", 0, 2);
Restricted open-shell HF compute_rohf
Restricted open-shell HFcompute_rohf

ROHF for the same radical (no spin contamination).

return sci.compute_rohf("[6,1,1,1]", "[0,0,0,1.09,0,0,-0.36,1.03,0,-0.36,-0.52,0.89]", 0, 2);
CISD excited states compute_cisd
CISD excited statescompute_cisd

Excited states from an internal STO-3G RHF reference.

return sci.compute_cisd(waterEl, waterCo, 3);
Kohn–Sham DFT compute_dft
Kohn–Sham DFTcompute_dft

SVWN or PBE Kohn–Sham on a valence basis (energies in Hartree).

return sci.compute_dft(waterEl, waterCo, "svwn");
ANI neural-network potential compute_ani
ANI neural-network potentialcompute_ani

Machine-learned energy for H, C, N, O, F, S, Cl.

return sci.compute_ani(elements, coords);
Compare methods side by side compare_methods
Compare methods side by sidecompare_methods

Runs several methods on one molecule and tabulates them.

return sci.compare_methods(smiles, elements, coords, true);
EHT with an explicit UFF fallback eht_or_uff_fallback
EHT with an explicit UFF fallbackeht_or_uff_fallback

Never silently substitutes: the result says which method ran.

return sci.eht_or_uff_fallback(smiles, elements, coords, true);
EHT or UFF (typed result) compute_eht_or_uff_fallback
EHT or UFF (typed result)compute_eht_or_uff_fallback

The same decision as a structured result.

return sci.compute_eht_or_uff_fallback(smiles, elements, coords, true);
Which elements EHT supports eht_support
Which elements EHT supportseht_support

Tells whether a set of elements is covered before you compute.

return sci.eht_support(elements);
EHT support (detailed) get_eht_support
EHT support (detailed)get_eht_support

Per-element support and the reason when it is missing.

return sci.get_eht_support(elements);
Method capabilities of a system system_capabilities
Method capabilities of a systemsystem_capabilities

Which methods can handle these elements.

return sci.system_capabilities(elements);
System capabilities (full) get_system_capabilities
System capabilities (full)get_system_capabilities

Capability flags per method.

return sci.get_system_capabilities(elements);
Recommended methods system_method_plan
Recommended methodssystem_method_plan

A suggested method order for this composition.

return sci.system_method_plan(elements);
Method plan (full) get_system_method_plan
Method plan (full)get_system_method_plan

The plan with the reasons attached.

return sci.get_system_method_plan(elements);
Backends usable for paths list_neb_backends
Backends usable for pathslist_neb_backends

Energy backends that can drive a reaction path for these elements.

return sci.list_neb_backends(elements);

Electronic properties & solvation

Mulliken & Löwdin charges compute_population
Mulliken & Löwdin chargescompute_population

Atomic populations from the EHT density.

return sci.compute_population(elements, coords);
Dipole moment compute_dipole
Dipole momentcompute_dipole

Magnitude and components in Debye.

return sci.compute_dipole(elements, coords);
Electrostatic potential compute_esp
Electrostatic potentialcompute_esp

Potential on a 3D grid around the molecule.

return sci.compute_esp_grid_info(waterEl, waterCo, 0.7, 3.0);
ESP grid dimensions compute_esp_grid_info
ESP grid dimensionscompute_esp_grid_info

Origin, spacing and shape of the ESP grid before computing it.

return sci.compute_esp_grid_info(elements, coords, 0.5, 3.0);
Density of states compute_dos
Density of statescompute_dos

Gaussian-broadened DOS and the per-atom projections.

return sci.compute_dos(elements, coords, 0.3, -30, 5, 50);
DOS from any method compute_dos_multimethod
DOS from any methodcompute_dos_multimethod

DOS from EHT, PM3, xTB, GFN1/2 or HF-3c orbital energies.

return sci.compute_dos_multimethod(waterEl, waterCo, "pm3", 0.3, -40, 10, 50);
Frontier-orbital descriptors compute_frontier_descriptors
Frontier-orbital descriptorscompute_frontier_descriptors

HOMO/LUMO-based reactivity indices.

return sci.compute_frontier_descriptors(elements, coords);
Fukui functions compute_fukui_descriptors
Fukui functionscompute_fukui_descriptors

Where a molecule is electrophilic or nucleophilic.

return sci.compute_fukui_descriptors(elements, coords);
Reactive-site ranking compute_reactivity_ranking
Reactive-site rankingcompute_reactivity_ranking

Atoms ranked by their combined reactivity indices.

return sci.compute_reactivity_ranking(elements, coords);
Solvent-accessible surface compute_sasa
Solvent-accessible surfacecompute_sasa

Shrake–Rupley SASA in Ų, total and per atom.

return sci.compute_sasa(elements, coords, 1.4);
Non-polar solvation compute_nonpolar_solvation
Non-polar solvationcompute_nonpolar_solvation

SASA-based non-polar solvation energy.

return sci.compute_nonpolar_solvation(elements, coords, 1.4);
Generalised-Born solvation compute_gb_solvation
Generalised-Born solvationcompute_gb_solvation

Polar solvation energy from partial charges (water by default).

const q = JSON.parse(sci.compute_charges(smiles)).charges; return sci.compute_gb_solvation(elements, coords, J(q), 78.5, 1.0, 1.4);

Spectra

Vibrational frequencies compute_vibrational_analysis
Vibrational frequenciescompute_vibrational_analysis

Normal modes from a numerical Hessian of the chosen method.

return sci.compute_vibrational_analysis(waterEl, waterCo, "pm3", 0.005);
Vibrational analysis with UFF compute_vibrational_analysis_uff
Vibrational analysis with UFFcompute_vibrational_analysis_uff

Frequencies from the UFF Hessian.

return sci.compute_vibrational_analysis_uff(smiles, elements, coords, 0.005);
IR spectrum from an analysis compute_ir_spectrum
IR spectrum from an analysiscompute_ir_spectrum

Lorentzian-broadened spectrum from the vibrational analysis JSON.

const a = sci.compute_vibrational_analysis_uff(smiles, elements, coords, 0.005); return sci.compute_ir_spectrum(a, 15, 400, 4000, 80);
IR spectrum in one call compute_ir_spectrum_broadened
IR spectrum in one callcompute_ir_spectrum_broadened

Runs the analysis and broadens it (Lorentzian or Gaussian).

return sci.compute_ir_spectrum_broadened(waterEl, waterCo, "pm3", 20, 400, 4500, 80, "lorentzian", 0.005, "O");
Assign IR peaks to groups assign_peaks
Assign IR peaks to groupsassign_peaks

Matches peaks to functional groups through group-frequency tables.

return sci.assign_peaks("[3400, 2950, 1050]", "[1.0, 0.6, 0.8]", elements, "[]");
UV–Vis (sTDA) compute_stda_uvvis
UV–Vis (sTDA)compute_stda_uvvis

Excitation energies and oscillator strengths, broadened.

return sci.compute_stda_uvvis(waterEl, waterCo, 0.3, 1.0, 12.0, 60, "gaussian");
UV–Vis from EHT compute_uv_vis_spectrum
UV–Vis from EHTcompute_uv_vis_spectrum

Quick UV–Vis estimate from EHT orbital energies.

return sci.compute_uv_vis_spectrum(elements, coords, 0.3, 1.0, 12.0, 60);
Fluorescence compute_fluorescence
Fluorescencecompute_fluorescence

Emission spectrum with Stokes shift and a dark-state threshold.

return sci.compute_fluorescence(waterEl, waterCo, 0.3, 1.0, 12.0, 60, 0.3, 1.0, 0.001, "gaussian");
NMR spectrum (¹H) compute_nmr_spectrum
NMR spectrum (¹H)compute_nmr_spectrum

Lorentzian-broadened ¹H spectrum predicted from HOSE codes.

return sci.compute_nmr_spectrum("CCO", "1H", 0.02, 0, 12, 100);
NMR spectrum with 3D couplings compute_nmr_spectrum_with_coords
NMR spectrum with 3D couplingscompute_nmr_spectrum_with_coords

Same spectrum with J-couplings from the geometry.

return sci.compute_nmr_spectrum_with_coords(smiles, coords, "1H", 0.02, 0, 12, 100);
NMR shifts predict_nmr_shifts
NMR shiftspredict_nmr_shifts

Predicted ¹H chemical shifts per atom.

return sci.predict_nmr_shifts("CCO");
NMR shifts for a nucleus predict_nmr_shifts_for_nucleus
NMR shifts for a nucleuspredict_nmr_shifts_for_nucleus

Same for ¹³C.

return sci.predict_nmr_shifts_for_nucleus("CCO", "13C");
NMR J-couplings predict_nmr_couplings
NMR J-couplingspredict_nmr_couplings

Karplus-type ³J couplings from the geometry.

return sci.predict_nmr_couplings(smiles, coords);
Boltzmann-averaged J-couplings compute_ensemble_j_couplings
Boltzmann-averaged J-couplingscompute_ensemble_j_couplings

Couplings averaged over a conformer ensemble.

const c = JSON.parse(sci.embed_diverse("CCCC", 3, 0.1, 42n)); const xs = c.map(x => x.coords); return sci.compute_ensemble_j_couplings("CCCC", J(xs), J(xs.map((_, i) => i * 0.5)), 298.15);
GIAO NMR shielding compute_giao_nmr
GIAO NMR shieldingcompute_giao_nmr

Ab-initio shielding tensors (slow; STO-3G).

return sci.compute_giao_nmr(waterEl, waterCo, "1H", 0, 1, 50, true, false);

Orbitals & grids

Orbital isosurface (mesh) eht_orbital_mesh
Orbital isosurface (mesh)eht_orbital_mesh

Marching-cubes mesh of a molecular orbital, ready for WebGL.

return sci.eht_orbital_mesh(waterEl, waterCo, 3, 0.5, 0.05);
Orbital mesh with any method compute_orbital_mesh
Orbital mesh with any methodcompute_orbital_mesh

Isosurface from EHT, PM3, xTB or HF-3c orbitals.

return sci.compute_orbital_mesh(waterEl, waterCo, "eht", 3, 0.5, 3.0, 0.05);
Orbital grid dimensions eht_volumetric_grid_info
Orbital grid dimensionseht_volumetric_grid_info

Grid shape and bounds for volumetric rendering.

return sci.eht_volumetric_grid_info(elements, coords, 0.5, 3.0);

Reactions, paths & kinetics

Apply a SMIRKS reaction apply_smirks
Apply a SMIRKS reactionapply_smirks

Runs a reaction transform on a SMILES and returns the products.

return sci.apply_smirks("[C:1][OH:2]>>[C:1][O:2]C", "CCO");
Parse a SMIRKS parse_smirks
Parse a SMIRKSparse_smirks

Shows the reactant and product patterns and the atom maps.

return sci.parse_smirks("[C:1][OH:2]>>[C:1][O:2]C");
Simplified NEB path (UFF) compute_simplified_neb_path
Simplified NEB path (UFF)compute_simplified_neb_path

A spring-coupled path between two geometries of the same molecule.

const a = J(JSON.parse(sci.embed_coords(smiles, 1)).coords), b = J(JSON.parse(sci.embed_coords(smiles, 2)).coords); return sci.compute_simplified_neb_path(smiles, a, b, 4, 5, 0.1, 0.01);
NEB path with any backend compute_neb_path_with_method
NEB path with any backendcompute_neb_path_with_method

Same path with a chosen energy backend (uff, mmff94, pm3, xtb, gfn1, gfn2, hf3c).

const a = J(JSON.parse(sci.embed_coords(smiles, 1)).coords), b = J(JSON.parse(sci.embed_coords(smiles, 2)).coords); return sci.compute_neb_path_with_method(smiles, a, b, 4, 5, 0.1, 0.01, "uff");
Single-point energy (any backend) neb_single_point_energy
Single-point energy (any backend)neb_single_point_energy

One energy in kcal/mol; no gradient is computed.

return sci.neb_single_point_energy("pm3", smiles, coords);
Energy and gradient (any backend) neb_energy_and_gradient
Energy and gradient (any backend)neb_energy_and_gradient

Energy plus gradient (analytic for force fields, central differences for PM3/xTB).

return sci.neb_energy_and_gradient("uff", smiles, coords);
Molecular dynamics (NVE) compute_md_trajectory
Molecular dynamics (NVE)compute_md_trajectory

Velocity Verlet with the UFF force field.

return sci.compute_md_trajectory(smiles, coords, 20, 0.5, 42);
Molecular dynamics (NVT) compute_md_trajectory_nvt
Molecular dynamics (NVT)compute_md_trajectory_nvt

Berendsen thermostat at a target temperature.

return sci.compute_md_trajectory_nvt(smiles, coords, 20, 0.5, 42, 300, 100);
Molecular dynamics with any backend compute_md_trajectory_with_method
Molecular dynamics with any backendcompute_md_trajectory_with_method

MD driven by uff, pm3 or xtb (GFN2).

return sci.compute_md_trajectory_with_method(smiles, coords, elements, 5, 0.5, 42, 300, "uff");
Reaction path (1D coordinate) compute_reaction_dynamics
Reaction path (1D coordinate)compute_reaction_dynamics

Embeds reactants and products and relaxes a path between them.

return sci.compute_reaction_dynamics(J(["CC=O"]), J(["CC=O"]), "uff", "{}");
Harmonic TST rate compute_htst_rate
Harmonic TST ratecompute_htst_rate

Rate constant from the activation and reaction free energies (eV).

return sci.compute_htst_rate(0.8, -0.2, 298.15);
Rate vs. temperature compute_htst_sweep
Rate vs. temperaturecompute_htst_sweep

The same rate over a list of temperatures.

return sci.compute_htst_sweep(0.8, -0.2, J([250, 300, 350, 400]));
Elementary-step analysis analyze_gsm_mbh_htst_step
Elementary-step analysisanalyze_gsm_mbh_htst_step

GSM + MBH + HTST analysis of one step (reactant/product geometries).

const a = J(JSON.parse(sci.embed_coords(smiles, 1)).coords); return sci.analyze_gsm_mbh_htst_step(smiles, a, a, "uff", 298.15, 1.0);
Kinetics diagnostics extract_kinetics_diagnostics
Kinetics diagnosticsextract_kinetics_diagnostics

Diagnostics of a microkinetic network (demo network).

return sci.extract_kinetics_diagnostics("", 5);
Microkinetic network solve_microkinetic_network
Microkinetic networksolve_microkinetic_network

Time evolution of the populations of a reaction network.

return sci.solve_microkinetic_network("", 5);
Microkinetic steady state solve_microkinetic_steady_state
Microkinetic steady statesolve_microkinetic_steady_state

Steady-state populations by integration to convergence.

return sci.solve_microkinetic_steady_state("", 5, 1e-10);

Crystals & materials

Unit cell create_unit_cell
Unit cellcreate_unit_cell

Lattice vectors, volume and parameters from a, b, c, α, β, γ.

return sci.create_unit_cell(5.0, 5.0, 5.0, 90, 90, 90);
Assemble a framework assemble_framework
Assemble a frameworkassemble_framework

Builds a periodic framework from a topology and a metal node.

return sci.assemble_framework("pcu", 30, "octahedral", 10.0, 1);
Periodic molecular graph build_periodic_molecule
Periodic molecular graphbuild_periodic_molecule

Bonds across cell boundaries from fractional coordinates.

return sci.build_periodic_molecule("[11,17]", "[[0,0,0],[0.5,0.5,0.5]]", J([5.64,5.64,5.64,90,90,90]), 0.3);
Hapticity detect_hapticity
Hapticitydetect_hapticity

Finds η-bonded rings in organometallic complexes.

return sci.detect_hapticity(elements, coords, "[]");
Space group by number space_group_by_number
Space group by numberspace_group_by_number

Symbol, system and symmetry operations of group 225.

return sci.space_group_by_number(225);
Space group by symbol space_group_by_symbol
Space group by symbolspace_group_by_symbol

Look up a group by its Hermann–Mauguin symbol.

return sci.space_group_by_symbol("P1");
All 230 space groups all_space_groups
All 230 space groupsall_space_groups

The complete list, for building selectors.

return sci.all_space_groups();
Parse a CIF parse_cif
Parse a CIFparse_cif

Crystal structure from CIF text.

return sci.parse_cif("data_test\n_cell_length_a 5.0\n_cell_length_b 5.0\n_cell_length_c 5.0\n_cell_angle_alpha 90\n_cell_angle_beta 90\n_cell_angle_gamma 90\nloop_\n_atom_site_label\n_atom_site_type_symbol\n_atom_site_fract_x\n_atom_site_fract_y\n_atom_site_fract_z\n_atom_site_occupancy\nNa1 Na 0.0 0.0 0.0 1.0\n");
Write a CIF write_cif
Write a CIFwrite_cif

Round trip: CIF text → structure → CIF text.

const s = sci.parse_cif("data_test\n_cell_length_a 5.0\n_cell_length_b 5.0\n_cell_length_c 5.0\n_cell_angle_alpha 90\n_cell_angle_beta 90\n_cell_angle_gamma 90\nloop_\n_atom_site_label\n_atom_site_type_symbol\n_atom_site_fract_x\n_atom_site_fract_y\n_atom_site_fract_z\n_atom_site_occupancy\nNa1 Na 0.0 0.0 0.0 1.0\n"); return sci.write_cif(s);

Machine learning

Random forest train_random_forest
Random foresttrain_random_forest

Trains a regressor on a small feature table and reports the fit.

const X = [[0],[1],[2],[3],[4],[5]], y = [0,1,4,9,16,25]; return sci.train_random_forest(J(X), J(y), 20, 4, 2, 1, 0.8, 42n);
Gradient boosting train_gradient_boosting
Gradient boostingtrain_gradient_boosting

Boosted trees on the same table.

const X = [[0],[1],[2],[3],[4],[5]], y = [0,1,4,9,16,25]; return sci.train_gradient_boosting(J(X), J(y), 30, 0.1, 3, 2, 1, 0.8, 42n);

Utilities

Library version version
Library versionversion

The version of the compiled package that is running in your browser.

return sci.version();
Worker count estimate_workers
Worker countestimate_workers

How many workers to use for a batch of a given size.

return J(sci.estimate_workers(1000, 8));

Electrochemistry, periodic systems & charts

Double-layer potential profile compute_edl_profile
Double-layer potential profilecompute_edl_profile

Potential versus distance from an electrode (Helmholtz, Gouy–Chapman or GCS).

return sci.compute_edl_profile(0.1, "gouy-chapman", 0.1, 298.15, 20, 20);
Helmholtz layer compute_helmholtz_profile
Helmholtz layercompute_helmholtz_profile

The compact-layer model.

return sci.compute_helmholtz_profile(0.05, 0.1);
Gouy–Chapman layer compute_gouy_chapman_profile
Gouy–Chapman layercompute_gouy_chapman_profile

The diffuse-layer model.

return sci.compute_gouy_chapman_profile(0.05, 0.1);
Gouy–Chapman–Stern compute_gcs_profile
Gouy–Chapman–Sterncompute_gcs_profile

A Stern layer in series with the diffuse layer.

return sci.compute_gcs_profile(0.05, 0.1, 3.0);
Capacitance vs. potential compute_edl_capacitance_scan
Capacitance vs. potentialcompute_edl_capacitance_scan

Differential capacitance over a potential window.

return sci.compute_edl_capacitance_scan(-0.3, 0.3, 7, 0.1, "gouy-chapman");
EDL chart compute_edl_chart
EDL chartcompute_edl_chart

The profile as a ready-to-plot chart payload.

return sci.compute_edl_chart(0.1, 0.1);
Capacitance chart compute_capacitance_chart
Capacitance chartcompute_capacitance_chart

The scan as a chart payload.

return sci.compute_capacitance_chart(-0.5, 0.5, 11, 0.1, "gouy-chapman");
k-point mesh compute_kmesh
k-point meshcompute_kmesh

A Monkhorst–Pack mesh of the Brillouin zone with its weights.

return sci.compute_kmesh("[2,2,2]", "monkhorst-pack");
Check k-point weights validate_kmesh_weights
Check k-point weightsvalidate_kmesh_weights

Verifies that the weights of a mesh sum to one.

return sci.validate_kmesh_weights("[0.25,0.25,0.25,0.25]", 1e-9);
Bloch phase bloch_phase
Bloch phasebloch_phase

The phase factor exp(i k·T) of a lattice translation.

return sci.bloch_phase(0.5, 0, 0, 1, 0, 0);
Bloch Hamiltonian build_bloch_hamiltonian
Bloch Hamiltonianbuild_bloch_hamiltonian

H(k) built from real-space blocks (a 1D tight-binding chain).

return sci.build_bloch_hamiltonian(J([{matrix:[[-1.0]],translation:[0,0,0]},{matrix:[[-0.5]],translation:[1,0,0]},{matrix:[[-0.5]],translation:[-1,0,0]}]), 0.25, 0, 0);
Operators on a k-mesh assemble_periodic_operators
Operators on a k-meshassemble_periodic_operators

H(k) and S(k) on every point of a mesh.

return sci.assemble_periodic_operators(J([{matrix:[[-1.0]],translation:[0,0,0]},{matrix:[[-0.5]],translation:[1,0,0]},{matrix:[[-0.5]],translation:[-1,0,0]}]), J([{matrix:[[1.0]],translation:[0,0,0]}]), "[4,1,1]", "monkhorst-pack");
Periodic density of states compute_periodic_dos
Periodic density of statescompute_periodic_dos

KPM density of states of the tight-binding chain.

return sci.compute_periodic_dos(J([{matrix:[[-1.0]],translation:[0,0,0]},{matrix:[[-0.5]],translation:[1,0,0]},{matrix:[[-0.5]],translation:[-1,0,0]}]), "[8,1,1]", "monkhorst-pack", 30, -3, 1, 40, null);
Randomised periodic solver solve_periodic_randnla
Randomised periodic solversolve_periodic_randnla

Nyström/RandNLA solution of the periodic eigenproblem.

return sci.solve_periodic_randnla(J([{matrix:[[-1.0,-0.2],[-0.2,-0.6]],translation:[0,0,0]},{matrix:[[-0.3,0],[0,-0.2]],translation:[1,0,0]},{matrix:[[-0.3,0],[0,-0.2]],translation:[-1,0,0]}]), J([{matrix:[[1,0],[0,1]],translation:[0,0,0]}]), 2, "[2,1,1]", "monkhorst-pack", null);
Brillouin-zone integral (scalar) bz_integrate_scalar
Brillouin-zone integral (scalar)bz_integrate_scalar

Weighted average of a scalar over the k-mesh.

return sci.bz_integrate_scalar("[1,2,3,4]", "[0.25,0.25,0.25,0.25]");
Brillouin-zone integral (vector) bz_integrate_vector
Brillouin-zone integral (vector)bz_integrate_vector

Weighted average of a vector quantity.

return sci.bz_integrate_vector(J([[1,0,0],[0,1,0]]), "[0.5,0.5]");
Check the electron count validate_electron_count
Check the electron countvalidate_electron_count

Whether the electrons fit the bands of the mesh.

return sci.validate_electron_count(2, 2, 4);
Band-structure chart compute_band_structure_chart
Band-structure chartcompute_band_structure_chart

Bands along a high-symmetry path, as a chart payload.

return sci.compute_band_structure_chart("[6]", "[0,0,0]", "[3,0,0,0,3,0,0,0,3]", 3);
DOS chart compute_dos_chart
DOS chartcompute_dos_chart

A density of states as a chart payload.

return sci.compute_dos_chart("[-1,0,1]", "[0.1,0.5,0.1]");
k-path chart compute_kpoint_path_chart
k-path chartcompute_kpoint_path_chart

The high-symmetry path through the Brillouin zone.

return sci.compute_kpoint_path_chart(5);
Fermi-surface chart compute_fermi_surface_chart
Fermi-surface chartcompute_fermi_surface_chart

Constant-energy contour of a 2D band.

return sci.compute_fermi_surface_chart(J([{matrix:[[-1.0]],translation:[0,0,0]},{matrix:[[-0.5]],translation:[1,0,0]},{matrix:[[-0.5]],translation:[-1,0,0]}]), null, 4, 4);
Arrhenius chart compute_arrhenius_chart
Arrhenius chartcompute_arrhenius_chart

ln k against 1/T.

return sci.compute_arrhenius_chart("[300,400,500]", "[0.001,0.1,5]");
Thermal-properties chart compute_thermal_prop_chart
Thermal-properties chartcompute_thermal_prop_chart

Rate and equilibrium constants against temperature.

return sci.compute_thermal_prop_chart(0.8, -0.2, "[300,400,500]");
Phase portrait compute_phase_portrait_chart
Phase portraitcompute_phase_portrait_chart

Population trajectory of the demo microkinetic network.

return sci.compute_phase_portrait_chart("", 5);
Path trajectory chart compute_trajectory_chart
Path trajectory chartcompute_trajectory_chart

The path between two geometries as a chart payload.

const a = J(JSON.parse(sci.embed_coords(smiles, 1)).coords), b = J(JSON.parse(sci.embed_coords(smiles, 2)).coords); return sci.compute_trajectory_chart(smiles, a, b, "uff");
Reaction-coordinate chart compute_reaction_coordinate_chart
Reaction-coordinate chartcompute_reaction_coordinate_chart

Energy along the path as a chart payload.

const a = J(JSON.parse(sci.embed_coords(smiles, 1)).coords), b = J(JSON.parse(sci.embed_coords(smiles, 2)).coords); return sci.compute_reaction_coordinate_chart(smiles, a, b, "uff");
Chart to JSON chart_to_json
Chart to JSONchart_to_json

Serialises a chart payload.

return sci.chart_to_json(sci.compute_dos_chart("[-1,0,1]", "[0.1,0.5,0.1]"));
Chart from JSON chart_from_json
Chart from JSONchart_from_json

Parses a chart payload back.

return sci.chart_from_json(sci.chart_to_json(sci.compute_dos_chart("[-1,0,1]", "[0.1,0.5,0.1]")));
Validate a chart validate_chart_schema
Validate a chartvalidate_chart_schema

Checks that a payload follows the chart schema.

return J({ valid: sci.validate_chart_schema(sci.compute_dos_chart("[-1,0,1]", "[0.1,0.5,0.1]")) });

Released under the MIT License.