Re: [Open Babel] Problem with pybel or python

2017-08-09 Thread Noel O'Boyle
...and just for your information, I'd avoid repeated accesses to mol.atoms as it creates a new list of the molecules atoms every time you call it (which can be a speed hit). A good idea is to stick it in a variable on first access and then refer to that variable. On 9 August 2017 at 10:20, Noel O'

Re: [Open Babel] Problem with pybel or python

2017-08-09 Thread Noel O'Boyle
Close, but not quite. You need to delete the C++ atom in the C++ molecule. Something like... for atom in mol: remove.append(atom.OBAtom) for obatom in remove: mol.OBMol.DeleteAtom(obatom) - Noel On 9 August 2017 at 09:46, David van der Spoel wrote: > Hi, > > I am trying to remove ions

[Open Babel] Problem with pybel or python

2017-08-09 Thread David van der Spoel
Hi, I am trying to remove ions from sdf compounds that I downloaded from pubchem using a python script. The script correctly locates the atoms to remove but the del command does not seem to have any effect. Am I making a silly python error? An example input is here https://pubchem.ncbi.nlm.n