I have a couple of function definitions in a wider class that I'm writing in python. For one function I embed the molecules with n number of conformers, I then want to make sure that these conformers remain with the parsed molecule after the function call. I thought this was done by reference under the hood so I wouldn't have to specifically set the conformers (see code snippet 1. below). However, this doesn't see to be the case. I tried to parse back the conformers and then do a setOwningMol but I get an error saying that the conformer class has no attribute setOwningMol or SetOwningMol (see snippet 2.) Any ideas on how to proceed would be great.
snippet 1:
gen_conformers(rdkitmol,n)
rdkmol.GetNumConformers() #### returns 0 here, I thought this would be done by reference?
def gen_conformers(rdkitmol,n):
cids = AllChem.EmbedMultipleConfs(rdkmol,numConfs=n)
rdkmol.GetNumConformers() #### returns n here
snippet 2:
confs = gen_conformers(rdkitmol,n)
for conf in confs:
conf.SetOwningMol(rdkitmol) #### 'Conformer' object has no attribute 'SetOwningMol' I tried with setOwningMol also
def gen_conformers(rdkitmol,n):
cids = AllChem.EmbedMultipleConfs(rdkmol,numConfs=n)
return rdkmol.GetConformers()
question from:
https://stackoverflow.com/questions/65923796/setowningmol-rdkit-in-python3 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…