Thank you for your answer.
I will try the new version.

Regards
Santiago
________________________________
De: David Cosgrove <davidacosgrov...@gmail.com>
Enviado: jueves, 4 de mayo de 2023 11:29
Para: Santiago Fraga <santi...@mestrelab.com>
Cc: Wim Dehaen <wimdeh...@gmail.com>; RDKit Discuss 
<rdkit-discuss@lists.sourceforge.net>
Asunto: Re: [Rdkit-discuss] Molfile from smiles

As part of the work on improving the way RDKit handles organometallics that is 
in the latest release, there is MolOps::cleanUpOrganometallics, which attempts 
to do the bond transformations in a similar way to that gist.  The intention 
was that this would be part of the default sanitization, but late in the day it 
was discovered that it didn't work well with compounds with 2 metal atoms and 
bridging chlorine atoms, such as 'F[Pd]1(Cl)Cl->[Pd](Cl)(Cl)<-Cl1'.  It's my 
intention to fix that at some point in the near future, but in the meantime if 
you're working in C++ it is available for use with caveats.  Worth a try in 
this case, perhaps.
Dave


On Thu, May 4, 2023 at 9:51 AM Santiago Fraga 
<santi...@mestrelab.com<mailto:santi...@mestrelab.com>> wrote:
Good morning Wim
      Yes, I know that the original smiles has problems with the dative bonds.
      I am trying to load the molecule and then fix those bonds using this 
solution:
      https://gist.github.com/greglandrum/6cd7aadcdedb1ebcafa9537e8a47e3a4

      And then generate a new molfile. I will try to apply your code to see if 
I can improve the molecule
      depiction.

 Regards
 Santiago

[http://www.mestrelab.com/mestrelab/wp-content/uploads/signs/line3.jpg]
[http://www.mestrelab.com/mestrelab/wp-content/uploads/signs/M-red-200pxb.jpg]<http://www.mestrelab.com>

SANTIAGO FRAGA
Software Developer
santi...@mestrelab.com<mailto:+santi...@mestrelab.com>

MESTRELAB RESEARCH S.L.
PHONE +34881976775
FAX +34981941079
Feliciano Barrera, 9B-Bajo 15706
Santiago de Compostela (SPAIN)

Follow us:
[Mestrelab Twitter]<https://twitter.com/mestrelab>  [Mestrelab Linkedin] 
<https://www.linkedin.com/company/mestrelab-research>   [Canal de YouTube 
Mestrelab] <https://www.youtube.com/channel/UCf3MVnd3XZflv0acvTv14ww>   
[MestreBlog] <http://mestrelab.com/blog/>



________________________________
De: Wim Dehaen <wimdeh...@gmail.com<mailto:wimdeh...@gmail.com>>
Enviado: martes, 2 de mayo de 2023 21:37
Para: Santiago Fraga <santi...@mestrelab.com<mailto:santi...@mestrelab.com>>
Cc: Ling Chan <lingtrek...@gmail.com<mailto:lingtrek...@gmail.com>>; RDKit 
Discuss 
<rdkit-discuss@lists.sourceforge.net<mailto:rdkit-discuss@lists.sourceforge.net>>
Asunto: Re: [Rdkit-discuss] Molfile from smiles

Hi all,
unfortunately I can't offer a "fix" but I can offer these minor comments:
-it seems like the SMILES has some parsing error. You can make uses of RDKits 
extension for dative bonds in SMILES ("->") and replace the SMILES with the 
below, which will parse, and give (what i assume is) the intended structure:
"C1=CC2=[N](C=C1)->[Ir]134(C5=CC=CC=C25)C2=CC=CC=C2C2=[N]->1C=CC=C2.C1=CC(C2=CC=CC=C32)=[N]->4C=C1"
-more fundamentally, i think the reason this molecule is hard to render is 
because, as a hexavalent iridium complex it is more fundamentally 3-dimensional 
and therefore tougher to sketch. you can see here on wikipedia Ir(ppy)3 even 
when manually sketched looks a bit funny:
https://upload.wikimedia.org/wikipedia/commons/c/c8/Ir%28ppy%29_Schematic.png
-in general, organometallic species have various limitations when it comes to 
their handling by cheminformatics packages. for this reason, some care is 
needed when dealing with species like this to make sure you won't have issues 
down the line. an overview of some rdkit related ones see this presentation by 
prof jan jensen: 
https://raw.githubusercontent.com/rdkit/UGM_2020/master/Presentations/JanJensen.pdf

Finally, if i embed the molecule and then display its 2D projection, it 
actually looks pretty good (despite a warning UFF doesnt recognize iridium). 
See below:
[image.png]
This was generated using the following codeblock (in Python, not C++, sorry for 
that):

mol = 
Chem.MolFromSmiles("C1=CC2=[N](C=C1)->[Ir]134(C5=CC=CC=C25)C2=CC=CC=C2C2=[N]->1C=CC=C2.C1=CC(C2=CC=CC=C32)=[N]->4C=C1",sanitize=True)
mol = Chem.AddHs(mol)
AllChem.EmbedMolecule(mol,randomSeed=0xf00d)
mol = Chem.RemoveHs(mol)
display(mol)

best wishes
wim

On Tue, May 2, 2023 at 5:06 PM Santiago Fraga 
<santi...@mestrelab.com<mailto:santi...@mestrelab.com>> wrote:
Thanks for your answer, Ling Chan.
But I am already using that option with the C++ API.

Regards
Santiago

[http://www.mestrelab.com/mestrelab/wp-content/uploads/signs/line3.jpg]
[http://www.mestrelab.com/mestrelab/wp-content/uploads/signs/M-red-200pxb.jpg]<http://www.mestrelab.com>

SANTIAGO FRAGA
Software Developer
santi...@mestrelab.com<mailto:+santi...@mestrelab.com>

MESTRELAB RESEARCH S.L.
PHONE +34881976775
FAX +34981941079
Feliciano Barrera, 9B-Bajo 15706
Santiago de Compostela (SPAIN)

Follow us:
[Mestrelab Twitter]<https://twitter.com/mestrelab>  [Mestrelab Linkedin] 
<https://www.linkedin.com/company/mestrelab-research>   [Canal de YouTube 
Mestrelab] <https://www.youtube.com/channel/UCf3MVnd3XZflv0acvTv14ww>   
[MestreBlog] <http://mestrelab.com/blog/>



________________________________
De: Ling Chan <lingtrek...@gmail.com<mailto:lingtrek...@gmail.com>>
Enviado: martes, 2 de mayo de 2023 4:15
Para: Santiago Fraga <santi...@mestrelab.com<mailto:santi...@mestrelab.com>>
Cc: RDKit Discuss 
<rdkit-discuss@lists.sourceforge.net<mailto:rdkit-discuss@lists.sourceforge.net>>
Asunto: Re: [Rdkit-discuss] Molfile from smiles

Hello Santiago,

In case you are still looking for an answer, somewhere in my notes I wrote the 
following.

to get a better depiction of complicated topology, do this before rendering.
from rdkit.Chem import rdDepictor
rdDepictor.SetPreferCoordGen(True)

Sometimes it helps. Good luck.

Ling



Santiago Fraga <santi...@mestrelab.com<mailto:santi...@mestrelab.com>> 於 
2023年4月21日週五 上午2:17寫道:
Good morning

          I am trying to generate a molfile from smiles, using the RDKit C++ 
implementation.
          But in some cases the result molfile is like the one in the attached 
image.

          My code is something like this:

string molecule = 
"C1=CC2=[N](C=C1)[Ir]134(C5=CC=CC=C25)C2=CC=CC=C2C2=[N]1C=CC=C2.C1=CC(C2=CC=CC=C32)=[N]4C=C1";
RDKit::ROMol* mol = RDKit::SmilesToMol(molecule, 0, false, nullptr);
mol->updatePropertyCache(false);
RDDepict::preferCoordGen = true;
RDDepict::compute2DCoords(*mol);
string molfile = RDKit::MolToMolBlock(*mol, true, -1, false, true)

           How could I fix the molfile?

Regards
Santiago


_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


--
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to