Author: bugman Date: Fri Jun 14 18:38:24 2013 New Revision: 20132 URL: http://svn.gna.org/viewcvs/relax?rev=20132&view=rev Log: Merged revisions 20129-20131 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r20129 | bugman | 2013-06-14 18:27:46 +0200 (Fri, 14 Jun 2013) | 6 lines Removed the absolute argument for all of the lib.alignment.rdc functions. This should be performed at the level of the target function, as mathematical operations may be required prior to taking the absolute value. ........ r20130 | bugman | 2013-06-14 18:35:34 +0200 (Fri, 14 Jun 2013) | 6 lines Fixes for the N-state model target functions for the lib.alignment.rdc changes. The absolute value is now calculated within the target function rather than when back calculating the RDCs. ........ r20131 | bugman | 2013-06-14 18:37:54 +0200 (Fri, 14 Jun 2013) | 3 lines Simple fix for an error made in r20126. ........ Modified: branches/relax_disp/ (props changed) branches/relax_disp/lib/alignment/rdc.py branches/relax_disp/pipe_control/rdc.py branches/relax_disp/target_functions/n_state_model.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Jun 14 18:38:24 2013 @@ -1,1 +1,1 @@ -/trunk:1-20127 +/trunk:1-20131 Modified: branches/relax_disp/lib/alignment/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/alignment/rdc.py?rev=20132&r1=20131&r2=20132&view=diff ============================================================================== --- branches/relax_disp/lib/alignment/rdc.py (original) +++ branches/relax_disp/lib/alignment/rdc.py Fri Jun 14 18:38:24 2013 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2008-2012 Edward d'Auvergne # +# Copyright (C) 2008-2013 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -87,7 +87,7 @@ return dj * val -def ave_rdc_tensor(dj, vect, N, A, weights=None, absolute=False): +def ave_rdc_tensor(dj, vect, N, A, weights=None): """Calculate the ensemble average RDC, using the 3D tensor. This function calculates the average RDC for a set of XH bond vectors from a structural ensemble, using the 3D tensorial form of the alignment tensor. The formula for this ensemble average RDC value is:: @@ -136,8 +136,6 @@ @type A: numpy rank-2 3D tensor @keyword weights: The weights for each member of the ensemble (the last member need not be supplied). @type weights: numpy rank-1 array or None - @keyword absolute: The absolute value or signless RDC flag. - @type absolute: int @return: The average RDC value. @rtype: float """ @@ -161,13 +159,10 @@ val = val + weights[c] * dot(vect[c], dot(A, vect[c])) # Return the average RDC. - if absolute: - return abs(dj * val) - else: - return dj * val - - -def ave_rdc_tensor_dDij_dAmn(dj, vect, N, dAi_dAmn, weights=None, absolute=False): + return dj * val + + +def ave_rdc_tensor_dDij_dAmn(dj, vect, N, dAi_dAmn, weights=None): """Calculate the ensemble average RDC gradient element for Amn, using the 3D tensor. This function calculates the average RDC gradient for a set of XH bond vectors from a structural ensemble, using the 3D tensorial form of the alignment tensor. The formula for this ensemble average RDC gradient element is:: @@ -203,8 +198,6 @@ @type dAi_dAmn: numpy rank-2 3D tensor @keyword weights: The weights for each member of the ensemble (the last member need not be supplied). @type weights: numpy rank-1 array - @keyword absolute: The absolute value or signless RDC flag. - @type absolute: int @return: The average RDC gradient element. @rtype: float """ @@ -228,13 +221,10 @@ grad = grad + weights[c] * dot(vect[c], dot(dAi_dAmn, vect[c])) # Return the average RDC gradient element. - if absolute: - return dj * grad - else: - return dj * grad - - -def rdc_tensor(dj, mu, A, absolute=False): + return dj * grad + + +def rdc_tensor(dj, mu, A): """Calculate the RDC, using the 3D alignment tensor. The RDC value is:: @@ -274,14 +264,9 @@ @type mu: numpy rank-1 3D array @param A: The alignment tensor. @type A: numpy rank-2 3D tensor - @keyword absolute: The absolute value or signless RDC flag. - @type absolute: int @return: The RDC value. @rtype: float """ # Return the RDC. - if absolute: - return abs(dj * dot(mu, dot(A, mu))) - else: - return dj * dot(mu, dot(A, mu)) + return dj * dot(mu, dot(A, mu)) Modified: branches/relax_disp/pipe_control/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/rdc.py?rev=20132&r1=20131&r2=20132&view=diff ============================================================================== --- branches/relax_disp/pipe_control/rdc.py (original) +++ branches/relax_disp/pipe_control/rdc.py Fri Jun 14 18:38:24 2013 @@ -468,7 +468,7 @@ rdc_data = True if hasattr(interatom, 'rdc_bc') and align_id in interatom.rdc_bc: rdc_bc_data = True - j_flag = True + j_flag = False if align_id in cdp.rdc_data_types and cdp.rdc_data_types[align_id] == 'T': j_flag = True if not hasattr(interatom, 'j_coupling'): Modified: branches/relax_disp/target_functions/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/n_state_model.py?rev=20132&r1=20131&r2=20132&view=diff ============================================================================== --- branches/relax_disp/target_functions/n_state_model.py (original) +++ branches/relax_disp/target_functions/n_state_model.py Fri Jun 14 18:38:24 2013 @@ -675,11 +675,15 @@ for j in range(self.num_interatom): # Calculate the average RDC. if not self.missing_rdc[align_index, j]: - self.rdc_theta[align_index, j] = ave_rdc_tensor(self.dip_const[j], self.dip_vect[j], self.N, self.A[align_index], weights=self.probs, absolute=self.absolute_rdc[align_index, j]) + self.rdc_theta[align_index, j] = ave_rdc_tensor(self.dip_const[j], self.dip_vect[j], self.N, self.A[align_index], weights=self.probs) # Add the J coupling to convert into the back-calculated T = J+D value. if self.j_flag: self.rdc_theta[align_index, j] += self.j_couplings[j] + + # Take the absolute value. + if self.absolute_rdc[align_index, j]: + self.rdc_theta[align_index, j] = abs(self.rdc_theta[align_index, j]) # The back calculated PCS. if self.pcs_flag[align_index]: @@ -929,11 +933,11 @@ if not self.fixed_tensors[align_index]: for j in range(self.num_interatom): if self.rdc_flag[align_index] and not self.missing_rdc[align_index, j]: - self.drdc_theta[align_index*5, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[0], weights=self.probs, absolute=self.absolute_rdc[align_index, j]) - self.drdc_theta[align_index*5+1, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[1], weights=self.probs, absolute=self.absolute_rdc[align_index, j]) - self.drdc_theta[align_index*5+2, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[2], weights=self.probs, absolute=self.absolute_rdc[align_index, j]) - self.drdc_theta[align_index*5+3, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[3], weights=self.probs, absolute=self.absolute_rdc[align_index, j]) - self.drdc_theta[align_index*5+4, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[4], weights=self.probs, absolute=self.absolute_rdc[align_index, j]) + self.drdc_theta[align_index*5, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[0], weights=self.probs) + self.drdc_theta[align_index*5+1, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[1], weights=self.probs) + self.drdc_theta[align_index*5+2, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[2], weights=self.probs) + self.drdc_theta[align_index*5+3, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[3], weights=self.probs) + self.drdc_theta[align_index*5+4, align_index, j] = ave_rdc_tensor_dDij_dAmn(self.dip_const[j], self.dip_vect[j], self.N, self.dA[4], weights=self.probs) # Construct the Amn partial derivative components for the PCS. if not self.fixed_tensors[align_index]: @@ -960,7 +964,7 @@ # Calculate the RDC for state c (this is the pc partial derivative). for j in range(self.num_interatom): if self.rdc_flag[align_index] and not self.missing_rdc[align_index, j]: - self.drdc_theta[param_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.A[align_index], absolute=self.absolute_rdc[align_index, j]) + self.drdc_theta[param_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.A[align_index]) # Calculate the PCS for state c (this is the pc partial derivative). for j in range(self.num_spins): @@ -1135,11 +1139,11 @@ # Calculate the RDC Hessian component. for j in range(self.num_interatom): if self.fixed_tensors[align_index] and self.rdc_flag[align_index] and not self.missing_rdc[align_index, j]: - self.d2rdc_theta[pc_index, align_index*5+0, align_index, j] = self.d2rdc_theta[align_index*5+0, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[0], absolute=self.absolute_rdc[align_index, j]) - self.d2rdc_theta[pc_index, align_index*5+1, align_index, j] = self.d2rdc_theta[align_index*5+1, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[1], absolute=self.absolute_rdc[align_index, j]) - self.d2rdc_theta[pc_index, align_index*5+2, align_index, j] = self.d2rdc_theta[align_index*5+2, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[2], absolute=self.absolute_rdc[align_index, j]) - self.d2rdc_theta[pc_index, align_index*5+3, align_index, j] = self.d2rdc_theta[align_index*5+3, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[3], absolute=self.absolute_rdc[align_index, j]) - self.d2rdc_theta[pc_index, align_index*5+4, align_index, j] = self.d2rdc_theta[align_index*5+4, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[4], absolute=self.absolute_rdc[align_index, j]) + self.d2rdc_theta[pc_index, align_index*5+0, align_index, j] = self.d2rdc_theta[align_index*5+0, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[0]) + self.d2rdc_theta[pc_index, align_index*5+1, align_index, j] = self.d2rdc_theta[align_index*5+1, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[1]) + self.d2rdc_theta[pc_index, align_index*5+2, align_index, j] = self.d2rdc_theta[align_index*5+2, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[2]) + self.d2rdc_theta[pc_index, align_index*5+3, align_index, j] = self.d2rdc_theta[align_index*5+3, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[3]) + self.d2rdc_theta[pc_index, align_index*5+4, align_index, j] = self.d2rdc_theta[align_index*5+4, pc_index, align_index, j] = rdc_tensor(self.dip_const[j], self.dip_vect[j, c], self.dA[4]) # Calculate the PCS Hessian component. for j in range(self.num_spins):