HiveBoard Docs Search the docs… Ctrl K Get HiveBoard
Browse the help centre
  1. Help centre
  2. Simulation codes

Engine spec reference

The engine spec format, schema 1: every key a code's YAML file may hold, what each one does, its limits, and the regular expressions both builds share.

15 min read HiveBoard 0.1.7 Updated

In short

  • A spec is one YAML file per code. Only id, name and the file names under detect are required, and an unknown key is refused rather than ignored.
  • files names the roles files play; reads, kinds and values build on those roles; status, progress, metrics, setup, series and headlines say what the job pane shows.
  • A read runs on the cluster with fixed text only and is bounded; every regular expression runs on your computer and must stay inside what Python's re and Go's RE2 both read.
  • structure lists geometry sources in order — xyz, poscar, pdb, gro, or blocks of rows printed in an output.

An engine spec is one YAML file that tells HiveBoard everything about one simulation code: which files a job folder holds, how to recognise them, which kinds of calculation the code runs, what to read from its output, and how that becomes progress, numbers, charts, warnings and a 3-D structure. The twenty built-in codes are written this way, and so is any code you add.

This page lists every key the format (schema 1) has. Both builds of HiveBoard load a spec with the same checks, and a file that breaks one is refused with a message naming the file, the place and the problem. Where the file goes, a complete small example, and how to see whether it loaded are on adding your own code.

The parts of a spec

KeyWhat it holds
schemaThe format version: 1, the only one
id, name, short, family, summaryWho the code is
appearance, priorityThe tag’s colour and icon; who wins a tie
softwareHow the code is installed and run (description only)
files, layoutWhat a job folder holds
detectHow a folder of this code is recognised
readsWhat the summary command fetches
kindsThe kinds of calculation
valuesNumbers and words taken from the text
status, progress, metrics, setup, series, headlines, versionWhat the job pane shows
structureWhere the 3-D geometry comes from
continuationWhy HiveBoard does not restart this code’s runs

Only id, name and, under detect, at least one file-name pattern are required. Apart from the names you choose — of roles, reads and values — every key must be one this page lists: a misspelt key is refused, not ignored.

Who the code is

schema: 1
id: mycode
name: MyCode
short: MyCode
family: other
summary: Our group's own solver
appearance:
  hue: 30
  glyph: flask
priority: 50
  • id — lower-case letters, digits and _, starting with a letter, up to 32 characters; not all or auto. It is what a server’s apps: list names, and a file with a built-in code’s id replaces that code.
  • name — up to 60 characters.
  • short — the text on the code’s tag, at most 10 characters; the first 10 of name when left out.
  • family — molecular-qc, periodic-dft, classical-md, kmc or other (the default): the group the catalogue and the Software tab list it under.
  • summary — one line, up to 200 characters, shown under the code’s name in the catalogue, beside it on a server’s Software tab, and when you point at its tag.
  • appearance — hue, from 0 to 360 (210 when left out), the tag’s colour; and glyph, its icon (see Glyphs; dot when left out).
  • priority — 0 to 100, 50 when left out. When two codes are equally sure of a folder, the higher priority wins.
  • native — names a hand-written reader, such as VASP’s and ORCA’s. Only built-in specs use it; leave it out.

software

software:
  executables: [mycode]
  modules: [mycode]
  version_command: "mycode --version"
  version_regex: '(?P<version>\d+(\.\d+)+)'
  run: "srun mycode job.mci > job.mco"
  homepage: https://mycode.example.edu
  license: GPL-3.0

How the code is installed and started: its program names, the names of its environment modules, a command that prints its version and a pattern for the number, a typical command line, a homepage and a licence. HiveBoard does not use this section to read jobs and runs nothing from it. executables and modules are lists; version_regex follows the regular-expression rules.

files — the roles files play

files:
  input:
    patterns: ["*.mci"]
    exclude: ["*.bak.mci"]
    containing: ["task ="]
    pick: newest
    note: Input deck
  output:
    patterns: ["*.mco"]
    note: Main output
  log:
    beside: input
    suffixes: [".log", ".err"]
    note: Messages beside the input

