New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AtomGroup.rotate is slow #1707
Comments
One difference between the numpy and mda versions of things is MDA ensures that the positions it works on are all unique. It would be interesting to see if commenting out the uniqueness check in MDA improves performance a lot for your large system |
what position uniqueness check? |
@kain88-de unique atoms more than positions I guess https://github.com/MDAnalysis/mdanalysis/blob/develop/package/MDAnalysis/core/groups.py#L827 this line looks needlessly slow too, no reason to go via |
I was wondering about the use of unique here anyway. |
Expected behaviour
Using
universe.atoms.rotate(rotation_matrix)
should be as fast asnp.dot(universe.atoms.postions, rotation_matrix)
.Actual behaviour
The
rotate
method is almost 7x slower thannp.dot
. In the test system it's almost unnoticeable (70μs
vs490μs
), but in my production system it's a difference of ~30 seconds (withnumpy
) and ~2m30s (withMDAnalysis
).Code to reproduce the behaviour
See this notebook.
In my production system I first translate and then rotate my system. To isolate the exact problem, I've used all variations: rotate only, translate only and rotate+translate. Also I've done the tests on both single frames and while iterating over all frames.
Currently version of MDAnalysis:
0.16.2
The text was updated successfully, but these errors were encountered: