Function Repository Resource:

AlkaneIsomers

Source Notebook

Generate all alkanes with a given number of carbon atoms

Contributed by: Jan Mangaldan

ResourceFunction["AlkaneIsomers"][n]

gives a list of all alkanes with n carbon atoms.

Details and Options

An alkane is an acyclic branched or unbranched hydrocarbon satisfying the general formula CnH2n+2, and therefore consisting entirely of hydrogen atoms and saturated carbon atoms.
Setting the option "GenerateStereoisomers"True makes ResourceFunction["AlkaneIsomers"] generate all stereoisomers of an alkane possessing chiral centers.

Examples

Basic Examples (1) 

All alkanes with five carbon atoms:

In[1]:=
ResourceFunction["AlkaneIsomers"][5]
Out[1]=

Options (2) 

GenerateStereoisomers (2) 

With the setting "GenerateStereoisomers"False, isomers are generated without regard for chirality:

In[2]:=
ResourceFunction["AlkaneIsomers"][7, "GenerateStereoisomers" -> False]
Out[2]=
In[3]:=
Length[%]
Out[3]=

With the setting "GenerateStereoisomers"True, all stereoisomers of any chiral alkane are generated:

In[4]:=
ResourceFunction["AlkaneIsomers"][7, "GenerateStereoisomers" -> True]
Out[4]=
In[5]:=
Length[%]
Out[5]=

Applications (2) 

Generate all hexane isomers:

In[6]:=
ResourceFunction["AlkaneIsomers"][6]
Out[6]=

Name the isomers:

In[7]:=
MoleculeName /@ %
Out[7]=

Plot the number of alkane isomers, ignoring stereochemistry:

In[8]:=
ListLinePlot[
 Table[Length[ResourceFunction["AlkaneIsomers"][n]], {n, 11}]]
Out[8]=

Plot the number of alkane isomers, taking stereochemistry into account:

In[9]:=
ListLinePlot[
 Table[Length[
   ResourceFunction["AlkaneIsomers"][n, "GenerateStereoisomers" -> True]], {n, 11}]]
Out[9]=

Version History

  • 1.0.1 – 05 August 2021

Source Metadata

Related Resources

License Information