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 first and parse the molecular formula actually provided
  2. Parse the formula into element counts and classify the formula pattern when helpful
  3. For small common formulas with reliable well-known constitutional-isomer counts, use direct chemistry knowledge or direct enumeration of distinct connectivity families instead of unnecessary full 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. Prune partial candidates early using valence limits, remaining bond total, and connectivity feasibility
  6. Convert valid heavy-atom graphs to implied hydrogen counts and keep only exact formula matches
  7. Deduplicate by canonicalizing only within identical-element groups, then count unique constitutional isomers
  8. Exclude stereoisomers and conformations; count connectivity differences only
  9. Write the result to /root/output.txt exactly as Number of isomers: [count]

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.