mailr11261 - /1.3/maths_fns/n_state_model.py


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

Header


Content

Posted by edward on June 29, 2010 - 12:24:
Author: bugman
Date: Tue Jun 29 12:24:42 2010
New Revision: 11261

URL: http://svn.gna.org/viewcvs/relax?rev=11261&view=rev
Log:
Fixes for the N-state model target function setup for when no parameters are 
optimised.


Modified:
    1.3/maths_fns/n_state_model.py

Modified: 1.3/maths_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/maths_fns/n_state_model.py?rev=11261&r1=11260&r2=11261&view=diff
==============================================================================
--- 1.3/maths_fns/n_state_model.py (original)
+++ 1.3/maths_fns/n_state_model.py Tue Jun 29 12:24:42 2010
@@ -30,7 +30,7 @@
 from float import isNaN
 from pcs import ave_pcs_tensor, ave_pcs_tensor_ddeltaij_dAmn, pcs_tensor
 from rdc import ave_rdc_tensor, ave_rdc_tensor_dDij_dAmn, rdc_tensor
-from relax_errors import RelaxImplementError
+from relax_errors import RelaxError, RelaxImplementError
 from rotation_matrix import euler_to_R_zyz
 
 
@@ -190,36 +190,6 @@
 
         # The flexible population or equal probability N-state models.
         elif model in ['population', 'fixed']:
-            # Fixed alignment tensors.
-            if full_tensors != None:
-                # The optimisation flag.
-                self.tensor_opt = False
-
-                # Convert to numpy.
-                self.full_tensors = array(full_tensors, float64)
-
-                # Convert to 3x3 form.
-                self.num_tensors = len(self.full_tensors) / 5
-                self.A = zeros((self.num_tensors, 3, 3), float64)
-                for i in range(self.num_tensors):
-                    to_tensor(self.A[i], self.full_tensors[5*i:5*i+5])
-
-            # Optimised alignment tensors.
-            else:
-                # The optimisation flag.
-                self.tensor_opt = True
-
-                # Alignment tensor function and gradient matrices.
-                self.A = zeros((self.num_align, 3, 3), float64)
-                self.dA = zeros((5, 3, 3), float64)
-
-                # The alignment tensor gradients don't change, so 
pre-calculate them.
-                dAi_dAxx(self.dA[0])
-                dAi_dAyy(self.dA[1])
-                dAi_dAxy(self.dA[2])
-                dAi_dAxz(self.dA[3])
-                dAi_dAyz(self.dA[4])
-
             # Set the RDC and PCS flags (indicating the presence of data).
             self.rdc_flag = True
             self.pcs_flag = True
@@ -234,22 +204,50 @@
             if self.pcs_flag and (pcs_vect == None or not len(pcs_vect)):
                 raise RelaxError("The pcs_vect argument " + repr(pcs_vect) + 
" must be supplied.")
 
-            # No data?
-            if not self.rdc_flag and not self.pcs_flag:
-                raise RelaxError("No RDC or PCS data has been supplied.")
-
             # The total number of spins.
+            self.num_spins = 0
             if self.rdc_flag:
                 self.num_spins = len(rdcs[0])
-            else:
+            elif self.pcs_flag:
                 self.num_spins = len(pcs[0])
 
             # The total number of alignments.
+            self.num_align = 0
             if self.rdc_flag:
                 self.num_align = len(rdcs)
-            else:
+            elif self.pcs_flag:
                 self.num_align = len(pcs)
             self.num_align_params = self.num_align * 5
+
+            # Fixed alignment tensors.
+            if full_tensors != None:
+                # The optimisation flag.
+                self.tensor_opt = False
+
+                # Convert to numpy.
+                self.full_tensors = array(full_tensors, float64)
+
+                # Convert to 3x3 form.
+                self.num_tensors = len(self.full_tensors) / 5
+                self.A = zeros((self.num_tensors, 3, 3), float64)
+                for i in range(self.num_tensors):
+                    to_tensor(self.A[i], self.full_tensors[5*i:5*i+5])
+
+            # Optimised alignment tensors.
+            else:
+                # The optimisation flag.
+                self.tensor_opt = True
+
+                # Alignment tensor function and gradient matrices.
+                self.A = zeros((self.num_align, 3, 3), float64)
+                self.dA = zeros((5, 3, 3), float64)
+
+                # The alignment tensor gradients don't change, so 
pre-calculate them.
+                dAi_dAxx(self.dA[0])
+                dAi_dAyy(self.dA[1])
+                dAi_dAxy(self.dA[2])
+                dAi_dAxz(self.dA[3])
+                dAi_dAyz(self.dA[4])
 
             # PCS errors.
             if self.pcs_flag:




Related Messages


Powered by MHonArc, Updated Tue Jun 29 14:20:02 2010