files names the roles files play, and everything else in the spec refers to roles, never to file names. A role name is lower-case letters, digits and _.

KeyWhat it does
patternsFile-name patterns, tried together
excludePatterns to leave out
containingKeep only a file that contains one of these texts (fixed text, any case)
pickWhen several files match: newest (default), first (by name) or largest
beside, suffixesThe file named like another role’s, with one of these endings
noteWhat the Files tab says the file is

A role with beside needs no patterns: with input being job.mci, the log above is job.log or job.err. The role it sits beside must be defined above it. Each note appears in the Files tab’s What it is column and in Folders, where a selected folder lists what a folder of its code holds.

Two role names are special:

  • input — its text decides the kind of calculation, and its first 16 kB are available to values and kinds as the source input.
  • output — its age gives the warning “No output update for N min — job may be stalled.” when a running job’s output has not changed for more than 15 minutes. In a spec without an output role, the first role it reads — in the order files lists them, input included — is watched instead.

layout

layout:
  - pattern: "*.chk"
    role: Checkpoint
    large: true
  - pattern: "[0-9][0-9]"
    role: Image folder

Other things a folder may hold, for description only. role is the text the Files tab shows for a matching file or folder; large: true makes the Files tab ask before downloading it.

detect

detect:
  listing:
    strong: ["*.mci"]
    weak: ["*.out", "*.log"]
  content:
    input: ['(?im)^\s*task\s*=']
    output: ['MyCode version \d']
  • listing.strong — names that mean this code and no other.
  • listing.weak — names many codes share; on their own they only make the code a candidate.
  • content.input, content.output — patterns tried on the first bytes of the input and output files: up to 6 kB of an input, 1.5 kB of an output. Only these two roles can carry a signature, and only if files defines them.

At least one of strong and weak is required: a code is a candidate for a folder only when one of its names is there. A signature then beats a strong name, which beats a weak one; a weak name alone counts only for a code that has no signature to check. Ties go to the higher priority. The whole procedure is on how codes are recognised.

reads — what the summary fetches

reads:
  head:
    file: output
    how: head
    bytes: 9000
  tail:
    file: output
    how: tail
    bytes: 6000
  energies:
    file: output
    how: grep
    needle: "Total energy ="
    max: 400
  nsteps:
    file: output
    how: count
    needle: "Total energy ="

Each read becomes a named piece of text that values, kinds, status and version can use. A read names a role (file) and one of four ways (how):

howFetchesIts keys
headThe first bytes of the filebytes: 8,000 by default, at most 2,000,000
tailThe last bytes of the filebytes, as above
grepThe lines that contain needle — the last max of themneedle, max (400 by default, at most 5,000), first, icase
countHow many lines contain needleneedle, icase

first: true keeps the first lines instead of the last; icase: true ignores case. A needle is fixed text, up to 200 characters, never a pattern: it runs on the cluster, over files that can be gigabytes long. The patterns run on your computer, on the lines that came back. A spec holds at most 40 reads. A read of a role that has no file in the folder gives empty text.

kinds — the kinds of calculation

kinds:
  - id: neb
    label: "NEB ({images} images)"
    glyph: path
    when:
      input: '(?i)images\s*=\s*(?P<images>\d+)'
  - id: opt
    label: Optimisation
    glyph: relax
    hint: Geometry optimisation
    when:
      input: '(?im)^\s*task\s*=\s*opt'
  - id: single
    label: Single point
    glyph: bolt

The first kind whose when patterns all match wins. A kind without when is the default and must come last; a spec with no kinds calls every job “Run”.

  • when maps a source — input, or the name of a read — to a pattern. Named groups in the pattern can be used in the label, as {images} is above.
  • id — up to 24 characters: lower-case letters, digits, _ and -.
  • label — up to 40 characters; hint — up to 160, shown when you point at the kind in the catalogue; glyph — its icon. (icon, a one-character symbol from before glyphs, is still accepted; the page draws glyph.)

