Author: bugman
Date: Mon Dec 22 09:19:50 2014
New Revision: 27151
URL: http://svn.gna.org/viewcvs/relax?rev=27151&view=rev
Log:
Proper implementation of the 'parallax shift' for the
structure.atomic_fluctuations user function.
Modified:
trunk/pipe_control/structure/main.py
Modified: trunk/pipe_control/structure/main.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=27151&r1=27150&r2=27151&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py (original)
+++ trunk/pipe_control/structure/main.py Mon Dec 22 09:19:50 2014
@@ -21,7 +21,7 @@
# Python module imports.
from minfx.generic import generic_minimise
-from numpy import array, average, float64, std, zeros
+from numpy import array, average, dot, float64, std, zeros
from numpy.linalg import norm
from os import F_OK, access, getcwd
from re import search
@@ -335,9 +335,22 @@
# The average vector.
ave_vect = average(vectors, axis=0)
+ # Catch the zero vector.
+ length = norm(ave_vect)
+ if length == 0.0:
+ matrix[i, j] = matrix[j, i] = 0.0
+ continue
+
+ # The unit average vector.
+ unit = ave_vect / length
+
# The parallax shift.
for k in range(m):
- dist[k] = norm(vectors[k] - ave_vect)
+ # The projection onto the average vector.
+ proj = dot(vectors[k], unit) * unit
+
+ # The distance shift.
+ dist[k] = norm(vectors[k] - proj)
# Calculate and store the corrected sample standard deviation.
matrix[i, j] = matrix[j, i] = std(dist, ddof=1)
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits