r28166 - /trunk/test_suite/system_tests/structure.py

2016-01-12 Thread edward
Author: bugman
Date: Tue Jan 12 09:43:10 2016
New Revision: 28166

URL: http://svn.gna.org/viewcvs/relax?rev=28166=rev
Log:
Fix for the Structure.test_read_pdb_internal3 system test.

With the new atomic position concatenation support, when called sequentially the
structure.load_spins user function should always use the same value for the 
ave_pos argument.


Modified:
trunk/test_suite/system_tests/structure.py

Modified: trunk/test_suite/system_tests/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=28166=28165=28166=diff
==
--- trunk/test_suite/system_tests/structure.py  (original)
+++ trunk/test_suite/system_tests/structure.py  Tue Jan 12 09:43:10 2016
@@ -1,6 +1,6 @@
 ###
 # #
-# Copyright (C) 2008-2015 Edward d'Auvergne   #
+# Copyright (C) 2008-2016 Edward d'Auvergne   #
 # #
 # This file is part of the program relax (http://www.nmr-relax.com).  #
 # #
@@ -4498,7 +4498,7 @@
 self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 2)
 
 # And now all the rest of the atoms.
-self.interpreter.structure.load_spins()
+self.interpreter.structure.load_spins(ave_pos=False)
 
 
 def test_read_pdb_internal4(self):


___
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

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


r28164 - in /trunk: pipe_control/structure/main.py user_functions/structure.py

2016-01-12 Thread edward
Author: bugman
Date: Tue Jan 12 09:38:10 2016
New Revision: 28164

URL: http://svn.gna.org/viewcvs/relax?rev=28164=rev
Log:
Added the spin_num boolean argument to the structure.load_spins user function.

Setting this flag to False will cause the spin number information to be ignored 
when creating the
spin containers.  This allows for better support of homologous structures but 
with different PDB
atom numbering.  The default flag value is True, preserving the old behaviour.


Modified:
trunk/pipe_control/structure/main.py
trunk/user_functions/structure.py

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=28164=28163=28164=diff
==
--- trunk/pipe_control/structure/main.py(original)
+++ trunk/pipe_control/structure/main.pyTue Jan 12 09:38:10 2016
@@ -1,6 +1,6 @@
 ###
 # #
-# Copyright (C) 2003-2015 Edward d'Auvergne   #
+# Copyright (C) 2003-2016 Edward d'Auvergne   #
 # #
 # This file is part of the program relax (http://www.nmr-relax.com).  #
 # #
@@ -816,7 +816,7 @@
 write_data(out=sys.stdout, headings=["Spin_ID", "Position"], data=data)
 
 
-def load_spins(spin_id=None, str_id=None, from_mols=None, 
mol_name_target=None, ave_pos=False):
+def load_spins(spin_id=None, str_id=None, from_mols=None, 
mol_name_target=None, ave_pos=False, spin_num=True):
 """Load the spins from the structural object into the relax data store.
 
 @keyword spin_id:   The molecule, residue, and spin identifier 
string.
@@ -829,11 +829,13 @@
 @type mol_name_target:  str or None
 @keyword ave_pos:   A flag specifying if the average atom position 
or the atom position from all loaded structures is loaded into the 
SpinContainer.
 @type ave_pos:  bool
+@keyword spin_num:  A flag specifying if the spin number should be 
loaded.
+@type spin_num: bool
 """
 
 # The multi-molecule case.
 if from_mols != None:
-load_spins_multi_mol(spin_id=spin_id, str_id=str_id, 
from_mols=from_mols, mol_name_target=mol_name_target, ave_pos=ave_pos)
+load_spins_multi_mol(spin_id=spin_id, str_id=str_id, 
from_mols=from_mols, mol_name_target=mol_name_target, ave_pos=ave_pos, 
spin_num=spin_num)
 return
 
 # Checks.
@@ -856,6 +858,10 @@
 # Override the molecule name.
 if mol_name_target:
 mol_name = mol_name_target
+
+# No spin number.
+if not spin_num:
+atom_num = None
 
 # Remove the '+' regular expression character from the mol, res, and 
spin names!
 if mol_name and search('\+', mol_name):
@@ -904,7 +910,7 @@
 cdp.N = cdp.structure.num_models()
 
 
-def load_spins_multi_mol(spin_id=None, str_id=None, from_mols=None, 
mol_name_target=None, ave_pos=False):
+def load_spins_multi_mol(spin_id=None, str_id=None, from_mols=None, 
mol_name_target=None, ave_pos=False, spin_num=True):
 """Load the spins from the structural object into the relax data store.
 
 @keyword spin_id:   The molecule, residue, and spin identifier 
string.
@@ -917,6 +923,8 @@
 @type mol_name_target:  str or None
 @keyword ave_pos:   A flag specifying if the average atom position 
or the atom position from all loaded structures is loaded into the 
SpinContainer.
 @type ave_pos:  bool
+@keyword spin_num:  A flag specifying if the spin number should be 
loaded.
+@type spin_num: bool
 """
 
 # Checks.
@@ -966,6 +974,10 @@
 res_name = res_name.replace('+', '')
 if atom_name and search('\+', atom_name):
 atom_name = atom_name.replace('+', '')
+
+# No spin number.
+if not spin_num:
+atom_num = None
 
 # Generate a spin ID for the current atom.
 id = generate_spin_id_unique(mol_name=mol_name_target, 
res_num=res_num, res_name=res_name, spin_name=atom_name)

Modified: trunk/user_functions/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/user_functions/structure.py?rev=28164=28163=28164=diff
==
--- trunk/user_functions/structure.py   (original)
+++ trunk/user_functions/structure.py   Tue Jan 12 09:38:10 2016
@@ -1,6 +1,6 @@
 ###
 # #

r28165 - /trunk/pipe_control/structure/main.py

2016-01-12 Thread edward
Author: bugman
Date: Tue Jan 12 09:41:21 2016
New Revision: 28165

URL: http://svn.gna.org/viewcvs/relax?rev=28165=rev
Log:
Added support for concatenating atomic positions in the structure.load_spins 
user function.

Together with the spin_num flag set to False, this allows for atomic positions 
to be read from
multiple homologous structures with different PDB atomic numbering.  The spin 
containers will be
created from the first structure, in which the spin is defined, and the atomic 
position from
subsequent structures will be appended to the list of current atomic positions.


Modified:
trunk/pipe_control/structure/main.py

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=28165=28164=28165=diff
==
--- trunk/pipe_control/structure/main.py(original)
+++ trunk/pipe_control/structure/main.pyTue Jan 12 09:41:21 2016
@@ -21,7 +21,7 @@
 
 # Python module imports.
 from minfx.generic import generic_minimise
-from numpy import array, average, dot, float64, mean, ones, std, zeros
+from numpy import array, average, concatenate, dot, float64, mean, ones, std, 
zeros
 from numpy.linalg import norm
 from os import F_OK, access, getcwd
 from re import search
@@ -893,7 +893,11 @@
 spin_names.append(atom_name)
 
 # Position vector.
-spin_cont.pos = pos
+if hasattr(spin_cont, 'pos') and spin_cont.pos != None and 
(spin_cont.pos.shape != pos.shape or (spin_cont.pos != pos).any()):
+warn(RelaxWarning("Positional information already exists for the 
spin %s, appending the new positions." % id))
+spin_cont.pos = concatenate((spin_cont.pos, pos))
+else:
+spin_cont.pos = pos
 
 # Add the element.
 spin_cont.element = element


___
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

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