7

Consider the following:

cacl = Molecule[{Atom["Ca"], Atom["Cl"]}, {Bond[{1, 2}, "Single"]}];
MoleculeValue[cacl, "CanonicalSMILES"]
(* Cl[CaH] *)

Notice the artificial insertion of the hydrogen atom to fill the valency of the calcium atom. I understand that this behaviour is mentioned in the official documentation:

"Hydrogen atoms may be omitted from the atom list if their presence can be inferred from the valence and bonding of the atoms present."

But is there a way to suppress this default behaviour? I want the SMILES representation of the molecule above to be Cl[Ca+], not Cl[CaH].

Shredderroy
  • 5,249
  • 17
  • 26
  • Unfortunately, there seems to be no way. I think this choice of default behaviour was a very short-sighted decision on the part of Wolfram Research. – Shredderroy Oct 08 '19 at 16:34

2 Answers2

7

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"

MelaGo
  • 8,586
  • 1
  • 11
  • 24
5

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

Jason B.
  • 68,381
  • 3
  • 139
  • 286
  • Perhaps explicitly indicating the formal charge of a specific atom might be sufficient? – J. M.'s missing motivation Nov 17 '19 at 22:29
  • I have accepted this because it answers the question as posed. Since you seem to be in charge of these features within Mathematica, it might be relevant to mention that what I would really like is the ability to start with the command Molecule[atoms, bonds] and have a way to suppress the automatic insertion of hydrogen atoms. I am doing some combinatorics on the graph structures of molecules, and generating SMILES only in the very end to record results. So, if Mathematica could accept a command like Molecule[atoms, bonds, InsertHydrogens -> False], that would be awesome. – Shredderroy Nov 18 '19 at 16:46
  • I have something like this, try Molecule[{Atom["Ca"], Atom["Cl"]}, {Bond[{1, 2}, "Single"]}, IncludeHydrogens -> None]. From re-reading your question it seems you would like the calcium here to automatically be given a positive charge instead of a radical electron. I'm not sure if that is the right behavior for all applications. – Jason B. Nov 18 '19 at 18:42