Iupac To Smiles logo

Iupac To Smiles

Organization
InternScience
iupac-to-smiles

将 IUPAC 化学名称转换为 SMILES 字符串。完全使用 OPSIN API,支持聚合物智能解析。

Overview

PublisherInternScience
RepositoryChemClaw
Skill nameiupac-to-smiles
Stars
53
Forks
13
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by InternScience on GitHub. Read the source before you install it.

Installation

Install the Iupac To Smiles AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/InternScience/ChemClaw/tree/main/skills/iupac-to-smiles
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/InternScience/ChemClaw.git /tmp/ChemClaw
mkdir -p .claude/skills
cp -r /tmp/ChemClaw/skills/iupac-to-smiles .claude/skills/iupac-to-smiles
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Iupac To Smiles in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Iupac To Smiles on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Iupac To Smiles is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

IUPAC Name to SMILES Converter

将 IUPAC 化学名称转换为 SMILES 字符串,完全使用 OPSIN API,支持聚合物智能解析。

触发条件

  • 用户提供 IUPAC 名称并要求转换
  • 提到"SMILES"、"化学名称转换"
  • 说"name to smiles"、"IUPAC 转 SMILES"
  • 提到聚合物名称(如 poly[...])

功能

  • ✅ 完全使用 OPSIN API(剑桥大学)- 不再依赖 PubChem
  • ✅ 聚合物智能解析 - 自动识别 poly[...]、poly(...) 格式
  • ✅ 单体提取 - 从聚合物名称中提取单体并解析
  • ✅ 连接基团识别 - 自动识别 oxy、thio、imino 等连接基团
  • ✅ 批量转换 - 支持多个名称同时转换
  • ✅ 分子信息 - 返回分子式、分子量等(普通化合物)
  • ✅ 聚合物说明 - 生成聚合物结构说明

聚合物解析逻辑

对于聚合物名称如 poly[oxy(1-methylethylene)]:

  1. 识别聚合物前缀: poly[...]
  2. 提取括号内容: oxy(1-methylethylene)
  3. 解析连接基团: oxy → 氧原子 -O-
  4. 解析单体: 1-methylethylene → 通过 OPSIN 转换为 SMILES
  5. 组合结果: 生成聚合物 SMILES 和说明

支持的连接基团

名称SMILES说明
oxyO氧桥 -O-
thioS硫桥 -S-
iminoNH亚氨基 -NH-
carbonylC=O羰基
esterC(=O)O酯基
amideC(=O)N酰胺基

使用方法

对话框中使用

把 ethanol 转成 SMILES
IUPAC: 2-hydroxypropanoic acid,转 SMILES
poly[oxy(1-methylethylene)] 转 SMILES
批量转换:ethanol, benzene, poly[oxyethylene]

命令行使用

bash
# 单个名称转换
python3 scripts/iupac_to_smiles.py --name "ethanol"

# 聚合物转换
python3 scripts/iupac_to_smiles.py --name "poly[oxy(1-methylethylene)]"

# 批量转换
python3 scripts/iupac_to_smiles.py --names "ethanol,benzene,poly[oxyethylene]"

# 从文件读取
python3 scripts/iupac_to_smiles.py --input names.txt --output results.json

# 指定输出格式
python3 scripts/iupac_to_smiles.py --name "aspirin" --format csv

参数说明

参数简写说明默认值
--name-n单个 IUPAC 名称-
--names-N多个名称(逗号分隔)-
--input-i输入文件(每行一个名称)-
--output-o输出文件路径自动生成
--format-f输出格式:json/csvjson
--quiet-q安静模式false

输出示例

简单化合物

json
{
  "status": "success",
  "results": [
    {
      "input_name": "ethanol",
      "smiles": "CCO",
      "isomeric_smiles": "CCO",
      "molecular_formula": "C2H6O",
      "molecular_weight": 46.07,
      "source": "OPSIN",
      "status": "success",
      "type": "simple"
    }
  ]
}

聚合物

