Repository navigation
Project Format
A FormChem drawing is a .fchem file: a zip package with MIME type application/x-formchem. The full contract (every field, the style sheet, the ops and transactions, validation and coalescing) is docs/FORMAT.md. This page is the short tour.
| Entry | What it is |
|---|---|
mimetype |
application/x-formchem, the first entry, stored uncompressed |
document.json |
The document: pages, structures, text and their styles, UTF-8 |
media/[id].[ext] |
Pictures placed in the document |
thumbs/page-[n].png |
Optional page previews, 512 px on the longer side |
The engine writes the package to a temporary file in the same folder and renames it into place, so a failed save never leaves half a file. Readers ignore entries they do not know. When the code disagrees with FORMAT.md, the code is the bug, and a format change updates FORMAT.md, the window model (frontend/src/engine/model.ts) and the engine model (backend/app/services/model.py) together.
- Units are points (1/72 inch); x runs right, y runs down; angles are degrees counter-clockwise as the person sees the page.
-
stylenames a preset (journal-1996by default: bond length 14.4 pt, line width 0.6 pt, bold width 2.0 pt, Arimo labels at 10 pt) and any fields set on top of it. New drawings take the preset and the numbers from Preferences > Drawing. -
pagesis a list; each page has a size, margins and anorderof object ids. -
objectsis a map by id. A fragment (kind: "fragment") holdsatomsandbondsmaps; text objects carry runs of styled text. - Ids are short random strings, stable for life and never reused in a document. Agents, extensions and the renderer address everything by id.
- From 0.5.0 the other object kinds are drawn:
arrow(15 types, heads at either end, a signedbend, andanchorsthat tie an end to an atom, a lone pair, a bond or the space between two atoms),plus,bracket,shape,line,table,tlc,orbital,imageandcaption. Agrouplists itschildrenback to front; members are in no pageorder. - A
captionhas atarget(the structure it belongs to) and anoffsetfrom the target's bottom centre; itsx,yare a cache kept in step whenever the target or the caption moves. Compound numbers arenumber: {auto: true, value: "1"}. -
page.reactionslists reactions and their steps: the arrow, the reactant, product, agent and condition object ids,explicit(roles set by hand or by a file, kept by perception), optionalcoefficients, and optionalstoich, the amounts you typed in the Stoichiometry panel (scale_mmol,limiting,product,isolated_mg, and per componentequiv,mass_mg,volume_ml,density_g_ml,conc_m,purity_pct,mw). Moles, masses implied by equivalents, the limiting reagent and yields are worked out, never stored. Atablewithstoich: {reaction, step}is a stoichiometry grid. Atom map numbers aremapon atoms and reacting marksreactingon bonds. - From 0.6.0 a fragment may carry
stereo_groups(enhanced stereo:{kind: "abs"},{kind: "and", n: 1, atoms: [...]},{kind: "or", n: 2, atoms: [...]}) andchiral(absolute,relativeorracemic). For the chemistry,relativeputs every stereocentre in no group into one OR group andracemicinto one AND group, each with the next free number;absolutealso sets the molfile chiral flag. - An atom's
queryholds its query features:listandnot,generic(A, AH, Q, QH, X, XH, M, MH),ring_bonds,subst,unsat,h_min,aromatic, and from 0.6.0smarts, the SMARTS text of an atom query the other fields cannot express (SMARTS import writes it; it wins over the other fields). A bond'squeryisany,single_or_double,single_or_aromaticordouble_or_aromatic, andtopologyisringorchain. -
rgroupson a scaffold fragment define its R-groups by number:members(fragment ids),occurrence,rest_h,if_then, andattach, a map of member fragment id to its attachment atom ids. A member without anattachentry attaches at its atoms withdata.attach1 or 2, else at its*stubs (no label, one bond, standing for the R atom), else at its first atom. -
expansionshold what an abbreviation atom stands for (its atoms, bonds, attachment atoms and reversed label);sourceisbuiltinwhen the expansion came from the shipped library anduserotherwise. -
mediamaps a media id to{name, mime, bytes, w, h, sha256}; animageobject names the id. The bytes go into the package asmedia/[id].[ext], and only ids listed inmediaare written.
The engine's chemistry (canonical SMILES, InChI and InChIKey, formula, masses, elemental analysis, implicit hydrogens, valence errors, warnings, from 0.5.0 the balance check of every reaction step, and CIP labels that follow the stereo groups and the chiral flag) is a derived cache. It is rebuilt when a drawing opens and broadcast after every change, keyed by fragment id and document revision, and never saved. Undo history is kept per open drawing by the engine and is not saved either.
Every change is a transaction: a list of set, ins, del and move ops on JSON paths into document.json, applied all or nothing, with the inverse ops kept for undo. One gesture, one command or one agent call is one transaction and one undo step. See Architecture for how a transaction travels from the window to the engine and back.
Molfile, SDF, RXN, SMILES and CXSMILES, InChI, CML and CDXML files open as new, unsaved drawings laid out at the drawing's bond length; RXN files and CML or CDXML files with a reaction open as drawn schemes with their roles set. A reaction step exports as reaction SMILES or RXN (V2000 or V3000) from 0.5.0 (Reactions); exporting whole drawings to the other formats arrives in 0.7.0. From 0.6.0 the engine also writes and reads V3000 molfiles with query features, enhanced stereo and R-group blocks, and SMARTS for query structures (Stereo and Queries); a molfile with its chiral flag at 0 opens with its centres absolute. Templates use the document format too (docs/TEMPLATES.md).
FormChem
- Home
- Manual
- Getting Started
- Drawing
- Grid and Page
- Annotations
- Reactions
- Templates
- Printing and pages
- Keyboard Shortcuts
- Stereo and Queries
- Analysis
- Names
- Spectra and NMR
- 3D
- Databases
- Lab Notebook
- Biopolymers
- Live Structures
- Accessibility
- Formats and Export
- Clipboard
- Command Line
- Agents
- Agent Activity
- Terminal
- Extensions
- Project Format
- Architecture
- Desktop
- Troubleshooting
- Development
- Releasing
Documents