Single-Point Calculations with Tako Script
On this page
tako.singlePoint evaluates the supplied structure without changing its coordinates or periodic cell. It returns the worker result through a promise and creates the same persistent calculation workspace used by the interface.
The method theory is in Single-Point Energies and Properties. Calculator construction is defined in Calculator Construction and Validation. This chapter owns the executable operation contract.
Operation contract
const result = await tako.singlePoint(structure, {
calculator,
properties,
});
| Argument | Contract |
|---|---|
structure | A Tako structure with atom identities and Cartesian coordinates; cell and periodicity are retained when present |
calculator | A calculator returned by tako.calculator.gfn2(...) or tako.calculator.mlip(...) |
properties | Requested channel names; energy and forces are retained by the calculation system, while additional channels remain calculator- and operation-dependent |
The promise resolves only after a structured result worker event. A worker error, cancellation, reset, or abnormal completion without a result rejects it. A resolved promise says that the result contract completed; scientific acceptance still depends on the fixed geometry, calculator, and requested outputs.
Validate before running
Capability validation is synchronous and should precede asset preparation or numerical work:
const properties = ["energy", "forces", "stress"];
const calculator = tako.calculator.mlip({ levelOfTheory: "nequix" });
const check = calculator.validate("singlePoint", { properties });
if (!check.ok) {
throw new Error(check.reasons.join("; "));
}
const result = await tako.singlePoint(structure, {
calculator,
properties,
});
Validation checks the registered capability profile, not accuracy or training-domain coverage. For GFN2, the operation can additionally produce electronic-analysis channels implemented by Tako. For an MLIP, request only energy, forces, and supported stress.
Complete fixed-geometry calculation
const structure = await tako.input("input/candidate.extxyz");
const calculator = tako.calculator.gfn2({
levelOfTheory: "gfn2",
dispersion: "d4",
charge: 0,
unpaired: 0,
});
const properties = ["energy", "forces", "charges", "dos", "pdos"];
const check = calculator.validate("singlePoint", { properties });
if (!check.ok) throw new Error(check.reasons.join("; "));
const result = await tako.singlePoint(structure, {
calculator,
properties,
});
const energyEv = tako.analysis.energyEv(result);
await tako.output("output/result.json", result);
await tako.output("output/summary.json", {
method: "gfn2",
charge: 0,
unpaired: 0,
properties,
energyEv,
});
Writing result preserves channels not copied into the summary. The summary is a derived record for comparison and should retain the method state needed to interpret its number.
Result fields
The backend result uses engine-facing snake-case fields. Availability depends on the calculator and requested properties.
| Field | Type and unit | Availability and meaning |
|---|---|---|
energy_ev | number, eV | Normal successful energy result; tako.analysis.energyEv(result) also accepts supported alternative energy field conventions |
forces_ev_per_angstrom | array of [x,y,z], eV/Å | Returned when forces are available; one vector per atom in input order |
stress_ev_per_angstrom3 | 3×3 array, eV/ų | Periodic stress when requested and supported |
charges | array of objects | GFN2 population analysis when requested and produced |
charges[].id | integer | Atom identifier copied from input order |
charges[].element | string | Element symbol for the charged atom |
charges[].charge | number, elementary-charge convention | Mulliken atomic charge |
converged | boolean | Always present in the successful base result; electronic/numerical convergence flag |
iterations | integer | Always present in the successful base result; electronic iteration count |
dos, pdos | structured electronic-state data | GFN2 and requested channel only |
electron_density_cube, charge_density_cube | cube content or structured cube payload | Requested and successfully generated volumetric channel |
nci | structured RDG and signed-density data | Requested GFN2 NCI output |
orbital_cubes | array of orbital metadata and cube strings | Requested frontier-orbital amplitudes and optional squared densities |
spin_density_cube, esp_cube | cube strings | Requested spin-density or multipole-ESP channel |
density_derivatives | gradient-norm and Laplacian cubes | Requested density-derivative channel |
fukui | f(+), f(−), and dual-descriptor cubes | Requested channel after separate N/N+1/N−1 SCFs succeed |
elf_cube | cube string | Requested restricted-spin ELF channel |
wavefunction_wfn | string | Requested WFN output |
Do not replace an absent field with zero. Absence can mean that the property was not requested, was unsupported, or failed during post-processing. Inspect the calculation log and capability request.
The single-point result does not publish a dipole field (Known Limitations). Do not infer one from calculator capability metadata or from unrelated excitation-transition dipoles.
tako.analysis.energyEv(result) rejects explicit error results and refuses an explicitly unconverged result. It accepts energy_ev, energyEv, final_energy_ev, finalEnergyEv, supported Hartree fields, nested energy.ev, or the final frame energy. We prefer the native energy_ev field in raw records, and use the helper at analysis boundaries.
Comparable series
To rank several fixed geometries under one declared method, keep the calculator identity and settings outside the loop, run one single point per structure, and subtract a common reference. The worked loop, validation guard, and relative-energy output live in Energy Analysis with Tako Script under “Build a comparable series” — the pattern is identical for single points.
A ranking of fixed geometries does not relax them or demonstrate that they are minima, and the files must have compatible compositions and state conventions before their energy differences are interpreted. For independent candidates, controlled parallelism can reduce wall time, but each call creates its own worker and workspace; avoid launching an unbounded list whose aggregate model memory exceeds the browser budget.
Derived force diagnostics
When the returned force array is present, compute a transparent maximum norm rather than inferring stationarity from the energy. With constraints, these are the constraint-applied forces returned by the operation; without constraints, they are the calculator forces:
const forces = result.forces_ev_per_angstrom;
if (!Array.isArray(forces)) throw new Error("Force array is absent.");
const forceNorms = forces.map(([fx, fy, fz]) =>
Math.hypot(fx, fy, fz));
const maxForceEvPerAngstrom = Math.max(...forceNorms);
await tako.output("output/force-summary.json", {
maxForceEvPerAngstrom,
forceNormsEvPerAngstrom: forceNorms,
});
This is a diagnostic on the fixed geometry. It is not an optimization convergence claim unless its force convention and threshold match the optimization protocol.
Errors and cancellation
| Failure | Promise behavior | Response |
|---|---|---|
| Capability validation fails before the call | No operation promise is created | Change the calculator or property list using every reason returned by validate |
| Asset or engine preparation fails | Promise rejects; workspace records the error | Read output/log.txt and Model Manager state |
| GFN2 SCF fails | Promise rejects or returns an explicit failed result according to the engine path | Correct geometry/electronic state before loosening thresholds |
| User cancels the calculation | Promise rejects with Canceled by user | Catch only when cancellation is an expected branch; no numerical checkpoint is implied |
| Worker finishes without a result | Promise rejects | Treat the workspace as failed execution even if its current status remains displayed as running |
| A requested post-processing field is absent | The core calculation may still have returned | Inspect the log and do not silently substitute an empty array or zero |
GFN2 analyses run sequentially after the core result in the order DOS, PDOS, charges, electron density, charge density, NCI, frontier orbitals, spin density, ESP, density derivatives, Fukui functions, ELF, and WFN. A cumulative partialResult is emitted after each completed stage. If a later stage fails, the overall promise rejects; earlier partial artifacts may remain but are not a completed all-properties result. Cancellation provides no restartable checkpoint.
Catch an expected cancellation narrowly:
try {
await tako.singlePoint(structure, { calculator, properties });
} catch (error) {
if (error instanceof Error && error.message === "Canceled by user") {
await tako.output("output/cancelled.json", { cancelled: true });
} else {
throw error;
}
}
Output discipline
A reusable Script calculation keeps the exact input structure, explicit calculator state, requested property list, raw result, derived summary, and any comparison formula. Do not rely on Console text as the only numerical record. For a property-specific artifact contract, use the generated tako.singlePoint settings reference together with the Calculation Artifact Reference.