json
{
  "status": "success",
  "results": [
    {
      "input_name": "poly[oxy(1-methylethylene)]",
      "status": "success",
      "type": "polymer",
      "polymer_info": {
        "is_polymer": true,
        "monomers": [
          {"name": "1-methylethylene", "position": "repeat_unit"}
        ],
        "linkers": [
          {"name": "oxy", "smiles": "O", "position": "backbone"}
        ]
      },
      "monomer_results": [
        {
          "name": "1-methylethylene",
          "smiles": "CC(C)",
          "status": "success"
        }
      ],
      "polymer_smiles": "*OCC(C)*",
      "final_smiles": "*OCC(C)*",
      "explanation": "连接基团:oxy | 单体 SMILES: CC(C) | 聚合物 SMILES: *OCC(C)*"
    }
  ]
}

CSV 格式

csv
input_name,smiles,status,type,monomer_count,explanation
ethanol,CCO,success,simple,,
poly[oxy(1-methylethylene)],*OCC(C)*,success,polymer,1,连接基团:oxy | 单体 SMILES: CC(C)

依赖

bash
pip install rdkit requests

OPSIN API 说明

  • 来源: 剑桥大学化学系
  • 网址: https://opsin.ch.cam.ac.uk/
  • 优势:
    • 支持复杂 IUPAC 名称解析
    • 对聚合物名称有更好的支持
    • 无需 API 密钥
  • 限制:
    • 需要网络连接
    • 某些非常复杂的名称可能失败

聚合物解析示例

示例 1: poly[oxy(1-methylethylene)]

输入:poly[oxy(1-methylethylene)]
解析:
  - 聚合物类型:bracketed
  - 连接基团:oxy → O
  - 单体:1-methylethylene → CC(C)
输出:*OCC(C)* (聚环氧丙烷)

示例 2: poly[oxyethylene]

输入:poly[oxyethylene]
解析:
  - 聚合物类型:bracketed
  - 连接基团:oxy → O
  - 单体:ethylene → CC
输出:*OCC* (聚环氧乙烷)

示例 3: poly(methyl methacrylate)

输入:poly(methyl methacrylate)
解析:
  - 聚合物类型:bracketed
  - 单体:methyl methacrylate
输出:*CC(C)(C(=O)OC)* (PMMA)

注意事项

  • ✅ 完全使用 OPSIN - 不再使用 PubChem 作为后备
  • ✅ 聚合物支持 - 自动识别和解析聚合物名称
  • ✅ 灵活解析 - 支持多种聚合物命名格式
  • ⚠️ 复杂聚合物可能无法完全解析 - OPSIN 对某些复杂名称支持有限
  • ⚠️ 需要网络连接 - OPSIN API 需要在线访问
  • ⚠️ 建议先测试常见化合物

错误处理

错误说明解决方案
Name not foundOPSIN 无法识别名称检查拼写,尝试更简单的名称
API errorOPSIN API 调用失败检查网络连接
Parse error聚合物解析失败提供更标准的聚合物名称

与旧版本的区别

  • ❌ 移除了 PubChem 后备 - 完全依赖 OPSIN
  • ✅ 新增聚合物解析 - 智能识别和解析聚合物
  • ✅ 新增连接基团识别 - 自动识别 oxy、thio 等
  • ✅ 新增单体提取 - 从复杂名称中提取可解析的部分
  • ✅ 更详细的输出 - 包含聚合物结构说明

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Iupac To Smiles AI skill do?

将 IUPAC 化学名称转换为 SMILES 字符串。完全使用 OPSIN API,支持聚合物智能解析。

Why use Iupac To Smiles on TypingMind?

Because you install it once and use it with any model. Iupac To Smiles is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Iupac To Smiles in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/InternScience/ChemClaw/tree/main/skills/iupac-to-smiles. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Iupac To Smiles?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Iupac To Smiles?

As many as you like. As long as a model supports skills, you can use Iupac To Smiles with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Iupac To Smiles AI skill free?

Yes. It is published on GitHub by InternScience under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