vibesketch.inputs

Input writers: from a document’s job to a program’s input files.

>>> from vibesketch.document import load
>>> from vibesketch.inputs import write_input
>>> bundle = write_input(load("ethanol.vsk"), species="m1", program="xyz")
>>> bundle.files[0].name
'm1.xyz'

Every writer fails closed: what it cannot express raises WriterRefusal with the reasons. vibe-sketch writers lists them.

class vibesketch.inputs.Batch(bundles=<factory>, refused=<factory>)

Bases: object

Inputs for several species with one writer and one specification.

Parameters:
bundles: list[InputBundle]
refused: dict[str, list[str]]

Per species id, why the writer refused it.

class vibesketch.inputs.InputBundle(program, species, files)

Bases: object

Everything a writer produced for one job.

Parameters:
program: str
species: str
files: tuple[InputFile, ...]
class vibesketch.inputs.InputFile(name, content, media_type)

Bases: object

One file of a program input.

Parameters:
name: str

Suggested file name, without directories.

content: str
media_type: str
class vibesketch.inputs.InputWriter

Bases: ABC

Translate a job specification into one program’s input, or refuse.

name: ClassVar[str]

The registry name, also the value of Job.program.

description: ClassVar[str]

One line for listings.

tasks: ClassVar[frozenset[Literal['geometry', 'sp', 'opt', 'freq', 'opt+freq', 'tddft', 'nmr']]]

The tasks this writer can express.

fields: ClassVar[frozenset[str]] = frozenset({})

The specification fields, besides task, this writer can express.

refusals(species, spec)

Everything in the request this writer cannot express; empty if it can.

Parameters:
Return type:

list[str]

write(species, spec)

The input files for species and spec; raises WriterRefusal.

Parameters:
Return type:

InputBundle

exception vibesketch.inputs.UnknownReference(kind, identifier)

Bases: KeyError

The document has no job or species with that id.

Parameters:
Return type:

None

exception vibesketch.inputs.UnknownWriter(name)

Bases: LookupError

No writer is registered under that name.

Parameters:

name (str)

Return type:

None

exception vibesketch.inputs.WriterRefusal(program, reasons)

Bases: ValueError

The writer cannot express the request; reasons says what and why.

Parameters:
  • program (str)

  • reasons (Sequence[str])

Return type:

None

vibesketch.inputs.get_writer(name)

The writer registered as name; raises UnknownWriter.

Parameters:

name (str)

Return type:

InputWriter

vibesketch.inputs.register(writer, *, replace=False)

Make writer available under writer.name.

Parameters:
Return type:

None

vibesketch.inputs.write_input(document, *, job=None, species=None, program=None, spec=None)

Write the input for one job of document.

Name a job by its id, or give a species id and a program (with an optional specification; the default is the geometry only). Raises WriterRefusal when the writer cannot express the request, UnknownWriter for an unknown program, and UnknownReference for an id the document does not have.

Parameters:
Return type:

InputBundle

vibesketch.inputs.write_inputs(document, *, program, spec, species=None)

The inputs for species (default: every species) with one writer.

A species the writer refuses is listed in Batch.refused with the reasons, and the others are still written; a proton in a mechanism should not stop the rest of it. Raises UnknownWriter for an unknown program and UnknownReference for an unknown species id.

Parameters:
Return type:

Batch

vibesketch.inputs.writers()

Every registered writer, by name.

Return type:

list[InputWriter]

Modules

base

The input-writer interface.

orca

The ORCA input writer (roadmap WP 2.2).

orca_keywords

The ORCA keyword model: what vibe-sketch knows how to say in ORCA.

qcschema

The QCSchema molecule writer.

registry

The registry of input writers, and the one call that runs them.

vibeqc

The vibe-qc writer: a Python script that runs the job with vibeqc.run_job.

xyz

The XYZ writer: the geometry of one species, nothing else.