Skip to content

SetOwningMol #3766

Answered by greglandrum
woodg07 asked this question in Q&A
Jan 27, 2021 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

@woodg07 I don't really understand what you're trying to do.

AllChem.EmbedMultipleConfs adds conformations to a molecule; you don't need to do any additional work to add the conformers to the molecule:

>>> from rdkit.Chem import AllChem
>>> from rdkit import Chem
>>> m = Chem.AddHs(Chem.MolFromSmiles('CCCO'))
>>> cids = AllChem.EmbedMultipleConfs(m,5)
>>> m.GetNumConformers()
5

If your concern is that adding the conformers in a function may not change the molecule in the calling scope, you don't need to be:

>>> def gen_confs(mol,n):
...     AllChem.EmbedMultipleConfs(mol,n)
... 
>>> m = Chem.AddHs(Chem.MolFromSmiles('CCCO'))
>>> gen_confs(m,7)
>>> m.GetNumConformers()
7

Does that answer…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@woodg07
Comment options

Answer selected by greglandrum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants