Author: bugman Date: Fri Jul 2 13:31:52 2010 New Revision: 11282 URL: http://svn.gna.org/viewcvs/relax?rev=11282&view=rev Log: Bug fix for the RDC back_calc() function - the align_id arg was being ignored. The RDCs were being calculated for all tensors, and then assigned to the align_id key. The results was that the back-calculated RDCs were for the last tensor, not for align_id. Modified: 1.3/generic_fns/rdc.py Modified: 1.3/generic_fns/rdc.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/rdc.py?rev=11282&r1=11281&r2=11282&view=diff ============================================================================== --- 1.3/generic_fns/rdc.py (original) +++ 1.3/generic_fns/rdc.py Fri Jul 2 13:31:52 2010 @@ -32,6 +32,7 @@ # relax module imports. from generic_fns import grace, pipes +from generic_fns.align_tensor import get_tensor_index from generic_fns.mol_res_spin import exists_mol_res_spin_data, return_spin, spin_loop from maths_fns.rdc import ave_rdc_tensor from physical_constants import dipolar_constant, return_gyromagnetic_ratio @@ -73,23 +74,21 @@ if type(vectors[0]) in [float, float64]: vectors = [vectors] - # Loop over each alignment. - for i in range(len(cdp.align_tensors)): - # Gyromagnetic ratios. - gx = return_gyromagnetic_ratio(spin.heteronuc_type) - gh = return_gyromagnetic_ratio(spin.proton_type) - - # Calculate the RDC dipolar constant (in Hertz, and the 3 comes from the alignment tensor), and append it to the list. - dj = 3.0/(2.0*pi) * dipolar_constant(gx, gh, spin.r) - - # Unit vectors. - for c in range(cdp.N): - unit_vect[c] = vectors[c] / norm(vectors[c]) - - # Calculate the RDC. - if not hasattr(spin, 'rdc_bc'): - spin.rdc_bc = {} - spin.rdc_bc[align_id] = ave_rdc_tensor(dj, unit_vect, cdp.N, cdp.align_tensors[i].A, weights=weights) + # Gyromagnetic ratios. + gx = return_gyromagnetic_ratio(spin.heteronuc_type) + gh = return_gyromagnetic_ratio(spin.proton_type) + + # Calculate the RDC dipolar constant (in Hertz, and the 3 comes from the alignment tensor), and append it to the list. + dj = 3.0/(2.0*pi) * dipolar_constant(gx, gh, spin.r) + + # Unit vectors. + for c in range(cdp.N): + unit_vect[c] = vectors[c] / norm(vectors[c]) + + # Calculate the RDC. + if not hasattr(spin, 'rdc_bc'): + spin.rdc_bc = {} + spin.rdc_bc[align_id] = ave_rdc_tensor(dj, unit_vect, cdp.N, cdp.align_tensors[get_tensor_index(align_id)].A, weights=weights) def corr_plot(format=None, file=None, dir=None, force=False):