Computational-chemistry-agent-skills gjf-flux
install
source · Clone the upstream repo
git clone https://github.com/jinzhezenggroup/computational-chemistry-agent-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/jinzhezenggroup/computational-chemistry-agent-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/quantum-chemistry/gjf-flux" ~/.claude/skills/jinzhezenggroup-computational-chemistry-agent-skills-gjf-flux && rm -rf "$T"
manifest:
quantum-chemistry/gjf-flux/SKILL.mdsource content
gjf-flux (Gaussian Job File Assembly & Extraction)
gjf-flux is a command-line workflow for modular Gaussian .gjf files:
- Extract a specific section from an existing
(including Link1 multi-step jobs)..gjf - Assemble directives/route/molecule/appendix blocks into a complete
, or merge multiple tasks into a Link1 job..gjf
When to use
Use this skill when you need to:
- Reuse parts of Gaussian inputs across many calculations (e.g., route lines, molecule blocks, basis/constraints appendices).
- Programmatically build
jobs from smaller files (fragments, templates, parameterized directives)..gjf - Inspect/compare
files by extracting specific sections..gjf
Assumptions / Parsing model (important)
gjf-flux assumes a standard Gaussian input layout:
- Link1 steps are separated by a blank line, then
, then a newline.--Link1-- - Within each Link1 step, blocks are separated by blank lines.
- The route section begins at the first line starting with
and continues through subsequent lines.# - A molecule block is detected when the first line of a block looks like paired integers
(e.g.,
or0 1
), representing charge/multiplicity pairs.0 1 0 1 0 1
If a
.gjf deviates from these conventions, extraction may fail or misclassify blocks.
Inputs you should request from the user
When helping a user, clarify:
- Target action: extract vs assemble.
- File paths:
- Existing
to read, or component files to assemble..gjf
- Existing
- For Link1 jobs:
- Which step to extract (
, 0-based), or how many steps to assemble.job_index
- Which step to extract (
- Molecule content:
- Total charge/multiplicity, fragment charge/multiplicity (if using fragments), coordinate format.
- Appendices:
- Whether there are basis sets, ECPs, ModRedundant constraints, etc.
Core commands (cheat sheet)
1) Extract a section from a .gjf
.gjfuvx gjf-flux extract <section_name> <FILE.gjf> [--job_index N]
Where
<section_name> is one of:
directivesroutetitle
ormoleculemolecule-<idx>
orappendixappendix-<idx>
Notes:
is 0-based.<idx>
selects the Link1 step (0-based, default--job_index
).0
Examples:
# Extract the route line from the first Link1 step uvx gjf-flux extract route input.gjf # Extract the second molecule block from step 0 uvx gjf-flux extract molecule-1 input.gjf # Extract the first appendix block from Link1 step 2 uvx gjf-flux extract appendix-0 input.gjf --job_index 2
2) Assemble directives (Link0 commands)
uvx gjf-flux assemble directives --chk FILE --mem SIZE --nprocshared N
This command accepts key/value pairs in the form
--key value.
Examples:
uvx gjf-flux assemble directives --chk job.chk --mem 16GB --nprocshared 16
Tip: redirect to a file for later composition:
uvx gjf-flux assemble directives --chk job.chk --mem 16GB --nprocshared 16 > directives.txt
3) Assemble the route section (#
line)
#uvx gjf-flux assemble route [-l p|n|t|""] <keywords...>
Examples:
#p Opt B3LYP/6-31G(d) uvx gjf-flux assemble route -l p Opt B3LYP/6-31G(d) # Use quotes for keywords with parentheses uvx gjf-flux assemble route -l p "Opt(MaxCycle=100)" "Freq"
Tip:
uvx gjf-flux assemble route -l p "Opt(MaxCycle=100)" "Freq" > route.txt
4) Merge molecule fragments into one molecule block
uvx gjf-flux assemble molecules <frag1.txt> <frag2.txt> ... [--as-fragment] [--charge INT] [--multi INT]
Each fragment file must follow this format:
- Line 1:
(e.g.,charge multiplicity
)0 1 - Following lines: atomic coordinates (Gaussian-style)
Modes:
- Default: merges into a single molecule block.
: assigns--as-fragment
tags and expands the charge/multiplicity header.Fragment=1,2,...
Examples:
# Merge two fragments into a single molecule block uvx gjf-flux assemble molecules fragA.txt fragB.txt > molecule.txt # Merge as fragments, overriding total charge/multiplicity uvx gjf-flux assemble molecules fragA.txt fragB.txt --as-fragment --charge 0 --multi 1 > molecule.txt
5) Assemble appendices
uvx gjf-flux assemble appendices <app1.txt> <app2.txt> ...
Examples:
uvx gjf-flux assemble appendices basis.txt modredundant.txt > appendix.txt
6) Assemble a complete single-step .gjf
.gjfuvx gjf-flux assemble job \ --directives directives.txt \ --route route.txt \ --title "Your title" \ --molecule molecule.txt [molecule2.txt ...] \ [--appendices appendix.txt ...]
7) Merge multiple tasks into a Link1 multi-step job
uvx gjf-flux assemble tasks step1.gjf step2.gjf [step3.gjf ...] > link1.gjf
End-to-end example (one-liners with command substitution)
This example shows a single-step job assembled from:
- directives: produced directly from CLI flags
- route: produced inline from
assemble route - molecule: extracted from an existing
, then re-merged (optionally overriding multiplicity).gjf - appendices: extracted from other
files and concatenated.gjf
Note: This uses bash/zsh process substitution (
). If you are on a shell that does not support it, redirect each block into a file first.<(...)
# 1) Build directives to a file (recommended; easier to audit) uvx gjf-flux assemble directives --chk job.chk --mem 16GB --nprocshared 16 > directives.txt # 2) Assemble a full .gjf using inline-generated route/molecule/appendix blocks uvx gjf-flux assemble job \ --directives directives.txt \ --route <(uvx gjf-flux assemble route -l p "Opt(MaxCycle=100)" "Freq" B3LYP/6-31G(d)) \ --title "Opt+Freq from extracted building blocks" \ --molecule <( \ gjf-flux assemble molecules \ <(uvx gjf-flux extract molecule-0 reactant.gjf) \ fragment_extra.xyz \ --multi 1 \ ) \ --appendices \ <(uvx gjf-flux extract appendix-1 reactant.gjf) \ <(uvx gjf-flux extract appendix-0 reference.gjf) \ app_manual.txt \ > job.gjf
Variants:
- If you only want to reuse an extracted molecule block verbatim (no merge), pass:
--molecule <(uvx gjf-flux extract molecule-0 input.gjf)
- If you are assembling a Link1 workflow, build each step as its own
and then:.gjfuvx gjf-flux assemble tasks step1.gjf step2.gjf > link1.gjf
Recommended workflow (practical)
- Create/derive component blocks:
(fromdirectives.txt
or manual)assemble directives
(fromroute.txt
)assemble route
(frommolecule.txt
or extracted from a priorassemble molecules
).gjf
(optional)appendix.txt
- Assemble a complete job via
.assemble job - If you have multiple steps, build each step as a
and then merge using.gjf
.assemble tasks - Verify by extracting critical sections from the final output.
Common pitfalls
- Wrong indexing:
,job_index
, andmolecule-<idx>
are all 0-based.appendix-<idx> - Non-standard
formatting: unusual blank-line structure can break parsing..gjf - Fragment files must start with
: otherwise molecule merge will fail.charge multiplicity - Keyword quoting: route keywords with parentheses should be quoted in the shell.
Notes for agents
- Prefer asking the user for a concrete example
if parsing fails..gjf - When assembling, keep each component file small and purpose-specific; it makes debugging far easier.
- If the user wants a repeatable pipeline, suggest storing reusable components (route templates, basis set appendices, fragment libraries) in version control.