pierrepo / PBxplore

A suite of tools to explore protein structures with Protein Blocks :snake:
https://pbxplore.readthedocs.org/en/latest/
MIT License
28 stars 17 forks source link

Improve the calculation of angle RMSD for assignation. #116

Closed HubLot closed 8 years ago

HubLot commented 8 years ago

Hi,

Again a quick optimization now on the assignation of Protein Blocks. I focused on the assign() function, decreased by 65% the time spent in it. It takes now ~20% of total time (against ~50% before) Globally, we gained ~15-20% speed-up for the whole program PBassign.

I reintroduced numpy because now, I deal with operations between matrix (16*8) and vectors. I also found a clever way to compute the real difference between 2 angles. Before, a function _angle_modulo_360_ was called and caused a big bottleneck. Now it's done in one line and without a for loop :)

pierrepo commented 8 years ago

@HubLot you're on fire! Or under drug? Very good job anyway. Did you double-triple check the modulo360 hack?

HubLot commented 8 years ago

ahah, I enjoyed optimization process :) Yeah, I checked with sample xtc and PDB, I have identical values. Plus, all tests written by @jbarnoud passed. I'm quite confident in this hack.

pierrepo commented 8 years ago

So let's go for it!