Author: bugman Date: Sat Mar 23 08:59:15 2013 New Revision: 19032 URL: http://svn.gna.org/viewcvs/relax?rev=19032&view=rev Log: Shifted the target_functions.vectors module to lib.geometry.vectors. This is part of the relax library redesign. Added: trunk/lib/geometry/vectors.py - copied unchanged from r19029, trunk/target_functions/vectors.py Removed: trunk/target_functions/vectors.py Modified: trunk/generic_fns/pcs.py trunk/lib/geometry/rotations.py trunk/target_functions/__init__.py Modified: trunk/generic_fns/pcs.py URL: http://svn.gna.org/viewcvs/relax/trunk/generic_fns/pcs.py?rev=19032&r1=19031&r2=19032&view=diff ============================================================================== --- trunk/generic_fns/pcs.py (original) +++ trunk/generic_fns/pcs.py Sat Mar 23 08:59:15 2013 @@ -36,7 +36,7 @@ from generic_fns.align_tensor import get_tensor_index from generic_fns.mol_res_spin import exists_mol_res_spin_data, generate_spin_id_unique, return_spin, spin_index_loop, spin_loop from lib.nmr.pcs import ave_pcs_tensor, pcs_tensor -from target_functions.vectors import random_unit_vector +from lib.geometry.vectors import random_unit_vector from lib.physical_constants import g1H, pcs_constant from lib.errors import RelaxError, RelaxAlignError, RelaxNoAlignError, RelaxNoPdbError, RelaxNoPCSError, RelaxNoSequenceError, RelaxPCSError from lib.io import open_write_file, read_spin_data, write_spin_data Modified: trunk/lib/geometry/rotations.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/geometry/rotations.py?rev=19032&r1=19031&r2=19032&view=diff ============================================================================== --- trunk/lib/geometry/rotations.py (original) +++ trunk/lib/geometry/rotations.py Sat Mar 23 08:59:15 2013 @@ -28,7 +28,7 @@ # relax module imports. import generic_fns -from target_functions.vectors import random_unit_vector +from lib.geometry.vectors import random_unit_vector # Global variables. Modified: trunk/target_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/__init__.py?rev=19032&r1=19031&r2=19032&view=diff ============================================================================== --- trunk/target_functions/__init__.py (original) +++ trunk/target_functions/__init__.py Sat Mar 23 08:59:15 2013 @@ -43,5 +43,5 @@ 'ri_comps', 'ri_prime', 'ri', - 'weights', - 'vectors' ] + 'weights' +] Removed: trunk/target_functions/vectors.py URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/vectors.py?rev=19031&view=auto ============================================================================== --- trunk/target_functions/vectors.py (original) +++ trunk/target_functions/vectors.py (removed) @@ -1,50 +1,0 @@ -############################################################################### -# # -# Copyright (C) 2004-2013 Edward d'Auvergne # -# # -# This file is part of the program relax (http://www.nmr-relax.com). # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -# # -############################################################################### - -# Module docstring. -"""Collection of functions for vector operations.""" - -# Python module imports. -from math import acos, cos, pi, sin -from random import uniform - - -def random_unit_vector(vector): - """Generate a random rotation axis. - - Uniform point sampling on a unit sphere is used to generate a random axis orientation. - - @param vector: The 3D rotation axis. - @type vector: numpy 3D, rank-1 array - """ - - # Random azimuthal angle. - u = uniform(0, 1) - theta = 2*pi*u - - # Random polar angle. - v = uniform(0, 1) - phi = acos(2.0*v - 1) - - # Random unit vector. - vector[0] = cos(theta) * sin(phi) - vector[1] = sin(theta) * sin(phi) - vector[2] = cos(phi)