Author: bugman Date: Tue Feb 23 00:33:31 2010 New Revision: 10832 URL: http://svn.gna.org/viewcvs/relax?rev=10832&view=rev Log: Modified _disassemble_result() to be parallelisation friendly. Optimisation results are only stored if the chi2 value is lower! Modified: branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py Modified: branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py?rev=10832&r1=10831&r2=10832&view=diff ============================================================================== --- branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py (original) +++ branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py Tue Feb 23 00:33:31 2010 @@ -336,6 +336,25 @@ # Scaling. if scaling: param_vector = dot(scaling_matrix, param_vector) + + # Check if the chi-squared value is lower. This allows for a parallelised grid search! + if sim_index == None: + # Get the correct value. + if model_type == 'mf' or model_type == 'local_tm': + chi2 = spin.chi2 + elif model_type == 'diff' or model_type == 'all': + chi2 = cdp.chi2 + + # No improvement. + if chi2 != None and func >= chi2: + print("Discarding the optimisation results, the optimised chi-squared value is higher than the current value (%s >= %s)." % (func, chi2)) + + # Exit! + return + + # New minimum. + else: + print("Storing the optimisation results, the optimised chi-squared value is lower than the current value (%s < %s)." % (func, chi2)) # Disassemble the parameter vector. self._disassemble_param_vector(model_type, param_vector=param_vector, spin=spin, sim_index=sim_index)