Yes, go backwards through the index list.

for index in sorted(indices, reverse=True):
  mol.RemoveAtom(index)

Indices are only changed if they are higher than the removed index.
----
Brian Kelley

> On Jun 25, 2017, at 10:16 AM, Changge Ji <chicago...@gmail.com> wrote:
> 
> Dear all,
> 
> Is there an easy way to delete several atoms in a molecule according to an 
> index list ?
> 
> RWMol RemoveAtom() can only delete one atom each time.
> And after that, the index changed. 
> 
> Many Thanks.
> 
> Best,
> Changge
> Changge Ji
> ------------------------------------------------------------------------------
> 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