In the job list only the top of the input is available, so a kind whose rule reads anything else is decided when the job is opened.

values — numbers and words from the text

values:
  energy:
    from: energies
    regex: '=\s*(?P<v>-?\d+\.\d+)'
  energies:
    from: energies
    regex: '=\s*(?P<v>-?\d+\.\d+)'
    take: all
  steps:
    from: nsteps
    regex: '(?P<v>\d+)'
    type: int
  maxsteps:
    from: input
    regex: '(?i)maxsteps\s*=\s*(?P<v>\d+)'
    type: int
    default: 100
  method:
    from: head
    regex: 'Method: (?P<m>\S+)'
    group: m
    type: str
KeyWhat it does
fromA read, or input
regexOne pattern, or a list tried in order until one matches
groupThe named group that holds the value; v by default, the whole match when there is none
takelast (default), first, all (every match: a curve), count, max, min, sum
typefloat (default; Fortran’s 1.0D-05 is read), int, str
scaleA factor, for converting units
defaultThe value when nothing matched

A list of patterns is how a spec follows an output format that changed between versions of a program. A text value has its runs of spaces closed up. Value names are lower-case letters, digits and _, and cannot be kind, engine, n or version.

status — finished, converged, errors, warnings

status:
  finished:
    from: tail
    regex: 'MyCode finished'
  converged:
    - when: ["kind=opt"]
      from: tail
      regex: 'Geometry converged'
  errors:
    - from: tail
      regex: 'ERROR in (?P<where>\w+)'
      text: "MyCode stopped in {where}."
  warnings:
    - from: tail
      regex: 'SCF not converged'
      text: An SCF cycle did not converge.
  • finished and converged — one marker or a list; the first marker that applies and is found sets the flag.
  • errors and warnings — lists; every one that applies and is found is shown, errors first. Their text can use the pattern’s named groups.

A marker’s when can only name kinds (kind=…): “converged” is often a different line for a relaxation than for a single point. A job the output says has finished, with no error, is at 100 %.

progress

progress:
  - when: ["kind=opt"]
    done: steps
    total: maxsteps
    unit: step

The first rule whose when holds and whose done and total values both have numbers (with total above 0) sets the progress bar. unit names a step in the time-left estimate: “~300s per step × up to 18 left (often finishes sooner)”. The time per step is the time used divided by the steps done, unless rate names a value that gives seconds per unit, for an output that states it. The estimate never runs past the wall-time limit. With no rule that applies, progress is the share of the wall-time limit used.

metrics and setup

metrics:
  - label: Energy
    value: "{energy:.6f} Ha"
    hint: The latest total energy
  - label: Steps
    value: "{steps} / {maxsteps}"
    when: ["kind=opt"]
setup:
  - label: Method
    value: "{method}"
    hint: From the top of the output

metrics are the number cards on the Overview tab; setup rows are the Calculation setup on the Setup tab. Each has a label (up to 60 characters), a value template, an optional hint and when. A row whose template names a value that is missing is left out. When the spec’s version pattern matches, a Version card is added.

series — the charts

series:
  - label: Energy per step
    y: energies
    x_label: step
    y_label: "E − E_last (Ha)"
    transform: relative_last
    min_points: 2
KeyWhat it does
yA value with take: all and numbers: the points, drawn at 1, 2, 3…
x_label, y_labelThe axis titles (step by default)
transformnone (default), relative_last (each point minus the last), relative_first, log10abs (zeros dropped)
scaleA factor applied to the points
targetA value drawn as a threshold line
kindline (default), or profile: an energy along a path, such as NEB images
min_pointsFewer points than this and the chart is not drawn (2 by default)
whenConditions

Comparing jobs finds each job’s curves by their words: a series whose label or y-axis says energy is overlaid as the energy, and one about the SCF whose label says log, converg… or accuracy goes on the SCF chart (comparing jobs).

headlines

headlines:
  - when: [errored]
    text: MyCode stopped with an error.
  - when: [finished]
    text: "Finished after {steps} steps."
  - when: ["kind=opt"]
    text: "Optimising: step {steps} of {maxsteps}."
  - text: MyCode is starting up.

