Please leave rdkit-discuss on your replies so that the entire discussion is public.
The problem here is that [I-].[K+] is not a molecule. It's two separate ions. The SMILES does not imply any sort of bond between them. Here's the explanation of this from the Daylight Theory Manual ( https://www.daylight.com/dayhtml/doc/theory/theory.smiles.html): 3.2.5 Disconnected Structures Disconnected compounds are written as individual structures separated by a "." (period). The order in which ions or ligands are listed is arbitrary. There is no implied pairing of one charge with another, nor is it necessary to have a net zero charge. Since SMILES doesn't have a way to encode ionic bonds, if you really want to add an ionic bond there, you can do so manually: In [7]: m = Chem.MolFromSmiles('[I-].[K+]') In [8]: rwm = Chem.RWMol(m) In [9]: rwm.AddBond(0,1,Chem.BondType.IONIC) Out[9]: 1 Just as a general side comment about chemistry: Smiles is designed to represent molecules. Like many species that include ionic bonds, the "standard" form of potassium iodide is not actually a molecule, it's a crystalline lattice (in the NaCl structure) composed of K+ and I- ions. Each K+ is surrounded by six I-'s and each I- is surrounded by six K+'s. -greg On Mon, Aug 10, 2020 at 3:05 PM Behnaz Hoseyni <hoseyni...@gmail.com> wrote: > i am using graph neural network to predict property of molecules, and i > should give feature to any edge(bond). for example ('[I-].[K+]'). but > with rdkit I can not recognize that there is a bond(edge) between these two > atoms. > > On Mon, Aug 10, 2020 at 4:24 PM Greg Landrum <greg.land...@gmail.com> > wrote: > >> Hi, >> >> The RDKit's valence model does not include explicit ionic bonds. >> There may be a useful workaround though... can you please provide an >> example molecule that you would like to work with? >> >> Thanks, >> -greg >> >> >> On Mon, Aug 10, 2020 at 11:09 AM Behnaz Hoseyni <hoseyni...@gmail.com> >> wrote: >> >>> Hello. Thank you for your very good module. I needed to find the ionic >>> bonds of the molecules, but I could not find the correct order in Rdkit. >>> GetBondType() only give single,Double, Triple & aromatic, But i need to get >>> ionic bond.Please help me. >>> thank you advance >>> _______________________________________________ >>> Rdkit-discuss mailing list >>> Rdkit-discuss@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >>> >>
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss