This source did not publish a separate summary. Review SKILL.md before using the skill.
SKILL.md
Chemical Structure Converter
Interconvert between different chemical structure representations including IUPAC names, SMILES strings, molecular formulas, and common names. Essential for cheminformatics workflows, database standardization, and compound registration in drug discovery and chemical research.
Key Capabilities:
Multi-Format Conversion: Convert between IUPAC names, SMILES, InChI, and molecular formulas
SMILES Validation: Validate SMILES syntax for structural correctness
Batch Processing: Process multiple compounds for database standardization
Identifier Lookup: Retrieve all available identifiers for known compounds
Structure Standardization: Normalize chemical representations for consistency
When to Use
✅ Use this skill when:
Standardizing chemical databases with mixed naming conventions
Preparing compound libraries for virtual screening or cheminformatics analysis
Converting structures from publications (IUPAC names) to machine-readable formats (SMILES)
Validating SMILES strings before using in computational chemistry tools
Registering new compounds in chemical inventory systems
Matching compounds across different databases with different identifier types
Creating structure-activity relationship (SAR) tables with consistent formatting
❌ Do NOT use when:
Needing 3D structure generation or conformer search → Use molecular modeling software (RDKit, OpenBabel)
Performing quantum chemistry calculations → Use Gaussian, ORCA, or similar packages
Working with or multi-step synthesis → Use reaction planning tools
✅ Always validate SMILES before using in downstream tools
✅ Check for aromaticity (lowercase c,n,o in SMILES)
✅ Verify stereochemistry (@ symbols for chirality)
✅ Use explicit hydrogens when ambiguity exists
Common Issues and Solutions:
Issue: Valid syntax but chemically impossible
Symptom: SMILES passes validation but structure is unrealistic
Solution: Use chemical validation tools (RDKit SanitizeMol) for deeper checks
Issue: Tautomeric ambiguity
Symptom: Keto/enol forms represented differently
Solution: Use tautomer canonicalization if consistency required
3. Batch Structure Processing
Process multiple chemical structures simultaneously for database standardization.
from scripts.main import ChemicalStructureConverter
converter = ChemicalStructureConverter()
# Batch process compound list
compound_list = [
"aspirin",
"caffeine",
"glucose",
"ethanol",
"unknown_compound"
]
results = []
for compound in compound_list:
data = converter.name_to_identifiers(compound)
if data:
results.append({
'name': compound,
'iupac': data['iupac'],
'smiles': data['smiles'],
'formula': data['formula'],
'mw': data['mw']
})
else:
print(f"⚠️ Warning: '{compound}' not found in database")
# Display results table
print("\n" + "="*80)
print(f"{'Name':<20} {'Formula':<15} {'MW':<10} {'SMILES'}")
print("="*80)
for r in results:
print(f"{r['name']:<20} {r['formula']:<15} {r['mw']:<10.2f} {r['smiles'][:40]}")
Best Practices:
✅ Process in batches of 100-1000 for large databases
✅ Log missing compounds for manual review
✅ Export to CSV for Excel/chemoinformatics tools
✅ Include CAS numbers when available for verification
Common Issues and Solutions:
Issue: Synonym confusion
Symptom: Same compound listed multiple times with different names
Solution: Use SMILES as unique key; deduplicate by structure
Issue: Mixture or salt forms
Symptom: Structures with counterions or multiple components
Solution: Process main component; flag mixtures for special handling
4. Molecular Formula and Properties
Extract molecular formulas and calculate basic properties from SMILES or names.
from scripts.main import ChemicalStructureConverter
converter = ChemicalStructureConverter()
# Analyze compound properties
compounds = ["aspirin", "caffeine", "glucose"]
print("Molecular Properties:")
print("-" * 70)
print(f"{'Compound':<15} {'Formula':<12} {'MW (g/mol)':<12} {'Heavy Atoms'}")
print("-" * 70)
for name in compounds:
data = converter.name_to_identifiers(name)
if data:
# Count heavy atoms (non-hydrogen) from formula
formula = data['formula']
heavy_atoms = sum(int(c) for c in formula if c.isdigit())
if heavy_atoms == 0: # Single atoms like C, O
heavy_atoms = len([c for c in formula if c.isupper()])
print(f"{name:<15} {data['formula']:<12} {data['mw']:<12.2f} {heavy_atoms}")
Calculated Properties:
Property
Calculation
Use Case
Molecular Weight
Sum of atomic weights
Dosing, filtering
Heavy Atoms
Non-hydrogen atoms
Size estimation
Formula
Atom count from structure
Database indexing
Rotatable Bonds
Count rotatable bonds
Flexibility index
Best Practices:
✅ Include salt forms in MW calculation if relevant
✅ Check isotopic labeling for specialized applications
✅ Calculate elemental composition for combustion analysis
✅ Use exact mass for mass spectrometry applications
Common Issues and Solutions:
Issue: Hydrates and solvates
Symptom: Different MW for hydrate vs anhydrous forms
Solution: Always specify form (e.g., "caffeine anhydrous")
5. Structure Standardization
Standardize chemical representations for database consistency.
from scripts.main import ChemicalStructureConverter
def standardize_compound_entry(name: str, converter) -> dict:
"""
Standardize compound entry with all identifiers.
Returns standardized entry or None if not found.
"""
data = converter.name_to_identifiers(name)
if not data:
return None
# Create standardized entry
standardized = {
'common_name': name.lower(),
'iupac_name': data['iupac'],
'smiles': data['smiles'],
'inchi': f"InChI=1S/{data['formula']}", # Placeholder
'molecular_formula': data['formula'],
'molecular_weight': data['mw'],
'standardized_date': '2026-02-09',
'source': 'local_database'
}
return standardized
# Example usage
converter = ChemicalStructureConverter()
entry = standardize_compound_entry("aspirin", converter)
if entry:
print("Standardized Entry:")
for key, value in entry.items():
print(f" {key}: {value}")
Standardization Rules:
Rule
Standard Form
Example
Common names
Lowercase
"aspirin" not "Aspirin"
IUPAC
Full systematic name
"2-acetoxybenzoic acid"
SMILES
Canonical
No stereochemistry if unspecified
Formula
Hill system
C, H, then alphabetical
Best Practices:
✅ Use consistent naming across entire database
✅ Include CAS numbers when available
✅ Track version history of structure assignments
✅ Validate against PubChem for known compounds
Common Issues and Solutions:
Issue: Multiple valid representations
Symptom: Same compound has different standard forms
Solution: Define canonicalization rules; use chemical validation
6. Chemical Database Integration
Prepare chemical data for import into cheminformatics databases.
import json
from scripts.main import ChemicalStructureConverter
def prepare_database_import(compound_names: list, converter) -> list:
"""
Prepare compound list for database import.
Returns list of standardized database records.
"""
records = []
for name in compound_names:
data = converter.name_to_identifiers(name)
if data:
record = {
'compound_id': f"CMPD_{len(records)+1:04d}",
'common_name': name,
'iupac_name': data['iupac'],
'smiles': data['smiles'],
'molecular_formula': data['formula'],
'molecular_weight': data['mw'],
'status': 'active'
}
records.append(record)
else:
print(f"⚠️ Skipped: {name} (not in database)")
return records
# Generate database import file
converter = ChemicalStructureConverter()
compounds = ["aspirin", "caffeine", "glucose", "ethanol"]
db_records = prepare_database_import(compounds, converter)
# Export to JSON for database import
with open('chemical_database_import.json', 'w') as f:
json.dump(db_records, f, indent=2)
print(f"\nExported {len(db_records)} compounds to database import file")
Symptom: Special characters in IUPAC names corrupted
Solution: Use UTF-8 encoding; escape special characters
Complete Workflow Example
From compound names to standardized database:
# Step 1: Convert single compound
python scripts/main.py --name aspirin
# Step 2: Validate SMILES
python scripts/main.py --smiles "CC(=O)Oc1ccccc1C(=O)O" --validate
# Step 3: Convert IUPAC to SMILES
python scripts/main.py --iupac "ethanol"
# Step 4: List available compounds
python scripts/main.py --list
Python API Usage:
from scripts.main import ChemicalStructureConverter
import pandas as pd
def process_compound_library(
compound_list: list,
output_file: str = "compound_library.csv"
) -> pd.DataFrame:
"""
Process compound library for cheminformatics analysis.
Args:
compound_list: List of compound names
output_file: Output CSV filename
Returns:
DataFrame with standardized compound data
"""
converter = ChemicalStructureConverter()
records = []
not_found = []
print("Processing compound library...")
print("="*60)
for compound in compound_list:
data = converter.name_to_identifiers(compound)
if data:
records.append({
'name': compound,
'iupac': data['iupac'],
'smiles': data['smiles'],
'formula': data['formula'],
'mw': data['mw']
})
print(f"✅ {compound}")
else:
not_found.append(compound)
print(f"❌ {compound} - not found")
print("="*60)
# Create DataFrame
df = pd.DataFrame(records)
# Export to CSV
df.to_csv(output_file, index=False)
print(f"\nExported {len(df)} compounds to {output_file}")
if not_found:
print(f"\n⚠️ {len(not_found)} compounds not found:")
for comp in not_found:
print(f" - {comp}")
return df
# Process library
library = ["aspirin", "caffeine", "glucose", "ethanol", "unknown_drug"]
df = process_compound_library(library, "my_library.csv")
print("\nLibrary Summary:")
print(f"Total compounds: {len(df)}")
print(f"Average MW: {df['mw'].mean():.2f} g/mol")
print(f"MW range: {df['mw'].min():.2f} - {df['mw'].max():.2f} g/mol")
Expected Output Files:
chemical_data/
├── compound_library.csv # Standardized compound data
├── missing_compounds.txt # List of compounds not found
├── database_import.json # JSON format for database import
└── validation_report.txt # SMILES validation results
Common Patterns
Pattern 1: Literature to Database Conversion
Scenario: Converting compound names from publications to SMILES for database entry.
{
"task": "literature_to_database",
"source": "Journal article compound list",
"input_format": "Common names and IUPAC",
"output_format": "SMILES for database",
"volume": "50 compounds",
"quality_check": "Validate all SMILES"
}
Workflow:
Extract compound names from publication
Look up each compound in converter
Validate generated SMILES
Check for missing compounds
Manual lookup for missing entries
Export to database import format
Review and correct any errors
Output Example:
Literature Conversion Results:
Total compounds: 50
Successfully converted: 47 (94%)
Manual review needed: 3
- Compound_23: ambiguous name
- Compound_31: salt form unclear
- Compound_45: stereochemistry unspecified
Database ready: 47 compounds exported
Pattern 2: Cheminformatics Pipeline Preparation
Scenario: Preparing compound library for virtual screening pipeline.