The one-sentence status in the job pane: the first headline whose when holds and whose values all exist. A queued job always reads “Waiting in the queue — nothing has run yet.” When no headline fits, HiveBoard writes one itself: that the code has not written its output yet, or the code’s name and the kind followed by “finished.”, “running.” or “no status in the output.”.

Conditions and templates

Conditions (when) are a list, and all of them must hold:

ConditionHolds when
erroredAn error marker was found
finished, convergedThe marker was found
running, pendingThe scheduler says the job is running, or queued
kind=a|bThe kind is one of these ids
has=nameThe value exists and is not empty

A leading ! negates one: "!has=steps". Quote a condition that starts with ! — YAML gives a leading ! a meaning of its own.

Templates fill in values: {name}, {name:.3f}, {name:.2e} and {name:d}. The precision takes one digit. Without a format a whole number is written plainly and anything else to six significant digits. {kind} (the kind’s label) and {version} are always available.

structure — the 3-D geometry

structure:
  - file: trajectory
    format: xyz
    tail: 300000
    source: optimisation trajectory
    one: current geometry
    label: "step {n}"
    frames: 40
  - file: output
    format: blocks
    source: geometry from the output
    blocks:
      start: '^\s*Coordinates \((?P<units>\w+)\)'
      end: '^\s*Total energy'
      row:
        '(?P<el>\w+) +(?P<x>\S+) +(?P<y>\S+) +(?P<z>\S+)'
    lattice:
      - start: '^\s*Cell \((?P<units>\w+)\)'
        row: '(?P<x>\S+) +(?P<y>\S+) +(?P<z>\S+)'
  - file: input
    format: blocks
    head: 50000
    tail: 0
    input: true
    source: input geometry
    blocks:
      start: '(?i)^\s*geometry'
      row:
        '(?P<el>\w+) +(?P<x>\S+) +(?P<y>\S+) +(?P<z>\S+)'

Sources are tried in order, and the first that yields atoms is shown. A queued job only ever shows a source marked input: true, its starting geometry; files older than the job are labelled as left by an earlier run rather than shown as its trajectory.

KeyWhat it does
fileA role
formatxyz, poscar, pdb, gro or blocks
head, tailBytes to fetch from the start and from the end; tail is 300,000 by default, each at most 2,000,000
unitsangstrom (default), bohr or nm
source, one, labelWhat the viewer calls the source; what it calls a single frame; each frame’s label
framesKeep at most this many frames, the last ones (40 by default, up to 200)
inputtrue for the starting geometry

The formats:

  • xyz — one frame or many; an extended-XYZ Lattice="…" comment gives the cell.
  • poscar — VASP’s POSCAR / CONTCAR.
  • pdb — ATOM/HETATM records, MODEL frames, the CRYST1 cell.
  • gro — GROMACS .gro (in nm), any number of frames, with the box.
  • blocks — geometry printed as rows of text, which is how almost every program reports it in its output.

blocks

  • start — the line that begins a block; it may capture units. Without it the whole text is one frame, which is right for an input file.
  • skip — lines between the start line and the first row (0 to 50).
  • row — must capture x, y, z, and either el (an element symbol; Fe1 and FE are understood) or Z (an atomic number).
  • end — optional. Without it, the first line that is not a row ends the block; with it, the block runs to the end line.

The rows above match any four words, to keep the example short; a real spec writes the numbers strictly, such as -?\d+\.\d+, so that no other line can pass for an atom. Units for blocks can also be alat, which needs an alat: pattern whose first group is the length in bohr, and crystal, fractional or direct, converted with the cell.

lattice

The cell for a blocks source: one rule, or a list tried in order. Each has a start line, then three rows that capture x, y and z (after skip lines), and units when the start line does not say. The last cell the text prints is the one used.

version and continuation

version:
  from: head
  regex: 'MyCode version (?P<v>[\d.]+)'
continuation:
  reason: MyCode runs are restarted by hand.

