Re: [PyMOL] [EXTERNAL] Absymal performance when creating large numbers of bonds

2019-05-26 Thread Thomas Holder
Hi Lorenzo, Looks like the cmd.bond() function is indeed very inefficient. I've found a "TO DO: optimize for performance" comment in the code - that speaks for itself. https://github.com/schrodinger/pymol-open-source/blob/master/layer2/ObjectMolecule.cpp#L4492 Parallelization is not the solutio

Re: [PyMOL] [EXTERNAL] Absymal performance when creating large numbers of bonds

2019-05-25 Thread Lorenzo Gaifas
Hi Blaine, Thanks for your help. I don't think what you suggest is going to solve the problem. The loop itself is quite fast, and I don't need to perform anything else in the loop other than adding those bonds. I already have a list of tuples [(atom1, atom2), (atom3, atom4)] and all I need to do i

Re: [PyMOL] [EXTERNAL] Absymal performance when creating large numbers of bonds

2019-05-25 Thread Mooers, Blaine H.M. (HSC)
Hi Lorenzo, You can import numpy and replace your lists of coordinates with NumPy arrays. Operations with numpy arrays can be >100 times faster than with lists in for loops. See the last example the following blog post for inspiration: https://medium.freecodecamp.org/if-you-have-slow-loops-i