Dear Jason,
The geometry that you/me visualized in a 2D plot necessarily doesn't exist
in real world except a few planner molecules. To view 3D geometry of a
molecule, 2D representation doesn't work. Please feel free to do whatever
you want to do with your molecule while producing 2D graph. Everyone
understands that the plots are only for representation purpose. And please
consider geometry optimization/minimization of your molecule although ETKDG
produces very good quality geometry. Hope it helps! - malitha

On Sat, Dec 2, 2017 at 12:11 AM, Jason Biggs <jasondbi...@gmail.com> wrote:

> Thank you Malitha,
>
> If I'm understanding the Draw code (not a given, my python ist nicht gut),
> then MolToMPL (or MolToImage) is just using the 3D conformation generated
> by EmbedMolecule.  Is it just chopping off the z-coordinate?  For
> acetylene, this works out because it gets embedded mostly in the XY plane
> by default, but it would fail if the 3D conformer were aligned along the
> z-axis.
>
> I would think GenerateDepictionMatching3DStructure is the safe way to do
> this, but it also seems to have trouble with acetylene
>
> m = Chem.MolFromSmiles('C#C')
> m2=Chem.rdmolops.AddHs(m)
> AllChem.EmbedMolecule(m2, AllChem.ETKDG())
> m3=Chem.rdmolops.AddHs(m)
> Chem.rdDepictor.GenerateDepictionMatching3DStructure(m3,m2)
> m3.GetConformer(0).GetPositions()
>
>
> array([[  1.60734892e-16,   7.50000000e-01,   0.00000000e+00],
>        [ -1.14810637e-16,  -7.50000000e-01,   0.00000000e+00],
>        [ -4.82204677e-16,  -7.50000000e-01,   0.00000000e+00],
>        [  4.36280422e-16,   7.50000000e-01,   0.00000000e+00]])
>
>
> The above seems to happen with any terminal alkyne hydrogen.  I will file
> an issue for this
>
> Jason
>
> Jason Biggs
>
>
> On Fri, Dec 1, 2017 at 4:59 AM, Malitha Kabir <malitha12...@gmail.com>
> wrote:
>
>> Hi Jason,
>>
>> I hope the following codes will help you a little.
>>
>> from rdkit import Chem
>> from rdkit.Chem import Draw
>> from rdkit.Chem import AllChem
>> size = (120, 120)
>> m = Chem.MolFromSmiles('C#C')
>> m2=Chem.rdmolops.AddHs(m)
>> AllChem.EmbedMolecule(m2, AllChem.ETKDG())
>> Draw.MolToMPL(m2, size=size)
>>
>> *** source code link (non specific to your question though)
>> https://github.com/rdkit/rdkit
>>
>> Thanks. - malitha
>>
>>
>> On Fri, Dec 1, 2017 at 6:42 AM, Jason Biggs <jasondbi...@gmail.com>
>> wrote:
>>
>>>
>>> m = Chem.MolFromSmiles('C#C')
>>>
>>>
>>> renders fine
>>>
>>> [image: Inline image 1]
>>>
>>> but adding in the hydrogens, they don't snap to a linear arrangement
>>>
>>> m2=Chem.rdmolops.AddHs(m)
>>>
>>>
>>> [image: Inline image 3]
>>>
>>>
>>> This doesn't just affect acetylene, but any terminal alkyne, like
>>> 'c1ccc(CCC#C)cc1'.
>>>
>>> I can write a hack on my end to look for this special case, but where in
>>> the drawing code does it decide where to place hydrogens?
>>>
>>> Jason Biggs
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Rdkit-discuss mailing list
>>> Rdkit-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>>>
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to