mailr27147 - in /trunk: pipe_control/structure/main.py user_functions/structure.py


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

Header


Content

Posted by edward on December 19, 2014 - 16:42:
Author: bugman
Date: Fri Dec 19 16:42:53 2014
New Revision: 27147

URL: http://svn.gna.org/viewcvs/relax?rev=27147&view=rev
Log:
Added the 'parallax shift' measure to the structure.atomic_fluctuations user 
function.

The parallax shift is defined as the length of the average vector minus the 
interatomic vector.  It
is similar to the angle measure however, importantly, it is independent of 
the distance between the
two atoms.


Modified:
    trunk/pipe_control/structure/main.py
    trunk/user_functions/structure.py

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=27147&r1=27146&r2=27147&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py        (original)
+++ trunk/pipe_control/structure/main.py        Fri Dec 19 16:42:53 2014
@@ -254,7 +254,7 @@
     # Checks.
     check_pipe()
     check_structure()
-    allowed_measures = ['distance', 'angle']
+    allowed_measures = ['distance', 'angle', 'parallax shift']
     if measure not in allowed_measures:
         raise RelaxError("The measure '%s' must be one of %s." % (measure, 
allowed_measures))
 
@@ -278,6 +278,7 @@
     matrix = zeros((n, n), float64)
     dist = zeros(m, float64)
     vectors = zeros((m, 3), float64)
+    parallax_vectors = zeros((m, 3), float64)
     angles = zeros(m, float64)
 
     # Generate the pairwise distance SD matrix.
@@ -317,6 +318,29 @@
 
                 # Calculate and store the corrected sample standard 
deviation.
                 matrix[i, j] = matrix[j, i] = std(angles, ddof=1)
+
+    # Generate the pairwise parallax shift SD matrix.
+    elif measure == 'parallax shift':
+        # Loop over the atom pairs.
+        for i in range(n):
+            for j in range(n):
+                # Only calculate the upper triangle to avoid duplicate 
calculations.
+                if j > i:
+                    continue
+
+                # The interatomic vectors between each structure.
+                for k in range(m):
+                    vectors[k] = coord[k, i] - coord[k, j]
+
+                # The average vector.
+                ave_vect = average(vectors, axis=0)
+
+                # The parallax shift.
+                for k in range(m):
+                    dist[k] = norm(vectors[k] - ave_vect)
+
+                # Calculate and store the corrected sample standard 
deviation.
+                matrix[i, j] = matrix[j, i] = std(dist, ddof=1)
 
     # Call the plotting API.
     correlation_matrix(format=format, matrix=matrix, labels=labels, 
file=file, dir=dir, force=force)

Modified: trunk/user_functions/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/user_functions/structure.py?rev=27147&r1=27146&r2=27147&view=diff
==============================================================================
--- trunk/user_functions/structure.py   (original)
+++ trunk/user_functions/structure.py   Fri Dec 19 16:42:53 2014
@@ -341,6 +341,7 @@
 uf.desc[-1].add_paragraph("This is used to visualise the interatomic 
fluctuations between different structures.  By setting the measure argument, 
this can be set to either the fluctuations of the interatomic distances or 
the fluctuations of the interatomic vector angles:")
 uf.desc[-1].add_item_list_element("'distance'", "This is the default.  The 
corrected sample standard deviation (SD) is calculated for the distances 
between all atom pairs, resulting in a pairwise matrix of SD values.")
 uf.desc[-1].add_item_list_element("'angle'", "The corrected sample standard 
deviation (SD) is calculated for the angles between the inter atom vectors 
all atom pairs to an average vector.  This also produces a pairwise matrix of 
SD values.")
+uf.desc[-1].add_item_list_element("'parallax shift'", "The corrected sample 
standard deviation (SD) is calculated for the parallax shift between the 
inter atom vectors all atom pairs to an average vector.  This also produces a 
pairwise matrix of SD values.  The parallax shift is the length of the 
average vector minus the interatomic vector.  It is similar to the angle 
measure however, importantly, it is independent of the distance between the 
two atoms.")
 uf.desc[-1].add_paragraph("For the output file, the currently supported 
formats are:")
 uf.desc[-1].add_item_list_element("'text'", "This is the default value and 
will result in a single text file being created.")
 uf.desc[-1].add_item_list_element("'gnuplot'", "This will create a both a 
text file with the data and a script for visualising the correlation matrix 
using gnuplot.  The script will have the same name as the text file, however 
the file extension will be changed to *.gnu.")




Related Messages


Powered by MHonArc, Updated Fri Dec 19 19:40:02 2014