How can I prevent Molecule from adding hydrogens automatically?

I imagine it's because CaCl is not a valid compound. If you want CaCl+, you can do:

cacl = Molecule[{Atom["Ca+"], Atom["Cl"]}, {Bond[{1, 2}, "Single"]}]

enter image description here

MoleculeValue[cacl, "CanonicalSMILES"]

"Cl[Ca+]"

For CaCl2:

cacl2 = Molecule[{Atom["Ca"], Atom["Cl"], Atom["Cl"]}, {Bond[{1, 2}, "Single"], Bond[{1, 3}, "Single"]}];
MoleculeValue[cacl2, "CanonicalSMILES"]

"Cl[Ca]Cl"


You can use a SMILES string to create the molecule. In a SMILES string, wrapping an atomic symbol with brackets signifies that there should be no implicit hydrogens added.

mol = Molecule["[Ca][Cl]"]

enter image description here

Note that this does leave an unpaired electron on the calcium atom,

In[17]:= AtomList@mol

Out[17]= {Atom["Ca", "UnpairedElectronCount" -> 1], Atom["Cl"]}

which I think is what you are going for.

I think a reasonable way to input atoms like this would be something like

Molecule[{"[Ca]", "Cl"}, {Bond[{1, 2}, "Single"]}]

I can make the above work for 12.1

Tags:

Chemistry