Author: bugman Date: Tue Jul 1 13:49:54 2014 New Revision: 24375 URL: http://svn.gna.org/viewcvs/relax?rev=24375&view=rev Log: Added support for labels in the rotor geometric object for the internal structural object. The labels are created by the frame_order.pdb_model user function backend. For the double rotor model, these are 'x-ax' and 'y-ax'. For all other models, the label is 'z-ax'. The labels are then sent into the lib.structure.represent.rotor.rotor() function via the new label argument. This function adds two new atoms to the rotor molecule which are 2 Angstrom outside of the rotor span and lying on the rotor axis. These then have their atom name set to the label. The residue name is set to the new RTL name which has been added to the internal structural object _get_chemical_name() method to describe the residue in the PDB file for the user. Finally the pymol.frame_order user function selects these atoms, hides them and then labels them using the atom name (x-ax, y-ax, or z-ax). Modified: branches/frame_order_cleanup/lib/structure/internal/object.py branches/frame_order_cleanup/lib/structure/represent/rotor.py branches/frame_order_cleanup/pipe_control/pymol_control.py branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py Modified: branches/frame_order_cleanup/lib/structure/internal/object.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/structure/internal/object.py?rev=24375&r1=24374&r2=24375&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/structure/internal/object.py (original) +++ branches/frame_order_cleanup/lib/structure/internal/object.py Tue Jul 1 13:49:54 2014 @@ -202,6 +202,7 @@ | AVE | Average vector | | RTX | Axis of the rotor geometric object | | RTB | Propeller blades of the rotor geometric object | + | RTL | Labels for the rotor geometric object | | CON | Cone object | | CNC | Apex or centre of the cone geometric object | | CNX | Axis of the cone geometric object | @@ -226,6 +227,7 @@ "AVE": "Average vector", "RTX": "Axis of the rotor geometric object", "RTB": "Propeller blades of the rotor geometric object", + "RTL": "Labels for the rotor geometric object", "CON": "Cone object", "CNC": "Apex or centre of the cone geometric object", "CNX": "Axis of the cone geometric object", Modified: branches/frame_order_cleanup/lib/structure/represent/rotor.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/structure/represent/rotor.py?rev=24375&r1=24374&r2=24375&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/structure/represent/rotor.py (original) +++ branches/frame_order_cleanup/lib/structure/represent/rotor.py Tue Jul 1 13:49:54 2014 @@ -32,7 +32,7 @@ from lib.geometry.rotations import axis_angle_to_R -def rotor(structure=None, rotor_angle=None, axis=None, axis_pt=True, centre=None, span=2e-9, blade_length=5e-10, model=None, staggered=False): +def rotor(structure=None, rotor_angle=None, axis=None, axis_pt=True, label=None, centre=None, span=2e-9, blade_length=5e-10, model=None, staggered=False): """Create a PDB representation of a rotor motional model. @keyword structure: The internal structural object instance to add the rotor to as a molecule. @@ -43,6 +43,8 @@ @type axis: numpy rank-1, 3D array @keyword axis_pt: A point lying anywhere on the rotor axis. This is used to define the position of the axis in 3D space. @type axis_pt: numpy rank-1, 3D array + @keyword label: The optional label for the rotor axis. If supplied, this cannot be longer than 4 characters due to the PDB format restriction. + @type label: str @keyword centre: The central point of the representation. If this point is not on the rotor axis, then the closest point on the axis will be used for the centre. @type centre: numpy rank-1, 3D array @keyword span: The distance from the central point to the rotor blades (meters). @@ -100,6 +102,13 @@ # Create the rotor propellers. rotor_propellers(mol=mol, rotor_angle=rotor_angle, centre=prop1, axis=axis, blade_length=blade_length, staggered=staggered) rotor_propellers(mol=mol, rotor_angle=rotor_angle, centre=prop2, axis=-axis, blade_length=blade_length, staggered=staggered) + + # Add atoms for the labels. + label_pos1 = mid_point + axis_norm * (span + 2.0) + label_pos2 = mid_point - axis_norm * (span + 2.0) + res_num = mol.res_num[-1]+1 + mol.atom_add(pdb_record='HETATM', atom_name=label, res_name='RTL', res_num=res_num, pos=label_pos1, element='H') + mol.atom_add(pdb_record='HETATM', atom_name=label, res_name='RTL', res_num=res_num, pos=label_pos2, element='H') def rotor_propellers(mol=None, rotor_angle=None, centre=None, axis=None, blade_length=5.0, staggered=False): Modified: branches/frame_order_cleanup/pipe_control/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/pymol_control.py?rev=24375&r1=24374&r2=24375&view=diff ============================================================================== --- branches/frame_order_cleanup/pipe_control/pymol_control.py (original) +++ branches/frame_order_cleanup/pipe_control/pymol_control.py Tue Jul 1 13:49:54 2014 @@ -675,6 +675,12 @@ pymol_obj.exec_cmd("set stick_radius, 0.15, 'sele'") pymol_obj.exec_cmd("cmd.delete('sele')") + # Rotor objects: The labels. + pymol_obj.exec_cmd("select (%s & resn RTL)" % id) + pymol_obj.exec_cmd("hide ('sele')") + pymol_obj.exec_cmd("cmd.label(\"sele\",\"name\")") + pymol_obj.exec_cmd("cmd.delete('sele')") + def tensor_pdb(file=None): """Display the diffusion tensor geometric structure. Modified: branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py?rev=24375&r1=24374&r2=24375&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py Tue Jul 1 13:49:54 2014 @@ -266,6 +266,7 @@ pivot = [] rotor_angle = [] com = [] + label = [] # The pivot points. pivot1 = generate_pivot(order=1) @@ -308,6 +309,9 @@ # The pivot. pivot.append(pivot1) + # The label. + label.append('z-ax') + # The double rotor models. elif cdp.model in ['double rotor']: # Add both rotor angles (the 2nd must come first). @@ -338,9 +342,13 @@ pivot.append(pivot2) pivot.append(pivot1) + # The labels. + label.append('x-ax') + label.append('y-ax') + # Add each rotor to the structure as a new molecule. for i in range(len(axis)): - rotor(structure=structure, rotor_angle=rotor_angle[i], axis=axis[i], axis_pt=pivot[i], centre=com[i], span=span[i], blade_length=5e-10, staggered=staggered[i]) + rotor(structure=structure, rotor_angle=rotor_angle[i], axis=axis[i], axis_pt=pivot[i], label=label[i], centre=com[i], span=span[i], blade_length=5e-10, staggered=staggered[i]) def create_ave_pos(format='PDB', file=None, dir=None, force=False):