mailr7224 - in /1.3: generic_fns/structure/geometric.py specific_fns/n_state_model.py


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

Header


Content

Posted by edward on August 21, 2008 - 19:01:
Author: bugman
Date: Thu Aug 21 19:01:29 2008
New Revision: 7224

URL: http://svn.gna.org/viewcvs/relax?rev=7224&view=rev
Log:
Fixed the generation of the diffusion in a cone geometric object.


Modified:
    1.3/generic_fns/structure/geometric.py
    1.3/specific_fns/n_state_model.py

Modified: 1.3/generic_fns/structure/geometric.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/geometric.py?rev=7224&r1=7223&r2=7224&view=diff
==============================================================================
--- 1.3/generic_fns/structure/geometric.py (original)
+++ 1.3/generic_fns/structure/geometric.py Thu Aug 21 19:01:29 2008
@@ -471,25 +471,25 @@
     centred and at the head of the vector, a proton is placed.
 
 
-    @param structure:       The structural data object.
+    @keyword structure:     The structural data object.
     @type structure:        instance of class derived from Base_struct_API
-    @param res_name:        The residue name.
+    @keyword res_name:      The residue name.
     @type res_name:         str
-    @param res_num:         The residue number.
+    @keyword res_num:       The residue number.
     @type res_num:          int
-    @param chain_id:        The chain identifier.
+    @keyword chain_id:      The chain identifier.
     @type chain_id:         str
-    @param centre:          The centre of the distribution.
+    @keyword centre:        The centre of the distribution.
     @type centre:           numpy array, len 3
-    @param R:               The optional 3x3 rotation matrix.
+    @keyword R:             The optional 3x3 rotation matrix.
     @type R:                3x3 numpy array
-    @param warp:            The optional 3x3 warping matrix.
+    @keyword warp:          The optional 3x3 warping matrix.
     @type warp:             3x3 numpy array
-    @param max_angle:       The maximal polar angle, in rad, after which all 
vectors are skipped.
+    @keyword max_angle:     The maximal polar angle, in rad, after which all 
vectors are skipped.
     @type max_angle:        float
-    @param scale:           The scaling factor to stretch all rotated and 
warped vectors by.
+    @keyword scale:         The scaling factor to stretch all rotated and 
warped vectors by.
     @type scale:            float
-    @param inc:             The number of increments or number of vectors 
used to generate the outer
+    @keyword inc:           The number of increments or number of vectors 
used to generate the outer
                             edge of the cone.
     @type inc:              int
     """
@@ -549,11 +549,11 @@
 
             # Connect across the radial arrays (to generate the latitudinal 
lines).
             if i != 0:
-                structure.atom_connect(index1=atom_num-1, 
index2=atom_num-1-j_min)
+                structure.atom_connect(index1=atom_num-1, 
index2=atom_num-1-j_min-2)
 
             # Connect the last radial array to the first (to zip up the 
geometric object and close the latitudinal lines).
             if i == inc-1:
-                structure.atom_connect(index1=atom_num-1, 
index2=origin_num-1+j)
+                structure.atom_connect(index1=atom_num-1, 
index2=origin_num-1+j+2)
 
             # Increment the atom number.
             atom_num = atom_num + 1
@@ -659,48 +659,6 @@
     @type inc:              int
     """
 
-    # Loop over the radial array of vectors (change in longitude).
-    for i in range(inc):
-        # Connect the two atoms (to stitch up the 2 objects).
-        structure.atom_connect(index1=cone_start-1+i, index2=cap_start-1+i)
-
-
-def uniform_vect_dist_spherical_angles(inc=20):
-    """Uniform distribution of vectors on a sphere using uniform spherical 
angles.
-
-    This function returns an array of unit vectors uniformly distributed 
within 3D space.  To
-    create the distribution, uniform spherical angles are used.  The two 
spherical angles are
-    defined as
-
-        theta = 2.pi.u,
-        phi = cos^-1(2v - 1),
-
-    where
-
-        u in [0, 1),
-        v in [0, 1].
-
-    Because theta is defined between [0, pi] and phi is defined between [0, 
2pi], for a uniform
-    distribution u is only incremented half of 'inc'.  The unit vectors are 
generated using the
-    equation
-
-                   | cos(theta) * sin(phi) |
-        vector  =  | sin(theta) * sin(phi) |.
-                   |      cos(phi)         |
-
-    The vectors of this distribution generate both longitudinal and 
latitudinal lines.
-    """
-
-    # The inc argument must be an even number.
-    if inc%2:
-        raise RelaxError, "The increment value of " + `inc` + " must be an 
even number."
-
-    # Generate the increment values of u.
-    u = zeros(inc, float64)
-    val = 1.0 / float(inc)
-    for i in xrange(inc):
-        u[i] = float(i) * val
-
     # Generate the increment values of v.
     v = zeros(inc/2+2, float64)
     val = 1.0 / float(inc/2)
@@ -708,6 +666,72 @@
         v[i] = float(i-1) * val + val/2.0
     v[-1] = 1.0
 
+    # Generate the distribution of spherical angles phi.
+    phi = arccos(2.0 * v - 1.0)
+
+    # Loop over the angles and find the minimum latitudinal index.
+    for j_min in xrange(len(phi)):
+        if phi[j_min] < max_angle:
+            break
+
+    print "j_min " + `j_min`
+    # Loop over the radial array of vectors (change in longitude).
+    for i in range(inc):
+        # Cap atom.
+        cap_atom = cap_start + i
+
+        # Dome edge atom.
+        dome_edge = cone_start + i + i*(j_min+1)
+
+        print "dome edge: " + `dome_edge` + ", cap atom: " + `cap_atom`
+
+        # Connect the two atoms (to stitch up the 2 objects).
+        structure.atom_connect(index1=dome_edge-1, index2=cap_atom-1)
+
+
+def uniform_vect_dist_spherical_angles(inc=20):
+    """Uniform distribution of vectors on a sphere using uniform spherical 
angles.
+
+    This function returns an array of unit vectors uniformly distributed 
within 3D space.  To
+    create the distribution, uniform spherical angles are used.  The two 
spherical angles are
+    defined as
+
+        theta = 2.pi.u,
+        phi = cos^-1(2v - 1),
+
+    where
+
+        u in [0, 1),
+        v in [0, 1].
+
+    Because theta is defined between [0, pi] and phi is defined between [0, 
2pi], for a uniform
+    distribution u is only incremented half of 'inc'.  The unit vectors are 
generated using the
+    equation
+
+                   | cos(theta) * sin(phi) |
+        vector  =  | sin(theta) * sin(phi) |.
+                   |      cos(phi)         |
+
+    The vectors of this distribution generate both longitudinal and 
latitudinal lines.
+    """
+
+    # The inc argument must be an even number.
+    if inc%2:
+        raise RelaxError, "The increment value of " + `inc` + " must be an 
even number."
+
+    # Generate the increment values of u.
+    u = zeros(inc, float64)
+    val = 1.0 / float(inc)
+    for i in xrange(inc):
+        u[i] = float(i) * val
+
+    # Generate the increment values of v.
+    v = zeros(inc/2+2, float64)
+    val = 1.0 / float(inc/2)
+    for i in xrange(1, inc/2+1):
+        v[i] = float(i-1) * val + val/2.0
+    v[-1] = 1.0
+
     # Generate the distribution of spherical angles theta.
     theta = 2.0 * pi * u
 

Modified: 1.3/specific_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/n_state_model.py?rev=7224&r1=7223&r2=7224&view=diff
==============================================================================
--- 1.3/specific_fns/n_state_model.py (original)
+++ 1.3/specific_fns/n_state_model.py Thu Aug 21 19:01:29 2008
@@ -249,7 +249,7 @@
             print "\nGenerating the cone cap."
             cone_start_atom = structure.structural_data[0].atom_num[-1]+1
             
generic_fns.structure.geometric.generate_vector_dist(structure=structure, 
res_name='CON', res_num=3, centre=cdp.pivot_point, R=R, max_angle=angle, 
scale=norm(cdp.pivot_CoM), inc=inc)
-            
generic_fns.structure.geometric.stitch_cap_to_cone(structure=structure, 
cone_start=cone_start_atom, cap_start=cap_start_atom, max_angle=angle, 
inc=inc)
+            
generic_fns.structure.geometric.stitch_cap_to_cone(structure=structure, 
cone_start=cone_start_atom, cap_start=cap_start_atom+1, max_angle=angle, 
inc=inc)
 
         # Create the PDB file.
         print "\nGenerating the PDB file."




Related Messages


Powered by MHonArc, Updated Thu Aug 21 22:20:17 2008