mailr26167 - /trunk/specific_analyses/relax_disp/api.py


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

Header


Content

Posted by tlinnet on October 06, 2014 - 17:07:
Author: tlinnet
Date: Mon Oct  6 17:07:49 2014
New Revision: 26167

URL: http://svn.gna.org/viewcvs/relax?rev=26167&view=rev
Log:
In the dispersion API calculate(), used the API function model_loop() to loop 
over the clusters instead.

Bug #22754 (https://gna.org/bugs/index.php?22754): The minimise.calculate() 
does not calculate chi2 value for clustered residues.

Modified:
    trunk/specific_analyses/relax_disp/api.py

Modified: trunk/specific_analyses/relax_disp/api.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/api.py?rev=26167&r1=26166&r2=26167&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/api.py   (original)
+++ trunk/specific_analyses/relax_disp/api.py   Mon Oct  6 17:07:49 2014
@@ -261,9 +261,6 @@
         check_mol_res_spin_data()
         check_model_type()
 
-        # Get the looping list over cluster ids.
-        cluster_ids, cluster_spin_list, cluster_spin_id_list, 
cluster_spin_sel_list, clust_contain_spin_id_list = 
self.loop_cluster_ids(spin_id=spin_id)
-
         # Special exponential curve-fitting for the R2eff model.
         if cdp.model_type == MODEL_R2EFF:
             calculate_r2eff()
@@ -273,48 +270,35 @@
             # 1H MMQ flag.
             proton_mmq_flag = has_proton_mmq_cpmg()
 
-            # Loop over the cluster ids.
-            for i, cluster_id in enumerate(cluster_ids):
-                # Get the spins, ids and if the cluster contains the spin of 
interest.
-                cluster_spins = cluster_spin_list[i]
-                cluster_spin_ids = cluster_spin_id_list[i]
-                spin_of_interest = clust_contain_spin_id_list[i]
-
-                # If spin of interest is present:
-                if spin_of_interest:
-                    # If it is a free free spin, then calculate per spin.
-                    if cluster_id == 'free spins':
-                        for si, spin in enumerate(cluster_spins):
-                            cur_spin_id = cluster_spin_ids[si]
-
-                            # Skip protons for MMQ data.
-                            if spin.model in MODEL_LIST_MMQ and spin.isotope 
== '1H':
-                                continue
-
-                            # Get the attached proton.
-                            proton = None
-                            if proton_mmq_flag:
-                                proton = 
return_attached_protons(cur_spin_id)[0]
-
-                            # The back calculated values.
-                            back_calc = back_calc_r2eff(spins=[spin], 
spin_ids=[cur_spin_id], store_chi2=True)
-
-                            # Pack the data.
-                            pack_back_calc_r2eff(spin=spin, 
spin_id=cur_spin_id, si=0, back_calc=back_calc, 
proton_mmq_flag=proton_mmq_flag)
-
-                    else:
-                        # The back calculated values.
-                        back_calc = back_calc_r2eff(spins=cluster_spins, 
spin_ids=cluster_spin_ids, store_chi2=True)
-
-                        # Pack the data.
-                        for si, spin in enumerate(cluster_spins):
-                            cur_spin_id = cluster_spin_ids[si]
-
-                            # Skip protons for MMQ data.
-                            if spin.model in MODEL_LIST_MMQ and spin.isotope 
== '1H':
-                                continue
-
-                            pack_back_calc_r2eff(spin=spin, 
spin_id=cur_spin_id, si=si, back_calc=back_calc, 
proton_mmq_flag=proton_mmq_flag)
+            # Loop over the spin blocks.
+            model_index = -1
+            for spin_ids in self.model_loop():
+                # Increment the model index.
+                model_index += 1
+
+                # The spin containers.
+                spins = spin_ids_to_containers(spin_ids)
+
+                # Skip deselected clusters.
+                skip = True
+                for spin in spins:
+                    if spin.select:
+                        skip = False
+                if skip:
+                    continue
+
+                # Get the attached proton.
+                proton = None
+                if proton_mmq_flag:
+                    proton = return_attached_protons(spin_ids)[0]
+
+                # The back calculated values.
+                back_calc = back_calc_r2eff(spins=spins, spin_ids=spin_ids, 
store_chi2=True)
+
+                # Pack the data.
+                for i, spin in enumerate(spins):
+                    spin_id = spin_ids[i]
+                    pack_back_calc_r2eff(spin=spin, spin_id=spin_id, si=i, 
back_calc=back_calc, proton_mmq_flag=proton_mmq_flag)
 
 
     def constraint_algorithm(self):




Related Messages


Powered by MHonArc, Updated Mon Oct 06 17:20:01 2014