Author: bugman Date: Tue Aug 17 18:40:03 2010 New Revision: 11529 URL: http://svn.gna.org/viewcvs/relax?rev=11529&view=rev Log: pymol.cone_pdb() is now rotating the moving domain to the average position for the frame order theory. Modified: 1.3/generic_fns/pymol_control.py Modified: 1.3/generic_fns/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pymol_control.py?rev=11529&r1=11528&r2=11529&view=diff ============================================================================== --- 1.3/generic_fns/pymol_control.py (original) +++ 1.3/generic_fns/pymol_control.py Tue Aug 17 18:40:03 2010 @@ -29,12 +29,14 @@ # Python module imports. if dep_check.pymol_module: import pymol +from numpy import float64, zeros from os import sep from subprocess import PIPE, Popen # relax module imports. from generic_fns.mol_res_spin import exists_mol_res_spin_data from generic_fns import pipes +from maths_fns.rotation_matrix import euler_to_R_zyz, R_to_axis_angle from relax_errors import RelaxError, RelaxNoPdbError, RelaxNoSequenceError from relax_io import file_root, open_write_file, test_binary from specific_fns.setup import get_specific_fn @@ -279,6 +281,25 @@ # Remove the selection. pymol_obj.exec_cmd("cmd.delete('sele')") + + + # Rotate to the average position. + ################################# + + # The average position rotation. + ave_pos_R = zeros((3, 3), float64) + euler_to_R_zyz(cdp.ave_pos_alpha, cdp.ave_pos_beta, cdp.ave_pos_gamma, ave_pos_R) + + # Convert to axis-angle notation. + axis, angle = R_to_axis_angle(ave_pos_R) + + # The PDB file to rotate. + for i in range(len(cdp.domain_to_pdb)): + if cdp.domain_to_pdb[i][0] != cdp.ref_domain: + pdb = cdp.domain_to_pdb[i][1] + + # Execute the pymol command to rotate. + pymol_obj.exec_cmd("cmd.rotate([%s, %s, %s], %s, '%s', origin=[%s, %s, %s])" % (axis[0], axis[1], axis[2], angle, pdb, cdp.pivot[0], cdp.pivot[1], cdp.pivot[2])) def create_macro(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None):