Author: bugman Date: Thu Apr 10 15:49:03 2014 New Revision: 22679 URL: http://svn.gna.org/viewcvs/relax?rev=22679&view=rev Log: Elimination of the specific_analyses.frame_order.checks.check_rdcs() function. This function duplicates the functionality of pipe_control.rdc.check_rdcs() while not being as comprehensive. Switching to the pipe_control.rdc version minimises the amount of code in the frame order analysis, decreasing the potential for bugs. Modified: trunk/specific_analyses/frame_order/api.py trunk/specific_analyses/frame_order/checks.py trunk/specific_analyses/frame_order/optimisation.py Modified: trunk/specific_analyses/frame_order/api.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/frame_order/api.py?rev=22679&r1=22678&r2=22679&view=diff ============================================================================== --- trunk/specific_analyses/frame_order/api.py (original) +++ trunk/specific_analyses/frame_order/api.py Thu Apr 10 15:49:03 2014 @@ -37,9 +37,9 @@ from pipe_control import pipes from pipe_control.interatomic import interatomic_loop, return_interatom from pipe_control.mol_res_spin import return_spin, spin_loop +from pipe_control.rdc import check_rdcs from specific_analyses.api_base import API_base from specific_analyses.api_common import API_common -from specific_analyses.frame_order.checks import check_rdcs from specific_analyses.frame_order.data import base_data_types, domain_moving from specific_analyses.frame_order.optimisation import grid_row, store_bc_data, target_fn_setup, unpack_opt_results from specific_analyses.frame_order.parameter_object import Frame_order_params @@ -81,12 +81,8 @@ # Loop over the interatomic data containers for the moving domain (for the RDC data). for interatom in interatomic_loop(selection1=domain_moving()): - # Get the spins. - spin1 = return_spin(interatom.spin_id1) - spin2 = return_spin(interatom.spin_id2) - # RDC checks. - if not check_rdcs(interatom, spin1, spin2): + if not check_rdcs(interatom): continue # Loop over the alignment IDs. Modified: trunk/specific_analyses/frame_order/checks.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/frame_order/checks.py?rev=22679&r1=22678&r2=22679&view=diff ============================================================================== --- trunk/specific_analyses/frame_order/checks.py (original) +++ trunk/specific_analyses/frame_order/checks.py Thu Apr 10 15:49:03 2014 @@ -36,53 +36,3 @@ # Check for the pivot. if not hasattr(cdp, 'ave_pos_pivot') or not hasattr(cdp, 'ave_pos_translation'): raise RelaxError("The mechanics of the average domain displacements have not been set up, please use the frame_order.average_position user function.") - - -def check_rdcs(interatom, spin1, spin2): - """Check if the RDCs for the given interatomic data container should be used. - - @param interatom: The interatomic data container. - @type interatom: InteratomContainer instance - @param spin1: The first spin container. - @type spin1: SpinContainer instance - @param spin2: The second spin container. - @type spin2: SpinContainer instance - @return: True if the RDCs should be used, False otherwise. - """ - - # Skip deselected spins. - if not spin1.select or not spin2.select: - return False - - # Only use interatomic data containers with RDC data. - if not hasattr(interatom, 'rdc'): - return False - - # RDC data exists but the interatomic vectors are missing? - if not hasattr(interatom, 'vector'): - # Throw a warning. - warn(RelaxWarning("RDC data exists but the interatomic vectors are missing, skipping the spin pair '%s' and '%s'." % (interatom.spin_id1, interatom.spin_id2))) - - # Jump to the next spin. - return False - - # Skip non-Me pseudo-atoms for the first spin. - if hasattr(spin1, 'members') and len(spin1.members) != 3: - warn(RelaxWarning("Only methyl group pseudo atoms are supported due to their fast rotation, skipping the spin pair '%s' and '%s'." % (interatom.spin_id1, interatom.spin_id2))) - return False - - # Skip non-Me pseudo-atoms for the second spin. - if hasattr(spin2, 'members') and len(spin2.members) != 3: - warn(RelaxWarning("Only methyl group pseudo atoms are supported due to their fast rotation, skipping the spin pair '%s' and '%s'." % (interatom.spin_id1, interatom.spin_id2))) - return False - - # Checks. - if not hasattr(spin1, 'isotope'): - raise RelaxSpinTypeError(interatom.spin_id1) - if not hasattr(spin2, 'isotope'): - raise RelaxSpinTypeError(interatom.spin_id2) - if not hasattr(interatom, 'r'): - raise RelaxNoValueError("averaged interatomic distance") - - # Everything is ok. - return True Modified: trunk/specific_analyses/frame_order/optimisation.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/frame_order/optimisation.py?rev=22679&r1=22678&r2=22679&view=diff ============================================================================== --- trunk/specific_analyses/frame_order/optimisation.py (original) +++ trunk/specific_analyses/frame_order/optimisation.py Thu Apr 10 15:49:03 2014 @@ -38,8 +38,9 @@ from lib.warnings import RelaxWarning from pipe_control.interatomic import interatomic_loop from pipe_control.mol_res_spin import return_spin, spin_loop +from pipe_control.rdc import check_rdcs from pipe_control.structure.mass import pipe_centre_of_mass -from specific_analyses.frame_order.checks import check_ave_domain_setup, check_rdcs +from specific_analyses.frame_order.checks import check_ave_domain_setup from specific_analyses.frame_order.data import base_data_types, domain_moving, pivot_fixed, tensor_loop, translation_fixed from specific_analyses.frame_order.parameters import assemble_param_vector, assemble_scaling_matrix from target_functions import frame_order @@ -281,13 +282,13 @@ # The unit vectors and RDC constants. for interatom in interatomic_loop(selection1=domain_moving()): + # RDC checks. + if not check_rdcs(interatom): + continue + # Get the spins. spin1 = return_spin(interatom.spin_id1) spin2 = return_spin(interatom.spin_id2) - - # RDC checks. - if not check_rdcs(interatom, spin1, spin2): - continue # A single unit vector. if interatom.vector.shape == (3,): @@ -591,12 +592,8 @@ # Interatomic data container loop. rdc_index = 0 for interatom in interatomic_loop(domain_moving()): - # Get the spins. - spin1 = return_spin(interatom.spin_id1) - spin2 = return_spin(interatom.spin_id2) - # RDC checks. - if not check_rdcs(interatom, spin1, spin2): + if not check_rdcs(interatom): continue # Initialise the data structure.