Author: bugman Date: Thu Apr 14 16:32:43 2011 New Revision: 12821 URL: http://svn.gna.org/viewcvs/relax?rev=12821&view=rev Log: Bug fix for the N-state model for when only the paramagnetic centre position is optimised. If the alignment tensor is fixed, as well as the probabilities of the states, then the optimisation of the paramagnetic centre position was failing as the wrong target function was being used and the correct one was not set up correctly for this. 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=12821&r1=12820&r2=12821&view=diff ============================================================================== --- 1.3/maths_fns/n_state_model.py (original) +++ 1.3/maths_fns/n_state_model.py Thu Apr 14 16:32:43 2011 @@ -385,8 +385,8 @@ self.dfunc = self.dfunc_population self.d2func = self.d2func_population - # Pure tensor optimisation overrides. - if model == 'fixed' and self.centre_fixed: + # Fixed probabilities. + if model == 'fixed': # The probs are unpacked by self.func in the population model, so just override that function. self.func = self.func_tensor_opt self.dfunc = self.dfunc_tensor_opt @@ -395,8 +395,6 @@ # The zero Hessian. self.zero_hessian = zeros(self.num_spins, float64) - # Fixed probabilities. - if model == 'fixed': # The probability array. if probs: self.probs = probs @@ -815,6 +813,14 @@ # Initial chi-squared (or SSE) value. chi2_sum = 0.0 + + # Unpack the paramagnetic centre. + if not self.centre_fixed: + # The position. + self.paramag_centre = params[-3:] + + # Update the paramagnetic info. + self.paramag_info() # Loop over each alignment. for i in xrange(self.num_align):