(# FIXED CODE #)
I corrected the code to generate the correct sequence of halomethanes (+ methane). The sequence is: "Number of inequivalent ways to color vertices of a tetrahedron using <= n colors (A006008-OEIS, N. J. A. Sloane, Jul 11, 1991)."
The function continues with the same options: list, color list, 2D and 3D graphics and mass list.
Halomethanes[elem_, OptionsPattern[]] :=
Module[{eleu, z, cc, a, a1, f, rP, ap, n, b, g}, z = Length@elem;
Options[Halomethanes] = {"Mode" -> "Table"}; eleu = elem[[1]];
a = Tuples[elem, 4] /. {"Cl" -> "D", "Br" -> "B"}; n[x_] := {x};
cc = {"C" -> GrayLevel[0.5], "F" -> RGBColor[1, 0.5, 0.5],
"Cl" -> RGBColor[0, 0.56, 0], "Br" -> RGBColor[0.6, 0.4, 0.2],
"I" -> RGBColor[1, 0, 0], "H" -> RGBColor[0, 1, 1]}; a1 = a[[1]];
f[a_] := Module[{bt, ct, dt, e1, e2, ft, gt, r1},
bt = Table[StringJoin[a[[b]]], {b, 1, Length@a}];
ct = Table[StringJoin@Table[a[[c]], 2], {c, 1, Length@a}];
dt = Table[
StringJoin[a[[d]][[4]], a[[d]][[3]], a[[d]][[2]],
a[[d]][[1]]], {d, 1, Length@a}];
e1 = Table[
StringCases[ct[[i]], RegularExpression[bt[[1]]]], {i, 1,
Length@ct}];
e2 = Table[
StringCases[ct[[i]], RegularExpression[dt[[1]]]], {i, 1,
Length@ct}];
ft = Table[{Length@(e1[[j]]),
Length@(e2[[j]])} /. {{2, 2} -> bt[[j]], {2, 0} ->
bt[[j]], {0, 2} -> {"copy"}, {0, 0} -> bt[[j]], {2, 1} ->
bt[[j]], {1, 2} -> {"copy"}, {1, 0} -> {"copy"}, {0,
1} -> {"copy"}, {1, 1} -> {"copy"}}, {j, 1, Length@ct}];
gt = Table[
StringPartition[DeleteCases[ft, {"copy"}][[o]], 1], {o, 1,
Length@DeleteCases[ft, {"copy"}]}];
r1 = If[gt != {}, If[gt[[1]] == a[[1]], gt[[1]], {}], {}]; {rP =
DeleteCases[r1, {}],
ap = If[r1 != {}, DeleteCases[gt, r1], gt]}];
Do[b = AppendTo[n[a1], {a = f[a][[2]], f[a][[1]]}[[2]]],
z*(z + 1)*(z^2 + z + 2)/8 - 1]; g = DeleteCases[b, {}];
Do[g = DeleteCases[
Table[If[(g[[l]][[1]] != g[[l]][[2]] != g[[l]][[3]] !=
g[[l]][[4]]),
g[[l]] /. {{g[[q]][[1]], g[[q]][[2]], g[[q]][[3]],
g[[q]][[4]]} ->
g[[l]], {g[[q]][[1]], g[[q]][[2]], g[[q]][[4]],
g[[q]][[3]]} ->
g[[l]], {g[[q]][[1]], g[[q]][[3]], g[[q]][[2]],
g[[q]][[4]]} -> {}},
g[[l]] /. {{g[[q]][[1]], g[[q]][[2]], g[[q]][[3]],
g[[q]][[4]]} ->
g[[l]], {g[[q]][[1]], g[[q]][[2]], g[[q]][[4]],
g[[q]][[3]]} -> {}, {g[[q]][[1]], g[[q]][[3]], g[[q]][[2]],
g[[q]][[4]]} -> {}}], {l, 1, Length@g}], {}], {q,
1, (z^4 + 11 z^2)/12}];
OptionValue[
"Mode"] /. {"Table" ->
If[z == 1, {{eleu, eleu, eleu, eleu}},
g /. {"D" -> "Cl", "B" -> "Br"}],
"Color" -> {TableForm[{{"H",
Text[Style["Cyan", RGBColor[0, 1, 1], Medium]]}, {"F",
Text[Style["Pink", RGBColor[1, 0.5, 0.5], Medium]]}, {"Cl",
Text[Style["Green", RGBColor[0, 0.56, 0], Medium]]}, {"Br",
Text[Style["Brown", RGBColor[0.6, 0.4, 0.2], Medium]]}, {"I",
Text[Style["Red", RGBColor[1, 0, 0], Medium]]}},
TableHeadings -> {None, {"Atom", "Color"}}],
If[z == 1, {Flatten@Table[elem, 4]},
g /. {"D" -> "Cl", "B" -> "Br"}] /. cc},
"Visual" ->
If[z == 1,
MoleculePlot[
Molecule[{"C", eleu, eleu, eleu, eleu}, {Bond[{1, 2}],
Bond[{1, 3}], Bond[{1, 4}], Bond[{1, 5}]}], ColorRules -> cc,
ImageSize -> 100],
Table[MoleculePlot[
Molecule[
Join[{"C"}, (g /. {"D" -> "Cl", "B" -> "Br"})[[
h]]], {Bond[{1, 2}], Bond[{1, 3}], Bond[{1, 4}],
Bond[{1, 5}]}], ColorRules -> cc, ImageSize -> 100], {h, 1,
Length@g}]],
"Visual3D" ->
If[z == 1,
MoleculePlot3D[
Molecule[{"C", eleu, eleu, eleu, eleu}, {Bond[{1, 2}],
Bond[{1, 3}], Bond[{1, 4}], Bond[{1, 5}]}], ColorRules -> cc,
ImageSize -> 100],
Table[MoleculePlot3D[
Molecule[
Join[{"C"}, (g /. {"D" -> "Cl", "B" -> "Br"})[[
h]]], {Bond[{1, 2}], Bond[{1, 3}], Bond[{1, 4}],
Bond[{1, 5}]}], ColorRules -> cc, ImageSize -> 80], {h, 1,
Length@g}]],
"Mass" ->
If[z == 1,
MoleculeValue[
Molecule[{"C", eleu, eleu, eleu, eleu}, {Bond[{1, 2}],
Bond[{1, 3}], Bond[{1, 4}], Bond[{1, 5}]}], "MolecularMass"],
Table[MoleculeValue[
Molecule[
Join[{"C"}, (g /. {"D" -> "Cl", "B" -> "Br"})[[
h]]], {Bond[{1, 2}], Bond[{1, 3}], Bond[{1, 4}],
Bond[{1, 5}]}], "MolecularMass"], {h, 1, Length@g}]]}]
Using the function:
Halomethanes[{"H", "F", "Cl", "Br", "I"}]
Halomethanes[{"H", "F", "Cl", "Br", "I"}, "Mode" -> "Color"]
Halomethanes[{"H", "F", "Cl", "Br", "I"}, "Mode" -> "Visual"]
Halomethanes[{"H", "F", "Cl", "Br", "I"}, "Mode" -> "Visual3D"]
resp2 = Halomethanes[{"H", "F", "Cl", "Br", "I"}, "Mode" -> "Mass"]
ListPlot[resp2, AxesLabel -> {"n", "Mass(u)"},
LabelStyle -> Directive["Subsubsection", RGBColor[0.07, 0.5, 0.5]],
PlotLabel -> "Halomethanes Mass", PlotRange -> {{0, 80}, {0, 550}},
PlotStyle -> Directive[RGBColor[0.91, 0.08, 0.5], PointSize[Large]],
ImageSize -> Large]






Thanks, J.M., for letting me know that I was using the planar form instead of the tetrahedric.
Link: "Number of inequivalent ways to color vertices of a tetrahedron (A006008-OEIS)":
https://oeis.org/A006008
Thanks.