Skip to content

Commit 49b3942

Browse files
committed
Document how to write parameter files with an LLM
Adds a prompt that can be pasted together with a table of structure parameters from a publication. AI-assisted
1 parent 96922cd commit 49b3942

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎docs/structure_builder.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ may be incomplete.
1313
- [Output and orientation](#output-and-orientation)
1414
- [Command line reference](#command-line-reference)
1515
- [Python API](#python-api)
16+
- [Writing parameter files with an LLM](#writing-parameter-files-with-an-llm)
1617
- [Troubleshooting](#troubleshooting)
1718
- [Limitations](#limitations)
1819

@@ -489,6 +490,40 @@ Further building blocks, which can be used on their own:
489490
| `Molecule.bringToStandardOrientation(center="geometric")` | the orientation described [above](#output-and-orientation) |
490491

491492

493+
## Writing parameter files with an LLM
494+
495+
Structure parameters in publications are usually given as tables of bond lengths and angles. A language model can turn such a table
496+
into a parameter file. Paste the prompt below, followed by the table (and the molecule's point group and atom numbering, if the
497+
source states them), into the model's request, then check the result with `build_structure.py --verbose`.
498+
499+
```text
500+
Write an input file for a molecular structure builder from the parameters below. Output only the file content.
501+
502+
Records, one per line (`#` comment):
503+
C1 - C2 1.34 bond, Angstrom
504+
C1 - H1 bond without value
505+
C1 - C2 - C3 123.5 angle, degrees, middle atom = apex
506+
C1 - C2 - C3 - C4 180 dihedral, degrees
507+
Labels: element symbol + number, unique. Write a 2-label bond record for EVERY bond of the whole molecule (all X-H, ring closures, and every symmetry-equivalent bond, even when the table lists it only once): symmetry never creates bonds. Each parameter once. Only 2-label bond records may omit the value: every angle (3 labels) and dihedral (4 labels) line MUST have a value from the source, so never list an angle or dihedral just to state connectivity or equivalence (the bond records and `@group` do that); leave out angles and dihedrals that the source does not give.
508+
Use ONLY values explicitly given in the source (convert units only). Never invent, estimate or derive any length, angle or dihedral, not even from geometry or symmetry or from other values (e.g. 90, 109.47, 120, 180, 0, or an angle implied by the others): leave it out, the builder fills in crude defaults. Only connectivity (valueless bond records) and symmetry may be inferred from the molecule. Write each given value once, for every symmetry-inequivalent parameter that the source lists.
509+
`@planar`: all atoms in one plane. `@linear`: chain on a line.
510+
511+
Symmetry: if the point group is known, add one line `@group <name>` (Cs, Ci, Cn, Cnv, Cnh, Dn, Dnh, Dnd, S2n, T, Td, Th, O, Oh, I, Ih; n is a number, e.g. C2v, D3h, D6h, Td, Oh). The builder derives the symmetry operations and how they move the atoms from the bonds, so write no other symmetry lines. Parameters of symmetry-equivalent atoms need to be given only once, but the labels must be consistent with the parameters (e.g. if F1 - S1 - F2 is 180, F1 and F2 are opposite).
512+
```
513+
514+
Notes:
515+
516+
- The prompt tells the model to use **only values that the source states**. Missing parameters are left to the builder's
517+
[defaults](#the-default-starting-geometry), which are crude (hydrogen positions in particular); if the result is poor, supply
518+
the missing values yourself or a [starting geometry](#starting-geometry).
519+
- The prompt lets the model state the point group with `@group` only: the builder infers how the operations move the atoms from the
520+
bonds (see [Inferring missing atoms](#inferring-missing-atoms)), so the model does not have to work out frames, axes and
521+
permutations, which is where it makes mistakes. Give the point group only if the source states it.
522+
- Always check the output: the builder reports bonds that the symmetry does not map onto bonds, ambiguous operations and parameters
523+
that are not fulfilled (an over-determined table that was rounded can show deviations of a few hundredths of a degree).
524+
- The atom labels in the generated file are the model's choice, so compare them with the numbering of the source.
525+
526+
492527
## Troubleshooting
493528

494529
| Message / symptom | Cause |

0 commit comments

Comments
 (0)