Some questions on molecule manipulation

28 views
Skip to first unread message

ecniv

unread,
Jun 18, 2013, 4:14:33 AM6/18/13
to indigo-...@googlegroups.com

Hello,

I've several questions regarding Indigo toolkit (JAVA wrapper 1.1.7) :

- Is there a way to remove several bonds from a molecule ? It is possible to remove several atoms, to remove bonds one by one, but it seems that there is no method to remove several bonds with a single call. As a consequence, one has to loop over each bond and call remove(), which is quite slow, at least compared to removeAtoms(int [] indices)

- Is there a hidden method / property that could be used to retrieve the Hybridization of a particular atom ?

- When atoms / bonds are removed from a molecule, indices are kept as they were defined, i.e. an atom with index() == 14 will remain with the same index even if only 10 atoms remain in the molecule. Is there a way to reset indices so they range from 0 to N-1 atoms / bonds, or is it something expected and necessary ?

- A side note: I performed some basic performance profiling on various processes involving the manipulation of molecules with indigo (JAVA), and I was surprised to see that IndigoObject.hasNext() is quite time consuming (pretty much the same amount of time is spent in hasNext and next(), even for simple iteration over atom and bonds of a molecule. Some methods that seem quite simple as well (index, atomicNumber, isRSite) also take a significant amount of time, while others (e.g. symbol()) are much faster. Any clue on that ? Just to be sure that there is no hope for optimization (i.e. JNA overhead only).

Cheers :)
Vincent

ecniv

unread,
Jun 20, 2013, 7:06:41 AM6/20/13
to indigo-...@googlegroups.com
I suspect a bug related to the 3rd point:

Say I remove atom with index = 2 from a benzene. In that case, if I loop over the remaining atoms and retrieve the atom's indices, I''ll get [0, 1, 3, 4, 5]: atoms indices are not reset. 

It would be perfectly OK in theory, but if now I try to retrieve atom with index  = 5, I'll get an exception saying that the index is invalid (index = 5, size = 5).

I would argue that this is a bug: if indices are not updated upon the removal of atoms / bonds, they should still be accessible from these indices. 

What do you think ?

Best,
Vincent
Reply all
Reply to author
Forward
0 new messages