$npx -y skills add jinzhezenggroup/computational-chemistry-agent-skills --skill gjf-fluxAssemble and extract Gaussian .gjf input file sections (directives, route, title, molecule blocks, appendices) and build single- or multi-step Link1 jobs from modular component files. USE WHEN needed for generating, refactoring, templating, or scripting Gaussian job files.
| 1 | # gjf-flux (Gaussian Job File Assembly & Extraction) |
| 2 | |
| 3 | `gjf-flux` is a command-line workflow for **modular Gaussian `.gjf` files**: |
| 4 | |
| 5 | - **Extract** a specific section from an existing `.gjf` (including Link1 multi-step jobs). |
| 6 | - **Assemble** directives/route/molecule/appendix blocks into a complete `.gjf`, or merge multiple tasks into a Link1 job. |
| 7 | |
| 8 | ## When to use |
| 9 | |
| 10 | Use this skill when you need to: |
| 11 | |
| 12 | - Reuse parts of Gaussian inputs across many calculations (e.g., route lines, molecule blocks, basis/constraints appendices). |
| 13 | - Programmatically build `.gjf` jobs from smaller files (fragments, templates, parameterized directives). |
| 14 | - Inspect/compare `.gjf` files by extracting specific sections. |
| 15 | |
| 16 | ## Assumptions / Parsing model (important) |
| 17 | |
| 18 | `gjf-flux` assumes a **standard Gaussian input layout**: |
| 19 | |
| 20 | - Link1 steps are separated by a blank line, then `--Link1--`, then a newline. |
| 21 | - Within each Link1 step, blocks are separated by blank lines. |
| 22 | - The **route section** begins at the first line starting with `#` and continues through subsequent lines. |
| 23 | - A **molecule block** is detected when the first line of a block looks like paired integers |
| 24 | (e.g., `0 1` or `0 1 0 1 0 1`), representing charge/multiplicity pairs. |
| 25 | |
| 26 | If a `.gjf` deviates from these conventions, extraction may fail or misclassify blocks. |
| 27 | |
| 28 | ## Inputs you should request from the user |
| 29 | |
| 30 | When helping a user, clarify: |
| 31 | |
| 32 | 1. Target action: **extract** vs **assemble**. |
| 33 | 1. File paths: |
| 34 | - Existing `.gjf` to read, or component files to assemble. |
| 35 | 1. For Link1 jobs: |
| 36 | - Which step to extract (`job_index`, 0-based), or how many steps to assemble. |
| 37 | 1. Molecule content: |
| 38 | - Total charge/multiplicity, fragment charge/multiplicity (if using fragments), coordinate format. |
| 39 | 1. Appendices: |
| 40 | - Whether there are basis sets, ECPs, ModRedundant constraints, etc. |
| 41 | |
| 42 | ## Core commands (cheat sheet) |
| 43 | |
| 44 | ### 1) Extract a section from a `.gjf` |
| 45 | |
| 46 | ```bash |
| 47 | uvx gjf-flux extract <section_name> <FILE.gjf> [--job_index N] |
| 48 | ``` |
| 49 | |
| 50 | Where `<section_name>` is one of: |
| 51 | |
| 52 | - `directives` |
| 53 | - `route` |
| 54 | - `title` |
| 55 | - `molecule` or `molecule-<idx>` |
| 56 | - `appendix` or `appendix-<idx>` |
| 57 | |
| 58 | Notes: |
| 59 | |
| 60 | - `<idx>` is **0-based**. |
| 61 | - `--job_index` selects the Link1 step (**0-based**, default `0`). |
| 62 | |
| 63 | Examples: |
| 64 | |
| 65 | ```bash |
| 66 | # Extract the route line from the first Link1 step |
| 67 | uvx gjf-flux extract route input.gjf |
| 68 | |
| 69 | # Extract the second molecule block from step 0 |
| 70 | uvx gjf-flux extract molecule-1 input.gjf |
| 71 | |
| 72 | # Extract the first appendix block from Link1 step 2 |
| 73 | uvx gjf-flux extract appendix-0 input.gjf --job_index 2 |
| 74 | ``` |
| 75 | |
| 76 | ### 2) Assemble directives (Link0 commands) |
| 77 | |
| 78 | ```bash |
| 79 | uvx gjf-flux assemble directives --chk FILE --mem SIZE --nprocshared N |
| 80 | ``` |
| 81 | |
| 82 | This command accepts key/value pairs in the form `--key value`. |
| 83 | |
| 84 | Examples: |
| 85 | |
| 86 | ```bash |
| 87 | uvx gjf-flux assemble directives --chk job.chk --mem 16GB --nprocshared 16 |
| 88 | ``` |
| 89 | |
| 90 | Tip: redirect to a file for later composition: |
| 91 | |
| 92 | ```bash |
| 93 | uvx gjf-flux assemble directives --chk job.chk --mem 16GB --nprocshared 16 > directives.txt |
| 94 | ``` |
| 95 | |
| 96 | ### 3) Assemble the route section (`#` line) |
| 97 | |
| 98 | ```bash |
| 99 | uvx gjf-flux assemble route [-l p|n|t|""] <keywords...> |
| 100 | ``` |
| 101 | |
| 102 | Examples: |
| 103 | |
| 104 | ```bash |
| 105 | #p Opt B3LYP/6-31G(d) |
| 106 | uvx gjf-flux assemble route -l p Opt B3LYP/6-31G(d) |
| 107 | |
| 108 | # Use quotes for keywords with parentheses |
| 109 | uvx gjf-flux assemble route -l p "Opt(MaxCycle=100)" "Freq" |
| 110 | ``` |
| 111 | |
| 112 | Tip: |
| 113 | |
| 114 | ```bash |
| 115 | uvx gjf-flux assemble route -l p "Opt(MaxCycle=100)" "Freq" > route.txt |
| 116 | ``` |
| 117 | |
| 118 | ### 4) Merge molecule fragments into one molecule block |
| 119 | |
| 120 | ```bash |
| 121 | uvx gjf-flux assemble molecules <frag1.txt> <frag2.txt> ... [--as-fragment] [--charge INT] [--multi INT] |
| 122 | ``` |
| 123 | |
| 124 | Each fragment file must follow this format: |
| 125 | |
| 126 | - Line 1: `charge multiplicity` (e.g., `0 1`) |
| 127 | - Following lines: atomic coordinates (Gaussian-style) |
| 128 | |
| 129 | Modes: |
| 130 | |
| 131 | - Default: merges into a **single** molecule block. |
| 132 | - `--as-fragment`: assigns `Fragment=1,2,...` tags and expands the charge/multiplicity header. |
| 133 | |
| 134 | Examples: |
| 135 | |
| 136 | ```bash |
| 137 | # Merge two fragments into a single molecule block |
| 138 | uvx gjf-flux assemble molecules fragA.txt fragB.txt > molecule.txt |
| 139 | |
| 140 | # Merge as fragments, overriding total charge/multiplicity |
| 141 | uvx gjf-flux assemble molecules fragA.txt fragB.txt --as-fragment --charge 0 --multi 1 > molecule.txt |
| 142 | ``` |
| 143 | |
| 144 | ### 5) Assemble appendices |
| 145 | |
| 146 | ```bash |
| 147 | uvx gjf-flux assemble appendices <app1.txt> <app2.txt> ... |
| 148 | ``` |
| 149 | |
| 150 | Examples: |
| 151 | |
| 152 | ```bash |
| 153 | uvx gjf-flux assemble appendices basis.txt modredundant.txt > appendix.txt |
| 154 | ``` |
| 155 | |
| 156 | ### 6) Assemble a complete single-step `.gjf` |
| 157 | |
| 158 | ```bash |
| 159 | uvx gjf-flux assemble job \ |
| 160 | --directives directives.txt \ |
| 161 | --route route.txt \ |