Isomer counting

From XuShuwenn/RedAct · View interactive version

Isomer counting is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Count structural isomers for a given molecular formula by determining possible constitutional isomer configurations.

How to use this skill

Skill file

Structural Isomer Counting

When to Use

Input Format

File /root/input.txt with molecular formula (e.g., C4H10)

Output Format

To /root/output.txt:

Number of isomers: [count]

Write exactly one line to /root/output.txt with no extra text:

Number of isomers: [count]

Key Concepts

Approach

  1. Read /root/input.txt before doing any chemistry reasoning; extract and use the exact molecular formula found there, not an example formula from the skill or a remembered nearby case
  2. Parse that exact formula into element counts and classify the formula pattern when helpful
  3. For a small, common formula with a reliable well-known constitutional-isomer count, prefer the shortest reliable path: use the direct known result or concise family enumeration instead of unnecessary exhaustive generation
  4. Otherwise, separate hydrogens from heavy atoms, assign standard valences, and enumerate heavy-atom bond graphs whose degrees and bond-order totals can satisfy the formula
  5. If planning to use a chemistry toolkit or external library for enumeration or canonicalization, first confirm it is available in the environment; otherwise use a pure-Python graph-enumeration approach
  6. Prune partial candidates early using valence limits, remaining bond total, and connectivity feasibility
  7. Convert valid heavy-atom graphs to implied hydrogen counts and keep only exact formula matches
  8. Deduplicate by canonicalizing only within identical-element groups, then count unique constitutional isomers
  9. Exclude stereoisomers and conformations; count connectivity differences only
  10. Before finishing, confirm the count corresponds to the exact input formula and to constitutional isomers only
  11. Write exactly one line to /root/output.txt as Number of isomers: [count] with no extra commentary, names of isomers, or extra whitespace
  12. Verify /root/output.txt contains exactly that one required line

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.