ord_schema.macros#

Macros for programmatically constructing reaction messages (solutions, workups).

ord_schema.macros.solutions#

Macros for programmatic message creation.

ord_schema.macros.solutions.brine(volume: str | Volume | None = None) → list[Compound]#

Creates a saturated aqueous sodium chloride (brine) solution.

Parameters:

volume – Volume of the brine solution.

Returns:

A list of solvent/solute Compounds.

ord_schema.macros.solutions.simple_solution(solvent_smiles: str, solute_smiles: str | None = None, volume: None | str | Volume = None, concentration: None | str | Concentration = None, saturated: bool = False) → list[Compound]#

Creates a solution with at most one solvent and one solute.

Parameters:
  • solvent_smiles – SMILES of the solvent. Either SMILES is recorded as CXSMILES if it has an extension block.

  • solute_smiles – SMILES of the solute. If not specified, a pure solvent is generated.

  • volume – Volume of solution (total volume including the solute).

  • concentration – Concentration of solution. If both concentration and volume are specified, a solute quantity is computed. The schema does not currently have a way to represent an unknown volume of solution with a known concentration.

  • saturated – Whether the solution is saturated. Saturated and concentrated cannot both be specified.

Returns: A list of solvent/solute Compounds.

ord_schema.macros.workups#

Macros for quickly creating workup steps.

For example, this procedure:

The reaction was quenched with 300 ml of 0.5M NaHCO3 solution and the phases were separated. The aqueous layer was back-extracted twice with 100 ml of EtOAc. The organic layers were combined and washed with 200 ml of saturated NaCl solution, dried over MgSO4 and filtered. Upon concentration to an oil, the crude product was purified by normal phase column chromatography.

is recorded as:

from ord_schema.macros import solutions, workups
from ord_schema.proto import reaction_pb2

reaction.workups.extend([
    workups.add_solution(solutions.simple_solution(
        solvent_smiles="O", solute_smiles="[Na+].OC([O-])=O", volume="300 mL",
        concentration="0.5 M")),
    workups.separate_phases(keep_phase="organic"),
    workups.add_solution(solutions.simple_solution(
        solvent_smiles="CC(=O)OCC", volume="100 mL"), workup_type="EXTRACTION"),
    workups.separate_phases(keep_phase="organic"),
    workups.add_solution(solutions.simple_solution(
        solvent_smiles="CC(=O)OCC", volume="100 mL"), workup_type="EXTRACTION"),
    workups.separate_phases(keep_phase="organic"),
    workups.add_solution(solutions.brine("200 mL"), workup_type="WASH"),
    workups.drying_agent("[Mg+2].[O-]S([O-])(=O)=O"),
    workups.filtration(keep_phase="filtrate"),
    workups.rotovap(),
    reaction_pb2.ReactionWorkup(type="OTHER_CHROMATOGRAPHY"),
])
ord_schema.macros.workups.add_solution(solution: Iterable[Compound], workup_type: str = 'ADDITION') → ReactionWorkup#

Create a workup representing addition of a solution.

workup_type is commonly one of ‘ADDITION’, ‘EXTRACTION’, or ‘WASH’; see ReactionWorkup.WorkupType enum for full list of possible values.

ord_schema.macros.workups.drying_agent(agent_smiles: str) → ReactionWorkup#

Create a workup representing addition of a drying agent.

agent_smiles is recorded as CXSMILES if it has an extension block.

ord_schema.macros.workups.filtration(keep_phase: str) → ReactionWorkup#

Create a workup representing a filtration step.

keep_phase should be one of ‘filtrate’ or ‘solid’.

ord_schema.macros.workups.rotovap() → ReactionWorkup#

Create a workup representing a rotary evaporation step.

ord_schema.macros.workups.separate_phases(keep_phase: str) → ReactionWorkup#

Create a workup representing a phase separation.

keep_phase is commonly either ‘aqueous’ or ‘organic’.