MoleCode  by AtomFlow-AI

LLM-native molecular language for direct chemical reasoning

Created 1 month ago
293 stars

Top 90.0% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

MoleCode addresses the challenge of enabling Large Language Models (LLMs) to effectively process and reason about molecular structures. Traditional string-based representations like SMILES require LLMs to expend significant reasoning budget on reconstructing implicit graph structures. MoleCode solves this by presenting molecules as explicit, graph-based code, allowing LLMs to directly read, write, and edit molecular structures within their context window. This approach benefits researchers and developers by unlocking structural intelligence in LLMs, leading to improved generalization, reduced computational costs, and enhanced capabilities for complex chemical tasks.

How It Works

MoleCode serializes molecular structures into a Mermaid graph format, where atoms are typed nodes and bonds are edges, each with persistent identifiers. This explicit graph representation is directly interpretable by LLMs, bypassing the need for complex string parsing. The format is deterministically and losslessly convertible to standard formats like SMILES and MOL using RDKit. This graph-explicit approach allows for local graph operations (e.g., adding a methyl group) rather than whole-string rewrites, and enables more robust reasoning over molecular topology.

Quick Start & Requirements

  • Installation: Install via pip: pip install molecode. Alternatively, clone the repository and install from source: git clone https://github.com/AtomFlow-AI/MoleCode.git && cd MoleCode && pip install -e .
  • Prerequisites: Python 3.9+, RDKit, and networkx are required.
  • Resources: The library includes core modules (molecode.molecule, molecode.polymer, molecode.markush, molecode.prompts, molecode.llm), runnable examples, and API documentation.
  • Links:

Highlighted Details

  • Enhanced Generalization: Achieves significantly higher accuracy (~76–80%) on novel molecules compared to SMILES (~20%).
  • Efficient Reasoning: Chain-of-thought token cost scales sub-linearly with molecule size (~C^0.52), approximately 5x cheaper than SMILES (~C^1.65).
  • Scalability: Effectively handles polymers with explicit repeat units and Markush structures using abbreviation nodes, improving understanding accuracy (e.g., Markush structures from 38.1% to 84.0%).
  • LLM Agent Integration: Provides a ready-to-use Agent Skill for Claude Code and supports other agents (like Codex) via a bundled CLI, enabling direct molecule reasoning and editing without extra server setup.

Maintenance & Community

MoleCode is developed and maintained by AtomFlow. While specific community channels like Discord or Slack are not detailed, the project provides links to its official website and GitHub repository for information and collaboration.

Licensing & Compatibility

The project is released under the MIT License, which is permissive and allows for commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

While MoleCode excels at representing and enabling reasoning for small molecules and polymers, its direct task support for Markush structure generation is not explicitly detailed, though understanding is supported. The project appears to be a recent development (paper dated May 2026).

Health Check
Last Commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
55 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.