Author: bugman
Date: Mon Feb 23 10:06:59 2015
New Revision: 27712
URL: http://svn.gna.org/viewcvs/relax?rev=27712&view=rev
Log:
Large speed up of the structure.web_of_motion user function.
With the introduction of the _sort() internal structural object method and it
being called by the
add_atom(), the structure.web_of_motion user function was now painfully slow.
As sorting the
structural data is unnecessary for the backend of this user function, the
add_atom() boolean
argument 'sort' has been added to turn the sorting on and off, and the
structure.web_of_motion
backend now sets this to False.
Modified:
trunk/lib/structure/internal/object.py
trunk/pipe_control/structure/main.py
Modified: trunk/lib/structure/internal/object.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/object.py?rev=27712&r1=27711&r2=27712&view=diff
==============================================================================
--- trunk/lib/structure/internal/object.py (original)
+++ trunk/lib/structure/internal/object.py Mon Feb 23 10:06:59 2015
@@ -1092,7 +1092,7 @@
return sheet
- def add_atom(self, mol_name=None, atom_name=None, res_name=None,
res_num=None, pos=[None, None, None], element=None, atom_num=None,
chain_id=None, segment_id=None, pdb_record=None):
+ def add_atom(self, mol_name=None, atom_name=None, res_name=None,
res_num=None, pos=[None, None, None], element=None, atom_num=None,
chain_id=None, segment_id=None, pdb_record=None, sort=False):
"""Add a new atom to the structural data object.
@keyword mol_name: The name of the molecule.
@@ -1115,6 +1115,8 @@
@type segment_id: str or None
@keyword pdb_record: The optional PDB record name, e.g. 'ATOM' or
'HETATM'.
@type pdb_record: str or None
+ @keyword sort: A flag which if True will cause the structural
data to be sorted after adding the atom.
+ @type sort: bool
"""
# Add a model if not present.
@@ -1152,7 +1154,8 @@
mol.atom_add(atom_name=atom_name, res_name=res_name,
res_num=res_num, pos=model_pos, element=element, atom_num=atom_num,
chain_id=chain_id, segment_id=segment_id, pdb_record=pdb_record)
# Sort.
- mol._sort()
+ if sort:
+ mol._sort()
def add_coordinates(self, coord=None, mol_names=None, res_names=None,
res_nums=None, atom_names=None, elements=None, set_mol_name=None,
set_model_num=None):
Modified: trunk/pipe_control/structure/main.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=27712&r1=27711&r2=27712&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py (original)
+++ trunk/pipe_control/structure/main.py Mon Feb 23 10:06:59 2015
@@ -89,7 +89,7 @@
cdp.structure = Internal()
# Add the atoms.
- cdp.structure.add_atom(mol_name=mol_name, atom_name=atom_name,
res_name=res_name, res_num=res_num, pos=pos, element=element,
atom_num=atom_num, chain_id=chain_id, segment_id=segment_id,
pdb_record=pdb_record)
+ cdp.structure.add_atom(mol_name=mol_name, atom_name=atom_name,
res_name=res_name, res_num=res_num, pos=pos, element=element,
atom_num=atom_num, chain_id=chain_id, segment_id=segment_id,
pdb_record=pdb_record, sort=True)
def add_model(model_num=None):
@@ -1655,7 +1655,7 @@
# Loop over the structures.
for struct_index in range(len(ids)):
# Add the atom.
- web.add_atom(mol_name=mol_names[atom_index],
atom_name=atom_names[atom_index], res_name=res_names[atom_index],
res_num=res_nums[atom_index], pos=coord[struct_index, atom_index],
element=elements[atom_index])
+ web.add_atom(mol_name=mol_names[atom_index],
atom_name=atom_names[atom_index], res_name=res_names[atom_index],
res_num=res_nums[atom_index], pos=coord[struct_index, atom_index],
element=elements[atom_index], sort=False)
# Loop over the structures again, this time twice.
for k in range(len(ids)):
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits