mailr23472 - in /branches/disp_speed: ./ lib/geometry/ lib/structure/ lib/structure/represent/


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

Header


Content

Posted by tlinnet on May 27, 2014 - 17:04:
Author: tlinnet
Date: Tue May 27 17:04:26 2014
New Revision: 23472

URL: http://svn.gna.org/viewcvs/relax?rev=23472&view=rev
Log:
Merged revisions 23468,23470 via svnmerge from 
svn+ssh://tlinnet@xxxxxxxxxxx/svn/relax/trunk

........
  r23468 | bugman | 2014-05-27 15:51:08 +0200 (Tue, 27 May 2014) | 6 lines
  
  Shifted some functions from lib.structure.geometric into their own modules.
  
  The angles_regular() and angles_uniform() functions are now in the 
lib.structure.angles module, and
  the get_proton_names in lib.structure.conversion.
........
  r23470 | bugman | 2014-05-27 16:30:56 +0200 (Tue, 27 May 2014) | 6 lines
  
  Fix for the lib.geometry.lines.closest_point_ax() function for when the two 
points are the same.
  
  If the point on the line and point in the 3D space are the same, then this 
function used to return
  an array of NaN values.  This situation is now caught and the point in the 
3D space is returned.
........

Added:
    branches/disp_speed/lib/structure/angles.py
      - copied unchanged from r23470, trunk/lib/structure/angles.py
    branches/disp_speed/lib/structure/conversion.py
      - copied unchanged from r23470, trunk/lib/structure/conversion.py
Modified:
    branches/disp_speed/   (props changed)
    branches/disp_speed/lib/geometry/lines.py
    branches/disp_speed/lib/structure/__init__.py
    branches/disp_speed/lib/structure/geometric.py
    branches/disp_speed/lib/structure/represent/cone.py

Propchange: branches/disp_speed/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May 27 17:04:26 2014
@@ -1 +1 @@
-/trunk:1-23463
+/trunk:1-23471

Modified: branches/disp_speed/lib/geometry/lines.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/geometry/lines.py?rev=23472&r1=23471&r2=23472&view=diff
==============================================================================
--- branches/disp_speed/lib/geometry/lines.py   (original)
+++ branches/disp_speed/lib/geometry/lines.py   Tue May 27 17:04:26 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2013 Edward d'Auvergne                                       
 #
+# Copyright (C) 2013-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -66,6 +66,10 @@
     @rtype:             numpy rank-1 array
     """
 
+    # Check if the two points are the same, returning the point to avoid 
NaNs.
+    if norm(line_pt - point) < 1e-6:
+        return point
+
     # The hypotenuse.
     hypo = point - line_pt
     hypo_len = norm(hypo)

Modified: branches/disp_speed/lib/structure/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/structure/__init__.py?rev=23472&r1=23471&r2=23472&view=diff
==============================================================================
--- branches/disp_speed/lib/structure/__init__.py       (original)
+++ branches/disp_speed/lib/structure/__init__.py       Tue May 27 17:04:26 
2014
@@ -23,7 +23,9 @@
 """The relax-lib structure package - a library of functions handling 
structural information."""
 
 __all__ = [
+    'angles',
     'cones',
+    'conversion',
     'geometric',
     'mass',
     'pdb_read',

Modified: branches/disp_speed/lib/structure/geometric.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/structure/geometric.py?rev=23472&r1=23471&r2=23472&view=diff
==============================================================================
--- branches/disp_speed/lib/structure/geometric.py      (original)
+++ branches/disp_speed/lib/structure/geometric.py      Tue May 27 17:04:26 
2014
@@ -23,70 +23,9 @@
 from math import cos, pi, sin
 from numpy import arccos, array, dot, eye, float64, zeros
 
-
-def angles_regular(inc=None):
-    """Determine the spherical angles for a regular sphere point 
distribution.
-
-    @keyword inc:   The number of increments in the distribution.
-    @type inc:      int
-    @return:        The phi angle array and the theta angle array.
-    @rtype:         array of float, array of float
-    """
-
-    # Generate the increment values of u.
-    u = zeros(inc, float64)
-    val = 1.0 / float(inc)
-    for i in range(inc):
-        u[i] = float(i) * val
-
-    # Generate the increment values of v.
-    v = zeros(inc/2+1, float64)
-    val = 1.0 / float(inc/2)
-    for i in range(int(inc/2+1)):
-        v[i] = float(i) * val
-
-    # Generate the distribution of spherical angles theta.
-    theta = 2.0 * pi * u
-
-    # Generate the distribution of spherical angles phi (from bottom to top).
-    phi = zeros(len(v), float64)
-    for i in range(len(v)):
-        phi[len(v)-1-i] = pi * v[i]
-
-    # Return the angle arrays.
-    return phi, theta
-
-
-def angles_uniform(inc=None):
-    """Determine the spherical angles for a uniform sphere point 
distribution.
-
-    @keyword inc:   The number of increments in the distribution.
-    @type inc:      int
-    @return:        The phi angle array and the theta angle array.
-    @rtype:         array of float, array of float
-    """
-
-    # Generate the increment values of u.
-    u = zeros(inc, float64)
-    val = 1.0 / float(inc)
-    for i in range(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 range(1, int(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
-
-    # Generate the distribution of spherical angles phi.
-    phi = arccos(2.0 * v - 1.0)
-
-    # Return the angle arrays.
-    return phi, theta
+# relax module imports.
+from lib.structure.angles import angles_regular, angles_uniform
+from lib.structure.conversion import get_proton_name
 
 
 def generate_vector_dist(mol=None, res_name=None, res_num=None, chain_id='', 
centre=zeros(3, float64), R=eye(3), warp=eye(3), limit_check=None, scale=1.0, 
inc=20, distribution='uniform', debug=False):
@@ -307,26 +246,6 @@
     return res_num
 
 
-def get_proton_name(atom_num):
-    """Return a valid PDB atom name of <4 characters.
-
-    @param atom_num:    The number of the atom.
-    @type atom_num:     int
-    @return:            The atom name to use in the PDB.
-    @rtype:             str
-    """
-
-    # Init the proton first letters and the atom number folding limits.
-    names = ['H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q']
-    lims = [0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]
-
-    # Loop over the proton names.
-    for i in range(len(names)):
-        # In the bounds.
-        if atom_num >= lims[i] and atom_num < lims[i+1]:
-            return names[i] + repr(atom_num - lims[i])
-
-
 def vect_dist_spherical_angles(inc=20, distribution='uniform'):
     """Create a distribution of vectors on a sphere using a distribution of 
spherical angles.
 

Modified: branches/disp_speed/lib/structure/represent/cone.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/structure/represent/cone.py?rev=23472&r1=23471&r2=23472&view=diff
==============================================================================
--- branches/disp_speed/lib/structure/represent/cone.py (original)
+++ branches/disp_speed/lib/structure/represent/cone.py Tue May 27 17:04:26 
2014
@@ -25,7 +25,8 @@
 
 # relax module imports.
 from lib.geometry.rotations import two_vect_to_R
-from lib.structure.geometric import angles_uniform, get_proton_name
+from lib.structure.angles import angles_regular, angles_uniform
+from lib.structure.conversion import get_proton_name
 
 
 def cone_edge(mol=None, cone=None, res_name='CON', res_num=None, 
chain_id='', apex=None, axis=None, R=None, scale=None, inc=None, 
distribution='uniform', debug=False):




Related Messages


Powered by MHonArc, Updated Tue May 27 17:20:03 2014