Author: bugman
Date: Thu Dec 18 09:11:29 2014
New Revision: 27119

URL: http://svn.gna.org/viewcvs/relax?rev=27119&view=rev
Log:
Created the Structure.test_atomic_fluctuations system test.

This will be used to implement the idea of the structure.atomic_fluctuations 
user function.


Modified:
    trunk/test_suite/system_tests/structure.py

Modified: trunk/test_suite/system_tests/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=27119&r1=27118&r2=27119&view=diff
==============================================================================
--- trunk/test_suite/system_tests/structure.py  (original)
+++ trunk/test_suite/system_tests/structure.py  Thu Dec 18 09:11:29 2014
@@ -21,7 +21,8 @@
 
 # Python module imports.
 from math import sqrt
-from numpy import array, float64, zeros
+from numpy import array, float64, std, zeros
+from numpy.linalg import norm
 from os import sep
 from re import search
 import sys
@@ -307,6 +308,33 @@
 
         # Load the file, load the spins, and attach the protons.
         self.assertRaises(RelaxError, self.interpreter.structure.read_pdb, 
'1OGT_trunc.pdb', dir=path)
+
+
+    def test_atomic_fluctuations(self):
+        """Check the operation of the U{structure.rmsd user 
function<http://www.nmr-relax.com/manual/structure_rmsd.html>}."""
+
+        # Load the file.
+        path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'structures'
+        self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path)
+
+        # Run the structure.atomic_fluctuations user function and collect the 
results in a dummy file object.
+        file = DummyFileObject()
+        self.interpreter.structure.atomic_fluctuations(atom_id='@N,CA', 
file=file, format='text')
+
+        # The fluctuations.
+        n =  array([[ 9.464,  -9.232,  27.573], [ 9.211,  -9.425,  26.970], [ 
7.761,  -6.392,  27.161]], float64)
+        ca = array([[10.302,  -8.195,  26.930], [10.077,  -8.221,  26.720], [ 
9.256,  -6.332,  27.183]], float64)
+        sd = std(array([norm(n[0] - ca[0]), norm(n[1] - ca[1]), norm(n[2] - 
ca[2])], float64), ddof=1)
+        expected = []
+        expected.append("# %18s %20s\n" % (":4@N", ":4@CA"))
+        expected.append("%20.15f %20.15f\n" % (sd, 0.0))
+        expected.append("%20.15f %20.15f\n" % (0.0, sd))
+
+        # Check the file.
+        lines = file.readlines()
+        self.assertEqual(len(expected), len(lines))
+        for i in range(len(lines)):
+            self.assertEqual(expected[i]+'\n', lines[i])
 
 
     def test_bug_sr_2998_broken_conect_records(self):


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

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

Reply via email to