Dear  Gustavo,

The show_rdkit function has a "conf_id" keyword argument that takes the id
of the conformer to display. You may see the documentation:
http://nglviewer.org/nglview/latest/api.html#nglview.show_rdkit

To get a conformer of a mol as an independent mol, you may use the
following function which takes a mol and a conformer id then returns a new
mol that has only the specified conformer:

def ConfToMol(mol, conf_id):
    conf = mol.GetConformer(conf_id)
    new_mol = Chem.Mol(mol)
    new_mol.RemoveAllConformers()
    new_mol.AddConformer(Chem.Conformer(conf))
    return new_mol

I hope this works for you.
Best regards,
Omar



On Fri, Jan 8, 2021 at 1:58 AM Gustavo Seabra <gustavo.sea...@gmail.com>
wrote:

> Hi all,
>
> Could anyone please help me with ideas on how to visualize
> molecule conformers inside a Jupyter notebook?
>
> I generate the conformers, for example, using:
> AllChem.EmbedMultipleConfs(mol, numConfs=5)
>
> And would like to see them in 3D inside the notebook.
>
> I tried using NGLView(https://github.com/nglviewer/nglview), but it
> only shows what I believe is the first conformer in the molecule. How can I
> change the conformer shown? or maybe is there a way to convert the
> conformers to Mol objects?
>
> Any idea would be greatly appreciated.
>
> Thank you!
> --
> Gustavo Seabra.
> _______________________________________________
> 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

Reply via email to