version adds a Version card: the group v (or version), or the whole match. continuation.reason is a sentence on why HiveBoard does not restart this code’s runs. A spec cannot make HiveBoard continue a run: that is a VASP action only (continuing a run).

Regular expressions

Both builds run the same patterns — the Python build with Python’s re, the app with Go’s RE2 — so a spec may use only what the two share. A pattern that steps outside is refused when the spec loads, by both, with a message naming what it used.

  • No look-ahead or look-behind, no back-references (numbered or (?P=name)), no possessive quantifiers, no atomic groups, no conditionals, no (?#comments). Named groups are written (?P<name>...).
  • Flags i, m and s only, at the very start ((?im)^...) or scoped ((?i:...), (?-i:...)). No verbose mode, no flag in the middle of a pattern, none switched off for the whole pattern.
  • \d, \w, \s and \b are ASCII in both: \s does not cross a no-break space, \w stops at Å or µ. Write such a character literally.
  • No POSIX classes ([[:digit:]]), no \p{...}, no \Q...\E, no \x{...}, no \N, \u or \U; write {0,3}, not {,3}.
  • No end-of-text anchor (\Z, \z). A value or marker is searched for in the whole text of its read, so anchor to a line with (?m)^...$. For the last line of the text, end the pattern with \s*$, never a bare $. Rows and block markers under structure are tried one line at a time.

File-name patterns

Patterns in files, layout and detect may hold letters, digits and . _ - * ? [ ], and / for a sub-folder: no spaces, no leading -, / or ~, and no ... A pattern is expanded by the cluster’s shell, so it may not be able to name anything outside the job folder. Patterns are matched with case: INCAR does not match incar.

Writing it in YAML

  • Write a pattern in single quotes ('\s+'), so backslashes stay as they are. Inside double quotes every backslash must be doubled.
  • Quote text that holds a # after a space, a : , or starts with !, [, {, * or a quote; and, in the one-line {...} form, any text holding a comma, which YAML would cut there.
  • Save the file as UTF-8 text.

Glyphs

atom molecule lattice wave cell path bolt thermo relax scan saddle orbit grid chain dice flask gear curve layers dot — an unknown name is drawn as dot.

What a spec cannot say yet

Schema 1 was written against five codes and then used for twenty. These are some of the places where the built-in specs had to work around it:

  • A structure source takes its cell only from its own text, as three vectors; there is no cell from lengths and angles, and no cell per frame.
  • In the job list a kind is decided from the input alone: a kind set on the job’s command line, as xtb’s is, shows only once the job is opened.
  • Status markers cannot use the scheduler’s state, and there is no “marker absent”.
  • A needle cannot be a pattern, and a read cannot start after the last occurrence of something.
  • A table column is found by its position, never by its header.
  • There is no arithmetic between values, and no plural forms in templates.
  • Every read runs for every job, whatever its kind.

Check yourself

2 quick questions on this page. Nothing is sent anywhere.

  1. In a read with how set to grep, what is the needle?

    • Fixed text — the lines containing it are fetched
    • A regular expression run on the cluster
    • The name of a value to fill in
    • A file-name pattern
    Show the answer

    Fixed text — the lines containing it are fetched A needle is fixed text, because it runs on the cluster over files that can be gigabytes long; patterns run on your computer, on the lines that came back.

  2. Which of these patterns does a spec refuse?

    • (?<=Energy) (?P<v>\S+)
    • (?m)^Energy\s+(?P<v>\S+)
    • (?i:energy)\s+(?P<v>\S+)
    • E\((?P<m>[^)]+)\)
    Show the answer

    (?<=Energy) (?P<v>\S+) Look-behind is not something both builds read, so a spec that uses it is refused when it loads.

Try it in the app

On your own computer, with HiveBoard open. Tick them off as you go.

Written for HiveBoard 0.1.7, the version on the download page. Examples use a made-up cluster (Ember) and person (zoe). Something here not what you see? Report it from the app.

↑ ↓ to moveEnter to openEsc to close