Author: bugman Date: Fri Jul 4 11:02:51 2014 New Revision: 24451 URL: http://svn.gna.org/viewcvs/relax?rev=24451&view=rev Log: Changes to the rotor object in the frame order geometric representations. For the isotropic and pseudo-elliptic cone models, the rotor is now halved. Instead of having two axes radiating from the central pivot and terminating in the propeller blades, now only the positive axis is shown lying in the centre of the cone. Modified: branches/frame_order_cleanup/lib/structure/represent/rotor.py branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py 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=24451&r1=24450&r2=24451&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/structure/represent/rotor.py (original) +++ branches/frame_order_cleanup/lib/structure/represent/rotor.py Fri Jul 4 11:02:51 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, label=None, centre=None, span=2e-9, blade_length=5e-10, model_num=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_num=None, staggered=False, half_rotor=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. @@ -55,6 +55,8 @@ @type model_num: int or None @keyword staggered: A flag which if True will cause the rotor blades to be staggered. This is used to avoid blade overlap. @type staggered: bool + @keyword half_rotor: A flag which if True will cause only the positive half of the rotor to be created. + @type half_rotor: bool """ # Convert the arguments to numpy arrays, radians and Angstrom. @@ -87,28 +89,31 @@ mid_point = closest_point_ax(line_pt=axis_pt, axis=axis, point=centre) pos_index = mol.atom_add(pdb_record='HETATM', atom_name='CTR', res_name='RTX', res_num=1, pos=mid_point, element='PT') - # Centre of the propellers. + # Centre of the propellers, positive half. prop1 = mid_point + axis_norm * span prop1_index = pos_index + 1 mol.atom_add(pdb_record='HETATM', atom_name='PRP', res_name='RTX', res_num=2, pos=prop1, element='O') mol.atom_connect(index1=pos_index, index2=prop1_index) - # Centre of the propellers. - prop2 = mid_point - axis_norm * span - prop2_index = pos_index + 2 - mol.atom_add(pdb_record='HETATM', atom_name='PRP', res_name='RTX', res_num=3, pos=prop2, element='O') - mol.atom_connect(index1=pos_index, index2=prop2_index) + # Centre of the propellers, negative half. + if not half_rotor: + prop2 = mid_point - axis_norm * span + prop2_index = pos_index + 2 + mol.atom_add(pdb_record='HETATM', atom_name='PRP', res_name='RTX', res_num=3, pos=prop2, element='O') + mol.atom_connect(index1=pos_index, index2=prop2_index) # 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) + if not half_rotor: + rotor_propellers(mol=mol, rotor_angle=rotor_angle, centre=prop2, axis=-axis, blade_length=blade_length, staggered=staggered) # Add atoms for the labels. + res_num = mol.res_num[-1]+1 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') + if not half_rotor: + label_pos2 = mid_point - axis_norm * (span + 2.0) + 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/specific_analyses/frame_order/geometric.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py?rev=24451&r1=24450&r2=24451&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py Fri Jul 4 11:02:51 2014 @@ -387,13 +387,15 @@ mol.atom_add(atom_name=atom_name, res_name='TLE', res_num=1, pos=pos, element='Ti', pdb_record='HETATM') -def add_rotors(structure=None, sims=False): +def add_rotors(structure=None, representation=None, sims=False): """Add all rotor objects for the current frame order model to the structural object. - @keyword structure: The internal structural object to add the rotor objects to. - @type structure: lib.structure.internal.object.Internal instance - @keyword sims: A flag which if True will add the Monte Carlo simulation rotors to the structural object. There must be one model for each Monte Carlo simulation already present in the structural object. - @type sims: bool + @keyword structure: The internal structural object to add the rotor objects to. + @type structure: lib.structure.internal.object.Internal instance + @keyword representation: The representation to create. If this is set to None, the rotor will be dumbbell shaped with propellers at both ends. If set to 'A' or 'B', only half of the rotor will be shown. + @type representation: None or str + @keyword sims: A flag which if True will add the Monte Carlo simulation rotors to the structural object. There must be one model for each Monte Carlo simulation already present in the structural object. + @type sims: bool """ # Initialise the list structures for the rotor data. @@ -406,6 +408,17 @@ label = [] models = [] + # The half-rotor flag. + half_rotor = True + if representation == None: + half_rotor = False + + # The transformation matrix (identity matrix or inversion matrix). + if representation == 'B': + T = -eye(3) + else: + T = eye(3) + # The models to loop over. model_nums = [None] sim_indices = [None] @@ -516,7 +529,7 @@ # 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], label=label[i], centre=com[i], span=span[i], blade_length=5e-10, model_num=models[i], staggered=staggered[i]) + rotor(structure=structure, rotor_angle=rotor_angle[i], axis=dot(T, axis[i]), axis_pt=pivot[i], label=label[i], centre=com[i], span=span[i], blade_length=5e-10, model_num=models[i], staggered=staggered[i], half_rotor=half_rotor) def create_ave_pos(format='PDB', file=None, dir=None, compress_type=0, force=False): @@ -709,7 +722,7 @@ add_pivots(structure=structures[i], sims=sims[i]) # Add all rotor objects. - add_rotors(structure=structures[i], sims=sims[i]) + add_rotors(structure=structures[i], representation=representation[i], sims=sims[i]) # Add the axis systems. add_axes(structure=structures[i], representation=representation[i], size=size, sims=sims[i])