Docs are under construction. Content may be incomplete or change.

Single-Point Calculations with Tako Script

Page type: Reference
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,
});
ArgumentContract
structureA Tako structure with atom identities and Cartesian coordinates; cell and periodicity are retained when present
calculatorA calculator returned by tako.calculator.gfn2(...) or tako.calculator.mlip(...)
propertiesRequested 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.

FieldType and unitAvailability and meaning
energy_evnumber, eVNormal successful energy result; tako.analysis.energyEv(result) also accepts supported alternative energy field conventions
forces_ev_per_angstromarray of [x,y,z], eV/ÅReturned when forces are available; one vector per atom in input order
stress_ev_per_angstrom33×3 array, eV/ųPeriodic stress when requested and supported
chargesarray of objectsGFN2 population analysis when requested and produced
charges[].idintegerAtom identifier copied from input order
charges[].elementstringElement symbol for the charged atom
charges[].chargenumber, elementary-charge conventionMulliken atomic charge
convergedbooleanAlways present in the successful base result; electronic/numerical convergence flag
iterationsintegerAlways present in the successful base result; electronic iteration count
dos, pdosstructured electronic-state dataGFN2 and requested channel only
electron_density_cube, charge_density_cubecube content or structured cube payloadRequested and successfully generated volumetric channel
ncistructured RDG and signed-density dataRequested GFN2 NCI output
orbital_cubesarray of orbital metadata and cube stringsRequested frontier-orbital amplitudes and optional squared densities
spin_density_cube, esp_cubecube stringsRequested spin-density or multipole-ESP channel
density_derivativesgradient-norm and Laplacian cubesRequested density-derivative channel
fukuif(+), f(−), and dual-descriptor cubesRequested channel after separate N/N+1/N−1 SCFs succeed
elf_cubecube stringRequested restricted-spin ELF channel
wavefunction_wfnstringRequested 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

FailurePromise behaviorResponse
Capability validation fails before the callNo operation promise is createdChange the calculator or property list using every reason returned by validate
Asset or engine preparation failsPromise rejects; workspace records the errorRead output/log.txt and Model Manager state
GFN2 SCF failsPromise rejects or returns an explicit failed result according to the engine pathCorrect geometry/electronic state before loosening thresholds
User cancels the calculationPromise rejects with Canceled by userCatch only when cancellation is an expected branch; no numerical checkpoint is implied
Worker finishes without a resultPromise rejectsTreat the workspace as failed execution even if its current status remains displayed as running
A requested post-processing field is absentThe core calculation may still have returnedInspect 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.