Author: bugman Date: Sat Mar 23 10:38:28 2013 New Revision: 19059 URL: http://svn.gna.org/viewcvs/relax?rev=19059&view=rev Log: Shifted the target_functions.paramag_centre module to lib.alignment.paramag_centre. Added: trunk/lib/alignment/paramag_centre.py - copied unchanged from r19029, trunk/target_functions/paramag_centre.py Removed: trunk/target_functions/paramag_centre.py Modified: trunk/lib/alignment/__init__.py trunk/target_functions/__init__.py trunk/target_functions/n_state_model.py Modified: trunk/lib/alignment/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/alignment/__init__.py?rev=19059&r1=19058&r2=19059&view=diff ============================================================================== --- trunk/lib/alignment/__init__.py (original) +++ trunk/lib/alignment/__init__.py Sat Mar 23 10:38:28 2013 @@ -24,6 +24,7 @@ __all__ = [ 'alignment_tensor', + 'paramag_centre', 'pcs', 'rdc' ] Modified: trunk/target_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/__init__.py?rev=19059&r1=19058&r2=19059&view=diff ============================================================================== --- trunk/target_functions/__init__.py (original) +++ trunk/target_functions/__init__.py Sat Mar 23 10:38:28 2013 @@ -31,6 +31,5 @@ 'jw_mapping', 'mf', 'n_state_model', - 'paramag_centre', 'potential' ] Modified: trunk/target_functions/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/n_state_model.py?rev=19059&r1=19058&r2=19059&view=diff ============================================================================== --- trunk/target_functions/n_state_model.py (original) +++ trunk/target_functions/n_state_model.py Sat Mar 23 10:38:28 2013 @@ -24,15 +24,15 @@ from numpy import array, dot, eye, float64, ones, rank, transpose, zeros # relax module imports. +from target_functions.chi2 import chi2, dchi2_element, d2chi2_element +from lib.alignment.alignment_tensor import dAi_dAxx, dAi_dAyy, dAi_dAxy, dAi_dAxz, dAi_dAyz, to_tensor +from lib.alignment.paramag_centre import vectors_single_centre, vectors_centre_per_state +from lib.alignment.pcs import ave_pcs_tensor, ave_pcs_tensor_ddeltaij_dAmn, ave_pcs_tensor_ddeltaij_dc, pcs_constant_grad, pcs_tensor +from lib.alignment.rdc import ave_rdc_tensor, ave_rdc_tensor_dDij_dAmn, rdc_tensor +from lib.errors import RelaxError, RelaxImplementError from lib.float import isNaN -from lib.alignment.alignment_tensor import dAi_dAxx, dAi_dAyy, dAi_dAxy, dAi_dAxz, dAi_dAyz, to_tensor -from target_functions.chi2 import chi2, dchi2_element, d2chi2_element -from target_functions.paramag_centre import vectors_single_centre, vectors_centre_per_state -from lib.alignment.pcs import ave_pcs_tensor, ave_pcs_tensor_ddeltaij_dAmn, ave_pcs_tensor_ddeltaij_dc, pcs_constant_grad, pcs_tensor from lib.geometry.rotations import euler_to_R_zyz -from lib.alignment.rdc import ave_rdc_tensor, ave_rdc_tensor_dDij_dAmn, rdc_tensor from lib.physical_constants import pcs_constant -from lib.errors import RelaxError, RelaxImplementError class N_state_opt: Removed: trunk/target_functions/paramag_centre.py URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/paramag_centre.py?rev=19058&view=auto ============================================================================== --- trunk/target_functions/paramag_centre.py (original) +++ trunk/target_functions/paramag_centre.py (removed) @@ -1,92 +1,0 @@ -############################################################################### -# # -# Copyright (C) 2010-2011 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. -"""Module for functions relating to the paramagnetic centre.""" - -# Python imports. -from numpy.linalg import norm - - -def vectors_centre_per_state(atomic_pos, paramag_centre, unit_vector, r): - """Calculate the electron spin to nuclear spin unit vectors and distances. - - This assumes that there is one paramagnetic centre per state of the system. - - - @param atomic_pos: The atomic positions in Angstrom. The first index is the spins, the second is the structures, and the third is the atomic coordinates. - @type atomic_pos: numpy rank-3 array - @param paramag_centre: The paramagnetic centre position in Angstrom. - @type paramag_centre: numpy rank-2, Nx3 array - @param unit_vector: The structure to fill with the electron spin to nuclear spin unit vectors. - @type unit_vector: numpy rank-3 array - @param r: The structure to fill with the electron spin to nuclear spin distances. - @type r: numpy rank-2 array - """ - - # Loop over the spins. - for i in range(len(atomic_pos)): - # Loop over the states. - for c in range(len(atomic_pos[i])): - # The vector. - vect = atomic_pos[i, c] - paramag_centre[c] - - # The length. - r[i, c] = norm(vect) - - # The unit vector. - unit_vector[i, c] = vect / r[i, c] - - # Convert the distances from Angstrom to meters. - r[i, c] = r[i, c] * 1e-10 - - -def vectors_single_centre(atomic_pos, paramag_centre, unit_vector, r): - """Calculate the electron spin to nuclear spin unit vectors and distances. - - This assumes that there is only one paramagnetic centre for all states of the system. - - - @param atomic_pos: The atomic positions in Angstrom. The first index is the spins, the second is the structures, and the third is the atomic coordinates. - @type atomic_pos: numpy rank-3 array - @param paramag_centre: The paramagnetic centre position in Angstrom. - @type paramag_centre: numpy rank-1, 3D array - @param unit_vector: The structure to fill with the electron spin to nuclear spin unit vectors. - @type unit_vector: numpy rank-3 array - @param r: The structure to fill with the electron spin to nuclear spin distances. - @type r: numpy rank-2 array - """ - - # Loop over the spins. - for i in range(len(atomic_pos)): - # Loop over the states. - for c in range(len(atomic_pos[i])): - # The vector. - vect = atomic_pos[i, c] - paramag_centre - - # The length. - r[i, c] = norm(vect) - - # The unit vector. - unit_vector[i, c] = vect / r[i, c] - - # Convert the distances from Angstrom to meters. - r[i, c] = r[i, c] * 1e-10