Experimental Functions for Chemical Synthesis in Wolfram Language ​Leonardo Cabana
​​Introduction​​I want to share my progress using Wolfram language to model individual organic chemical reactions, and using these reactions in sequences to simulate organic chemical synthesis.​This is my 4th post presented on this subject. This notebook is cumulative, and the WL coding here is greatly improved and debugged compared to my previous versions There is no need to refer to the earlier notebooks (and the code in the previous notebooks is buggy and inferior). The new code seems to run fairly smoothly, but needs more testing. Please experiment by substituting in your own starting materials and reaction sequences. And please report any crashes so that may I try to track down any remaining bugs.​ 1st Post “Organic Chemistry 1: Modeling Synthesis as Graphs” ​ 2nd Post “Organic Chemistry 2: Representing Chemical Reactions”​ 3rd Post “Organic Chemistry 3: Progress in Multi-Step Chemical Synthesis” ​My previous notebooks showed a way to use pre-existing Wolfram language chemistry functions to model individual organic chemical reactions. Now these chemical reaction functions are used in sequence to simulate multi-step organic chemical synthesis. The goal is to explore chemical reaction space (for this toy model), and see how fruitful this approach might be to illustrating and/or guiding multi-step chemical synthesis. Chemical reactions can be represented as string substitution systems, so in order to gain insights about multi-step chemical synthesis, I will attempt (in future work) to apply Wolfram’s string substitution functionality to analyze the toy chemistry universe.​This is a “toy” chemical universe. Many simplifying assumptions are made in order to keep this project manageable. The specific ways in which this model deviates from chemical reality are mentioned below. This simplified chemistry is just meant as a starting point -- it has some predictive power, but needs much refining.​Outline of this notebook: Introduction Table 1. List of Chemical Reaction Functions Table 2. List of New Chemistry Functions Table 3. User-Defined Co-Reactants for C-C and C-Hetero Bond-Forming Reactions Example 1. The OrgChemRxnSeq Function Example 2. Reaction: Oxidation of Alcohols to Aldehyde/Ketones Example 3. Reaction: Bromination of Alcohols Example 4. Reaction: Dehydrohalogenation of Alkyl Halides Example 5. Bond-Forming Reactions (BFR)​ Example 6. Polyfunctinal BFR Reactions​ Example 7. Polymers and Dendrimers Example 8. Multi-Step Organic Chemical Synthesis Example 9. The OrgChemRand Function Example 10. The OrgChemRxnEnum1Step Function Example 11. The OrgChemRxnEnum2Step Function Example 12. The OrgChemRxnEnum3Step Function How this Model Deviates from Chemical Reality Goals of Future Work Code: Function Definitions and Functional Group Patterns​​​Table 1. List of Reaction Functions​​​​Functional Group Inter-conversions:​1) Bromination of Alcohols: ChemRxn1BromAlc[alcohol]2) Dehydration of Alcohols: ChemRxn2DehydrationAlcohol[alcohol]3) Dehydrohalogenation of Alkyl Halides: ChemRxn3Dehydrohalogenation[alkyl halide]4) Alkene Hydration, Markovnikov: ChemRxn4AlkeneHydrationMark[alkene]5) Alkene Hydration Anti-Markovnikov: ChemRxn5AlkeneHydrationAntiMark[alkene]6) Alkene HydroHalogenation Markovnikov: ChemRxn6AlkeneHydroHalogenationMark[alkene]7) Alkene HydroHalogenation Anti-Markovnikov: ChemRxn7AlkeneHydroHalogenationAntiMark[alkene]8) H2 Reduction of Alkyne to Alkene: ChemRxn8H2RedAlkyne[alkyne]9) Halohydrin Reaction of Alkenes: ChemRxn9Halohydrin[alkene]10) Oxidation of Alcohols to Aldehyde/Ketones: ChemRxn10AlcoholOxid[alcohol]11) Hydride Reduction of Aldehydes/Ketones to Alcohols: ChemRxn11RedAldKet[aldehyde/ketone]​​C-C Bond-Forming Reactions:​12) Alkylation of Alkynes: ChemRxn12AlkyneAlkylationXSyne[alkyne, primary alkyl halide]13) Alkylation of Alkynes: ChemRxn13AlkyneAlkylationXShal[alkyne, primary alkyl halide]14) Alkylation of Alkynes: ChemRxn14AlkyneAlkylationIntramolec[alkyne-halide]15) Grignard Reaction of Aldehydes and Ketones: ChemRxn15GrignardAldKetXShal[aldehyde/ketone, halide]16) Grignard Reaction of Aldehydes and Ketones: ChemRxn16GrignardAldKetXSaldket[aldehyde/ketone, halide]17) Grignard Reaction of Aldehydes and Ketones: ChemRxn17cGrignardAldKetIntramolec[aldehyde/ketone-halide]18) Grignard Reagents of CO2: ChemRxn18GrignardCO2[halide]​​C-Heteroatom Bond-Forming Reactions:​19) Alkylation of Alcohols (Williamson Ether Synthesis): ChemRxn19AlcoholAlkylationXShal[alcohol, primary alkyl halide]20) Alkylation of Alcohols (Williamson Ether Synthesis): ChemRxn20AlcoholAlkylationXSalc[alcohol, primary alkyl halide]21) Alkylation of Alcohols (Williamson Ether Synthesis): ChemRxn21AlcoholAlkylationIntramolec[alcohol- halide]22) Mono-Alkylation of Ammonia (Gabriel Synthesis of Primary Amines): ChemRxn22AmmoniaMonoAlkylation[primary alkyl halide]23) Fischer Ester Synthesis from Alcohols and Carboxylic Acids: ChemRxn23FischerEsterXSalc[alcohol , carboxylic acid]24) Fischer Ester Synthesis from Alcohols and Carboxylic Acids: ChemRxn24FischerEsterXSca[alcohol , carboxylic acid]25) Fischer Ester Synthesis from Alcohols and Carboxylic Acids: ChemRxn25FischerEsterIntramolec[alcohol-carboxylic acid]26) Wittig Reaction: ChemRxn26WittigXShal[aldehydeketone , methylprimsechalide]27) Wittig Reaction: ChemRxn27wittigXSaldket[aldehydeketone , methylprimsechalide]28) Wittig Reaction: ChemRxn28WittigIntramolec[aldehydeketone-methylprimsechalide]​​​​Table 2. List of New Chemistry Functions​​​OrgChemRxnSeq[ molecule, {intergersequence}] Performs a specified sequence of reactions on a specified molecule.​OrgChemRxnRand[ molecule , numberofsteps ] Performs random reactions on a specified molecule for a specified number of steps.​OrgChemRxnEnum1Step[ molecule ] Perform all possible 1-step reaction sequences starting from a specified molecule.​OrgChemRxnEnum2Step[ molecule ] Perform all possible 2-step reaction sequences starting from a specified molecule.​OrgChemRxnEnum3Step[ molecule ] Perform all possible 3-step reaction sequences starting from a specified molecule.​​​Table 3. User-Defined Co-Reactants for C-C and C-Hetero Bond-Forming Reactions​​The default co-reactants for reactions 12, 13, 15, 16, 19, 20, 23, 24, 26, and 27 are listed below. These molecules can be changed to other molecules that containing the same functional group (that is needed for reaction to occur). Note the variable names (e.g., “alcohol20”) contain the number of the corresponding chemical reaction function.
In[]:=
​​alkyne12=Molecule["3,3-dimethyl-1-butyne"];​​alkylhalide13=Molecule["allyl bromide"];​​​​organichalide15=Molecule["4-bromomethylstyrene"];​​aldehydeketone16=Molecule["cyclopent-2-enone"];​​​​alkylhalide19=Molecule["5-bromo-1-pentyne"];​​alcohol20=Molecule["4-hydroxy-2-butanone"];​​​​alcohol23=Molecule["propargyl alcohol"];​​carboxylicacid24=Molecule["3-carboxypropanaldehyde"];​​​​methylprimsechalide26=Molecule["4-bromo-1-cycloheptene"];​​aldehydeketone27=Molecule["1-vinyl-3-pentanone"];​​​​MoleculePlot[alkyne12]​​MoleculePlot[alkylhalide13]​​MoleculePlot[organichalide15]​​MoleculePlot[aldehydeketone16]​​MoleculePlot[alkylhalide19]​​MoleculePlot[alcohol20]​​MoleculePlot[alcohol23]​​MoleculePlot[carboxylicacid24]​​MoleculePlot[methylprimsechalide26]​​MoleculePlot[aldehydeketone27]​​​​