Author: bugman Date: Sat Mar 22 15:22:52 2008 New Revision: 5137 URL: http://svn.gna.org/viewcvs/relax?rev=5137&view=rev Log: Updated the model-free determine_param_set_type() method to the new relax design. Modified: 1.3/specific_fns/model_free/model_free.py Modified: 1.3/specific_fns/model_free/model_free.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/model_free.py?rev=5137&r1=5136&r2=5137&view=diff ============================================================================== --- 1.3/specific_fns/model_free/model_free.py (original) +++ 1.3/specific_fns/model_free/model_free.py Sat Mar 22 15:22:52 2008 @@ -802,50 +802,54 @@ self.relax.generic.runs.eliminate_unused_runs() - def determine_param_set_type(self, run=None): - """Determine the type of parameter set.""" - - # Run name. - if run: - self.run = run + def determine_param_set_type(self): + """Determine the type of parameter set. + + @return: The name of the parameter set, which is one of 'all', 'diff', 'mf', or + 'local_tm'. + @rtype: str + """ + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] # Test if sequence data is loaded. - if not relax_data_store.res.has_key(self.run): - raise RelaxNoSequenceError, self.run + if not exists_mol_res_spin_data(): + raise RelaxNoSequenceError # If there is a local tm, fail if not all residues have a local tm parameter. local_tm = 0 - for i in xrange(len(relax_data_store.res[self.run])): + for spin in spin_loop(): # Skip unselected residues. # This code causes a bug after model elimination if the model has been eliminated (select = 0). - #if not relax_data_store.res[self.run][i].select: + #if not spin.select: # continue # No params. - if not hasattr(relax_data_store.res[self.run][i], 'params') or not relax_data_store.res[self.run][i].params: + if not hasattr(spin, 'params') or not spin.params: continue # Local tm. - if local_tm == 0 and 'local_tm' in relax_data_store.res[self.run][i].params: + if local_tm == 0 and 'local_tm' in spin.params: local_tm = 1 # Inconsistencies. - elif local_tm == 1 and not 'local_tm' in relax_data_store.res[self.run][i].params: + elif local_tm == 1 and not 'local_tm' in spin.params: raise RelaxError, "All residues must either have a local tm parameter or not." # Check if any model-free parameters are allowed to vary. mf_all_fixed = 1 - for i in xrange(len(relax_data_store.res[self.run])): + for spin in spin_loop(): # Skip unselected residues. # This code causes a bug after model elimination if the model has been eliminated (select = 0). - #if not relax_data_store.res[self.run][i].select: + #if not spin.select: # continue # Test the fixed flag. - if not hasattr(relax_data_store.res[self.run][i], 'fixed'): + if not hasattr(spin, 'fixed'): mf_all_fixed = 0 break - if not relax_data_store.res[self.run][i].fixed: + if not spin.fixed: mf_all_fixed = 0 break @@ -854,19 +858,19 @@ return 'local_tm' # Test if the diffusion tensor data is loaded. - if not relax_data_store.diff.has_key(self.run): - raise RelaxNoTensorError, self.run + if not diff_data_exists(): + raise RelaxNoTensorError, 'diffusion' # 'diff' parameter set. if mf_all_fixed: - # All parameters fixed. - if relax_data_store.diff[self.run].fixed: + # All parameters fixed! + if cdp.diff.fixed: raise RelaxError, "All parameters are fixed." return 'diff' # 'mf' parameter set. - if relax_data_store.diff[self.run].fixed: + if cdp.diff.fixed: return 'mf' # 'all' parameter set.