Menu

Commit [r22535]  Maximize  Restore  History

Huge speed up of the interatom.define user function.

This is to fix bug #21862 (https://gna.org/bugs/?21862), the freezing up of relax when using the dipolar relaxation button in the model-free auto-analysis in the GUI.

This involves a number of changes. The algorithm for the backend of the interatom.define user function has been broken into two separate parts. The first part is new and uses the internal structural object atom_loop() twice for each spin ID string. This then calls the new are_bonded_index() structural object method which uses atom indices to find if two atoms are bonded, as the atom indices are returned from the atom_loop(). The are_bonded_index() is orders of magnitude faster than are_bonded() as selection objects are not used and the bonded data structure can be directly accessed. The are_bonded() method has also been slightly speed up by improving its logic.

The second part is to perform the original algorithm of two nested spin loops over each spin ID and using the are_bonded() structural method. This second part only happens if the first part finds nothing.

The structural object atom_loop() method has been modified to be able to return the molecule index. These indices are needed for the new are_bonded_index() method.

When running relax with the profile flag turned on, a simple script which loads the 'Ubiquitin2.bz2' saved state and then the "interatom.define(spin_id1='@N', spin_id2='@H', direct_bond=True)" user function decreases from a total time of 143 to 3.8 seconds. However there are no speed changes detectable in the relax test suite - on one computer the system, unit and GUI tests only only vary by a fraction of a second.

bugman 2014-03-26

changed /trunk/lib/structure/internal/object.py
changed /trunk/pipe_control/interatomic.py
/trunk/lib/structure/internal/object.py Diff Switch to side-by-side view
Loading...
/trunk/pipe_control/interatomic.py Diff Switch to side-by-side view
Loading...
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.