mailr16455 - in /branches/uf_redesign: ./ generic_fns/structure/main.py relax_errors.py specific_fns/model_free/mf_minimise.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 25, 2012 - 11:56:
Author: bugman
Date: Fri May 25 11:56:08 2012
New Revision: 16455

URL: http://svn.gna.org/viewcvs/relax?rev=16455&view=rev
Log:
Merged revisions 16451-16454 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r16451 | bugman | 2012-05-25 09:23:58 +0200 (Fri, 25 May 2012) | 9 lines
  
  Made the bond vector extraction print out from structure.vectors more 
informative.
  
  This is in response to James Nyirenda's <jamesn7414 att yahoo dott com> 
post at
  https://mail.gna.org/public/relax-users/2012-05/msg00023.html (Message-id:
  <1337916876.99384.YahooMailNeo@xxxxxxxxxxxxxxxxxxxxxxxxxxx>).
  
  The number of vectors extracted is now being printed out.
........
  r16452 | bugman | 2012-05-25 09:32:17 +0200 (Fri, 25 May 2012) | 3 lines
  
  A small change for the structure.vectors print out.
........
  r16453 | bugman | 2012-05-25 09:47:49 +0200 (Fri, 25 May 2012) | 10 lines
  
  The model-free minimisation is now checking for multiple vectors per spin, 
and raises a RelaxError.
  
  This is in response to James Nyirenda's <jamesn7414 att yahoo dott com> 
post at
  https://mail.gna.org/public/relax-users/2012-05/msg00023.html (Message-id:
  <1337916876.99384.YahooMailNeo@xxxxxxxxxxxxxxxxxxxxxxxxxxx>).
  
  The RelaxMultiVectorError has been modified to accept a spin ID.  This 
error is now raised if
  multiple vectors exist per spin, as model-free analysis cannot handle this.
........
  r16454 | bugman | 2012-05-25 11:30:38 +0200 (Fri, 25 May 2012) | 7 lines
  
  Fix for a bug introduced at r16453.
  
  The structure.vectors user function will now store single vectors as a 3D, 
rank-1 array.  In some
  cases this was being stored as a list of 3D, rank-1 arrays which was then 
failing in with the 
  RelaxMultipleVectorError in the model-free code.
........

Modified:
    branches/uf_redesign/   (props changed)
    branches/uf_redesign/generic_fns/structure/main.py
    branches/uf_redesign/relax_errors.py
    branches/uf_redesign/specific_fns/model_free/mf_minimise.py

Propchange: branches/uf_redesign/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 25 11:56:08 2012
@@ -1,1 +1,1 @@
-/1.3:1-16363
+/1.3:1-16454

Modified: branches/uf_redesign/generic_fns/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/generic_fns/structure/main.py?rev=16455&r1=16454&r2=16455&view=diff
==============================================================================
--- branches/uf_redesign/generic_fns/structure/main.py (original)
+++ branches/uf_redesign/generic_fns/structure/main.py Fri May 25 11:56:08 
2012
@@ -819,6 +819,10 @@
         else:
             vector = bond_vectors
 
+        # Convert to a single vector if needed.
+        if len(vector) == 1:
+            vector = vector[0]
+
         # Set the vector.
         setattr(spin, object_name, vector)
 
@@ -827,10 +831,16 @@
 
         # Print out of modified spins.
         if verbosity:
+            # The number of vectors.
+            num = len(bond_vectors)
+            plural = 's'
+            if num == 1:
+                plural = ''
+
             if spin.name:
-                print(("Extracted " + spin.name + "-" + str(attached_name) + 
" vectors for " + repr(id) + '.'))
+                print("Extracted %s %s-%s vector%s for the spin '%s'." % 
(num, spin.name, attached_name, plural, id))
             else:
-                print(("Extracted " + str(spin.num) + "-" + 
str(attached_name) + " vectors for " + repr(id) + '.'))
+                print("Extracted %s %s-%s vector%s for the spin '%s'." % 
(num, spin.num, attached_name, plural, id))
 
     # Right, catch the problem of missing vectors to prevent massive user 
confusion!
     if no_vectors:

Modified: branches/uf_redesign/relax_errors.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/relax_errors.py?rev=16455&r1=16454&r2=16455&view=diff
==============================================================================
--- branches/uf_redesign/relax_errors.py (original)
+++ branches/uf_redesign/relax_errors.py Fri May 25 11:56:08 2012
@@ -262,8 +262,11 @@
 
 # Multiple unit vectors.
 class RelaxMultiVectorError(BaseError):
-    def __init__(self):
-        self.text = "The multiple unit XH bond vectors per spin - this is 
not supported by the current data pipe type."
+    def __init__(self, spin_id=None):
+        if spin_id != None:
+            self.text = "The multiple unit XH bond vectors for the spin '%s' 
- this is not supported by the current data pipe type." % spin_id
+        else:
+            self.text = "The multiple unit XH bond vectors per spin - this 
is not supported by the current data pipe type."
 
 # No unit vectors.
 class RelaxNoVectorsError(BaseError):

Modified: branches/uf_redesign/specific_fns/model_free/mf_minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/specific_fns/model_free/mf_minimise.py?rev=16455&r1=16454&r2=16455&view=diff
==============================================================================
--- branches/uf_redesign/specific_fns/model_free/mf_minimise.py (original)
+++ branches/uf_redesign/specific_fns/model_free/mf_minimise.py Fri May 25 
11:56:08 2012
@@ -1102,7 +1102,14 @@
 
             # Vectors.
             if data_store.model_type != 'local_tm' and cdp.diff_tensor.type 
!= 'sphere':
+                # Check that this is a single vector!
+                if arg_check.is_num_list(spin.xh_vect[0], raise_error=False):
+                    raise RelaxMultiVectorError(data_store.spin_id)
+
+                # Store the vector.
                 data_store.xh_unit_vectors.append(spin.xh_vect)
+
+            # No vector.
             else:
                 data_store.xh_unit_vectors.append(None)
 




Related Messages


Powered by MHonArc, Updated Fri May 25 16:20:02 2012