"""
Rowan v2 API: Strain Workflow
Calculate molecular strain energy for molecules with ring strain or conformational strain.
"""
from typing import Annotated
import rowan
import stjames
def submit_strain_workflow(
initial_molecule: Annotated[str, "SMILES string of the molecule to calculate strain energy for"],
name: Annotated[str, "Workflow name for identification and tracking"] = "Strain Workflow",
folder_uuid: Annotated[str, "UUID of folder to organize this workflow. Empty string uses default folder"] = "",
max_credits: Annotated[int, "Maximum credits to spend on this calculation. 0 for no limit"] = 0
):
"""Submit a strain energy calculation workflow using Rowan v2 API.
Args:
initial_molecule: SMILES string of the molecule for strain energy calculation
name: Workflow name for identification and tracking
folder_uuid: UUID of folder to organize this workflow. Empty string uses default folder.
max_credits: Maximum credits to spend on this calculation. 0 for no limit.
Calculates molecular strain energy by comparing the actual molecular energy
to a hypothetical unstrained reference structure. Useful for analyzing:
- Ring strain in cyclic systems
- Conformational strain in crowded molecules
- Steric interactions in cage compounds
Returns:
Workflow object representing the submitted workflow
Examples:
# Hexane autogenerated conformer strain
result = submit_strain_workflow(
initial_molecule="CCCCCC",
name="test autogen hexane strain"
)
"""
result = rowan.submit_strain_workflow(
initial_molecule=stjames.Molecule.from_smiles(initial_molecule),
name=name,
folder_uuid=folder_uuid if folder_uuid else None,
max_credits=max_credits if max_credits > 0 else None
)
# Make workflow publicly viewable
result.update(public=True)
return result