mailr18926 - in /branches/frame_order_testing: ./ generic_fns/structure/geometric.py lib/structure/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 20, 2013 - 17:25:
Author: bugman
Date: Wed Mar 20 17:25:24 2013
New Revision: 18926

URL: http://svn.gna.org/viewcvs/relax?rev=18926&view=rev
Log:
Merged revisions 18923-18925 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r18923 | bugman | 2013-03-20 17:06:40 +0100 (Wed, 20 Mar 2013) | 5 lines
  
  Split the generic_fns.structure.geometric.create_rotor_pdb() function.
  
  The non-relax specific code has been shifted into the rotor_pdb() function.
........
  r18924 | bugman | 2013-03-20 17:09:55 +0100 (Wed, 20 Mar 2013) | 3 lines
  
  Initialised the lib.structure package - this is currently empty.
........
  r18925 | bugman | 2013-03-20 17:24:22 +0100 (Wed, 20 Mar 2013) | 8 lines
  
  Shifted the rotor creation components from generic_fns.structure.geometric 
to lib.structure.rotor.
  
  The create_rotor_pdb() function remains in place as this is the user 
function backend which checks
  for data pipes and updates the status object, but the rotor_pdb() and 
create_rotor_propellers()
  functions have been moved into the relax library.  The 
create_rotor_propellers() function has been
  renamed to lib.structure.rotor.rotor_propellers().
........

Added:
    branches/frame_order_testing/lib/structure/
      - copied from r18925, trunk/lib/structure/
Modified:
    branches/frame_order_testing/   (props changed)
    branches/frame_order_testing/generic_fns/structure/geometric.py

Propchange: branches/frame_order_testing/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Mar 20 17:25:24 2013
@@ -1,1 +1,1 @@
-/trunk:1-18919
+/trunk:1-18925

Modified: branches/frame_order_testing/generic_fns/structure/geometric.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/structure/geometric.py?rev=18926&r1=18925&r2=18926&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/structure/geometric.py (original)
+++ branches/frame_order_testing/generic_fns/structure/geometric.py Wed Mar 
20 17:25:24 2013
@@ -21,21 +21,20 @@
 
 # Python module imports.
 from math import cos, pi, sin
-from numpy import arccos, array, cross, dot, eye, float64, transpose, zeros
-from numpy.linalg import norm
+from numpy import arccos, array, dot, eye, float64, transpose, zeros
 from os import getcwd
 from string import ascii_uppercase
 from warnings import warn
 
 # relax module imports.
 from generic_fns.interatomic import interatomic_loop
-from generic_fns.mol_res_spin import exists_mol_res_spin_data, return_spin, 
spin_loop
+from generic_fns.mol_res_spin import exists_mol_res_spin_data, return_spin
 from generic_fns import pipes
 from generic_fns.structure.internal import Internal
 from generic_fns.structure.mass import centre_of_mass
-from lib.geometry.lines import closest_point_ax
-from maths_fns.rotation_matrix import axis_angle_to_R, two_vect_to_R
-from relax_errors import RelaxError, RelaxNoPdbError, RelaxNoSequenceError, 
RelaxNoTensorError, RelaxNoVectorsError
+from lib.structure.rotor import rotor_pdb
+from maths_fns.rotation_matrix import two_vect_to_R
+from relax_errors import RelaxNoPdbError, RelaxNoSequenceError, 
RelaxNoTensorError, RelaxNoVectorsError
 from relax_io import get_file_path, open_write_file
 from relax_warnings import RelaxWarning
 from status import Status; status = Status()
