Multi-Step Organic Chemical Synthesis
This work is a continuation of my work in my first two notebooks. The code in this notebook is similar, but slightly improved and supersedes the code in the preceding notebooks. Scroll down to see the list of organic chemical reactions mentioned in this notebook. My custom-designed function definitions for each organic chemical reaction are given after the list.​
​​
​Recall that each defined function (beginning with “ChemRxn”) representing an organic chemical reaction is essentially an operator that accepts a reactant molecule as input, transforms it into the expected product, then outputs that product molecule. If the reactant fed into a reaction lacks any of the specific functional groups (atom bonding patterns) required for reaction, nothing happens, and the reactant is passed through unchanged.​
​​
​Here is what a single reaction looks like. The reactant is the argument for the reaction function. The output shows the reactant first, followed by the product.​
​​
​alkene ---(Rxn 11a)---> alcohol (just showing the relevant functional groups instead of the compound’s name)​
​
flask=Molecule["5,5-dimethyl-3-heptene"]​​MoleculePlot[flask]​​​​ChemRxn11aAlkeneHydrationMark[flask];​​MoleculePlot[flask]
Out[]=
Out[]=
​
Here is what a two-step reaction sequence looks like. The variable “flask” refers to both the initial reactant, and the product of each reaction. The product of each reaction becomes the reactant for the next reaction. The output shows the initial reactant first, followed by the product of the first reaction, followed by the product of the second reaction, etc.
​
alkene ---(Rxn 11a)---> alcohol ---(Rxn 3)---> ketone
In[]:=
​​flask=Molecule["5,5-dimethyl-3-heptene"];​​MoleculePlot[flask]​​​​ChemRxn11aAlkeneHydrationMark[flask];​​MoleculePlot[flask]​​​​ChemRxn3OxidAlc[Molecule["5,5-dimethyl-3-heptanol"]];​​MoleculePlot[flask]
Out[]=
Out[]=
Out[]=
​
Now some longer examples:
Example 1:​​​alkyl halide ---(Rxn 4)---> alkyne ---(Rxn 5)---> alkene ---(Rxn 12a)---> alkyl halide ---(Rxn 13)---> carboxylic acid ---(Rxn 10)---> ester​Five-step reaction sequence. Step 1 is a Carbon-Carbon bond forming reaction (CCFR). The other steps are Functional Group Inter-conversions (FGIs).​
In[]:=
flask=Molecule["1-bromo-4,4,5-trimethylheptane"];​​MoleculePlot[flask]​​​​ChemRxn4AlkyneAlkylation[Molecule["3,3-dimethyl-1-butyne"],flask,2];​​MoleculePlot[flask]​​​​ChemRxn5H2RedAlkyne[flask];​​MoleculePlot[flask]​​​​ChemRxn12aAlkeneHydroHalogenationMark[flask];​​MoleculePlot[flask]​​​​ChemRxn13GrignardCO2[flask];​​MoleculePlot[flask]​​​​ChemRxn10FischerEsterSyn[Molecule["benzyl alcohol"],flask,2];​​MoleculePlot[flask]
Out[]=
Out[]=
Out[]=
Out[]=
Molecule
:Invalid valence for carbon atom at position 51.
Out[]=
Out[]=
The first molecule above is the initial reactant (to be fed into the first reaction). Each subsequent molecule is the product of a reaction step, in the order that they were produced. Success -- all reactions gave the expected product!
​
The error message indicates that a carbon atom with 5 bonds was temporarily generated during execution of the function. But since the correct valency is restored prior to the end of execution, this error does not affect the accuracy of the output.
​
​Showing only the Initial Reactant and Final Product:​
​
In[]:=
flask=Molecule["1-bromo-4,4,5-trimethylheptane"];​​MoleculePlot[flask]​​​​ChemRxn4AlkyneAlkylation[Molecule["3,3-dimethyl-1-butyne"],flask,2];​​ChemRxn5H2RedAlkyne[flask];​​ChemRxn12AlkeneHydroHalogenationMark[flask];​​ChemRxn13GrignardCO2[flask];​​ChemRxn10FischerEsterSyn[Molecule["benzyl alcohol"],flask,2];​​​​MoleculePlot[flask]
Out[]=
Molecule
:Invalid valence for carbon atom at position 51.
Out[]=
​
What if the reactions are in the wrong order?
In[]:=
flask=Molecule["1-bromo-4,4,5-trimethylheptane"];​​MoleculePlot[flask]​​​​ChemRxn4AlkyneAlkylation[Molecule["3,3-dimethyl-1-butyne"],flask,2];​​MoleculePlot[flask]​​​​ChemRxn5H2RedAlkyne[flask];​​MoleculePlot[flask]​​​​ChemRxn12aAlkeneHydroHalogenationMark[flask];​​MoleculePlot[flask]​​​​ChemRxn10FischerEsterSyn[Molecule["benzyl alcohol"],flask,2];​​MoleculePlot[flask]​​​​ChemRxn13GrignardCO2[flask];​​MoleculePlot[flask]​​
Out[]=
Out[]=
Out[]=
As expected, four of the reactions did not have available the prerequisite functional group(s), and so these reactions passed the reactant through unchanged. One of the reactions (Rxn 13) did find the needed functional group -- an alkyl bromide, but the “wrong” one (one that would have been consumed in a prior reaction if the order of reactions had been correct).
aldehyde halide ---(Rxn 4)---> aldehyde yne ---(Rxn 5)---> aldehyde ene ---(Rxn 12b)---> aldehyde halide ---(Rxn 1)---> alcohol halide ---(Rxn 8)---> ether
​
Note that Rxn 12b has Anti-Markovnikov regiochemistry, as opposed to Rxn 12a which has Marknovnikov regiochemistry.
​
These are the expected products.
​
​
​--------------------------- LIST OF REACTIONS --------------------------------​
​
1) H2 Reduction of Aldehydes/Ketones to Alcohols: ChemRxn1H2RedAldKet[aldehydeketone_]
2) Bromination of Alcohols: ChemRxn2BromAlc[alcohol_]
3) Oxidation of Alcohols to Aldehyde/Ketones: ChemRxn3OxidAlc[alcohol_]
4) Alkylation of Alkynes: ChemRxn4AlkyneAlkylation[alkyne_,primaryalkylhalide_,default_]
5) H2 Reduction of Alkyne to Alkene: ChemRxn5H2RedAlkyne[alkyne_]
*6) H2 Reduction of Alkenes and Alkynes to Alkanes: ChemRxn6H2RedAlkeneAlkyne[alkenealkyne_]
7) Grignard Reaction of Aldehydes and Ketones: ChemRxn7GrignardAldKet[aldehydeketone_,organichalide_,default_]
8) Alkylation of Alcohols (Williamson Ether Synthesis): ChemRxn8AlcoholAlkylation[alcohol_,primaryalkylhalide_,default_]
*9) Mono-Alkylation of Ammonia (Gabriel Synthesis of Primary Amines): ChemRxn9AmmoniaMonoAlkylation[primaryalkylhalide_]
10) Fischer Ester Synthesis from Alcohols and Carboxylic Acids: ChemRxn10FischerEsterSyn[alcohol_,carboxylicacid_,default_]
11a) Alkene Hydration, Markovnikov: ChemRxn11aAlkeneHydrationMark[alkene_]
11b) Alkene Hydration Anti-Markovnikov: ChemRxn11bAlkeneHydrationAntiMark[alkene_]
12a) Alkene HydroHalogenation Markovnikov: ChemRxn12aAlkeneHydroHalogenationMark[alkene_]
12b) Alkene HydroHalogenation Anti-Markovnikov: ChemRxn12bAlkeneHydroHalogenationAntiMark[alkene_]
13) Carboxylation of Grignard Reagent (to Carboxylic Acid): ChemRxn13GrignardCO2[organichalide_]
​
*not included below
​
​-------------------------- The Defined Functions -----------------------------
​
---------------------------- End of Defined Functions ----------------------