@@ -610,48 +609,14 @@
     @type staggered:        bool
     """
 
-    # Convert the arguments to numpy arrays, radians and Angstrom.
-    axis = array(axis, float64)
-    axis_pt = array(axis_pt, float64)
-    centre = array(centre, float64)
-    rotor_angle = rotor_angle / 360.0 * 2.0 * pi
-    span = span * 1e10
-    blade_length = blade_length * 1e10
-
-    # Normalise.
-    axis_norm = axis / norm(axis)
-
     # Test if the current pipe exists.
     pipes.test()
 
     # Create the structural object.
     structure = Internal()
 
-    # Add a structure.
-    structure.add_molecule(name='rotor')
-
-    # Alias the single molecule from the single model.
-    mol = structure.get_molecule('rotor')
-
-    # The central point.
-    mid_point = closest_point_ax(line_pt=axis_pt, axis=axis, point=centre)
-    mol.atom_add(pdb_record='HETATM', atom_num=1, atom_name='CTR', 
res_name='AX', res_num=1, pos=mid_point, element='PT')
-
-    # Centre of the propellers.
-    prop1 = mid_point + axis_norm * span
-    prop1_index = 1
-    mol.atom_add(pdb_record='HETATM', atom_num=2, atom_name='PRP', 
res_name='PRC', res_num=2, pos=prop1, element='O')
-    mol.atom_connect(index1=0, index2=prop1_index)
-
-    # Centre of the propellers.
-    prop2 = mid_point - axis_norm * span
-    prop2_index = 2
-    mol.atom_add(pdb_record='HETATM', atom_num=3, atom_name='PRP', 
res_name='PRC', res_num=3, pos=prop2, element='O')
-    mol.atom_connect(index1=0, index2=prop2_index)
-
-    # Create the rotor propellers.
-    create_rotor_propellers(mol=mol, rotor_angle=rotor_angle, centre=prop1, 
axis=axis, blade_length=blade_length, staggered=staggered)
-    create_rotor_propellers(mol=mol, rotor_angle=rotor_angle, centre=prop2, 
axis=-axis, blade_length=blade_length, staggered=staggered)
+    # Generate the rotor object.
+    rotor_pdb(structure=structure, rotor_angle=rotor_angle, axis=axis, 
axis_pt=axis_pt, centre=centre, span=span, blade_length=blade_length, 
staggered=staggered)
 
     # Print out.
     print("\nGenerating the PDB file.")
@@ -672,98 +637,6 @@
         dir = getcwd()
     cdp.result_files.append(['diff_tensor_pdb', 'Diffusion tensor PDB', 
get_file_path(file, dir)])
     status.observers.result_file.notify()
-
-
-def create_rotor_propellers(mol=None, rotor_angle=None, centre=None, 
axis=None, blade_length=5.0, staggered=False):
-    """Create a PDB representation of a rotor motional model.
-
-    @keyword mol:           The internal structural object molecule 
container to add the atoms to.
-    @type mol:              MolContainer instance
-    @keyword rotor_angle:   The angle of the rotor motion in radians.
-    @type rotor_angle:      float
-    @keyword centre:        The central point of the propeller.
-    @type centre:           numpy rank-1, 3D array
-    @keyword axis:          The vector defining the rotor axis.
-    @type axis:             numpy rank-1, 3D array
-    @keyword blade_length:  The length of the representative rotor blades in 
Angstrom.
-    @type blade_length:     float
-    @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
-    """
-
-    # Init.
-    step_angle = 2.0 / 360.0 * 2.0 * pi
-    R = zeros((3, 3), float64)
-    res_num = mol.last_residue() + 1
-
-    # Blade vectors.
-    blades = zeros((4, 3), float64)
-    if abs(dot(axis, array([0, 0, 1], float64))) == 1.0:    # Avoid failures 
in artificial situations.
-        blades[0] = cross(axis, array([1, 0, 0], float64))
-    else:
-        blades[0] = cross(axis, array([0, 0, 1], float64))
-    blades[0] = blades[0] / norm(blades[0])
-    blades[1] = cross(axis, blades[0])
-    blades[1] = blades[1] / norm(blades[1])
-    blades[2] = -blades[0]
-    blades[3] = -blades[1]
-
-    # Create the 4 blades.
-    for i in range(len(blades)):
-        # Staggering.
-        if staggered and i % 2:
-            blade_origin = centre - axis * 2
-
-        # Non-staggered.
-        else:
-            blade_origin = centre
-
-        # Add an atom for the blage origin.
-        blade_origin_index = mol.atom_add(pdb_record='HETATM', 
atom_name='BLO', res_name='PRB', res_num=res_num, pos=blade_origin, 
element='O')
-
-        # The centre edge point of the blade.
-        mid_point = blade_origin + blades[i] * blade_length
-        mid_pt_index = mol.atom_add(pdb_record='HETATM', atom_name='BLD', 
res_name='PRB', res_num=res_num, pos=mid_point, element='N')
-        mol.atom_connect(index1=mid_pt_index, index2=blade_origin_index)
-
-        # Build the blade.
-        angle = 0.0
-        pos_last_index = mid_pt_index
-        neg_last_index = mid_pt_index
-        while True:
-            # Increase the angle.
-            angle += step_angle
-
-            # The edge rotation.
-            if angle > rotor_angle:
-                axis_angle_to_R(axis, rotor_angle, R)
-
-            # The normal rotation matrix.
-            else:
-                axis_angle_to_R(axis, angle, R)
-
-            # The positive edge.
-            pos_point = dot(R, mid_point - blade_origin) + blade_origin
-            pos_index = mol.atom_add(pdb_record='HETATM', atom_name='BLD', 
res_name='PRB', res_num=res_num, pos=pos_point, element='N')
-            mol.atom_connect(index1=pos_index, index2=pos_last_index)
-            mol.atom_connect(index1=pos_index, index2=blade_origin_index)
-
-            # The negative edge.
-            neg_point = dot(transpose(R), mid_point - blade_origin) + 
blade_origin
-            neg_index = mol.atom_add(pdb_record='HETATM', atom_name='BLD', 
res_name='PRB', res_num=res_num, pos=neg_point, element='N')
-            mol.atom_connect(index1=neg_index, index2=neg_last_index)
-            mol.atom_connect(index1=neg_index, index2=blade_origin_index)
-
-            # Update the indices.
-            pos_last_index = pos_index
-            neg_last_index = neg_index
-
-            # Finish.
-            if angle > rotor_angle:
-                break
-
-        # Increment the residue number.
-        res_num += 1
 
 
 def create_vector_dist(length=None, symmetry=True, file=None, dir=None, 
force=False):




Related Messages


Powered by MHonArc, Updated Wed Mar 20 22:40:02 2013