Пример #1
0
 def test_gyration_tensor_no_coords(self):
     a = np.array([])
     g_tensor = ftmd.gyration_tensor(a, diagonalize=True)
     self.assertTrue(
         all(
             math.isnan(g_tensor[i, j])
             for i, j in it.product(range(3), repeat=2)))
Пример #2
0
 def test_gyration_tensor_vs_rog(self):
     a1 = np.array([[1., 1., 1.], [0., 0., 0.], [-1., -1., -1.],
                    [-2, -2, -2]])
     rog = ftmd.radius_of_gyration(a1)
     g_tensor = ftmd.gyration_tensor(a1, diagonalize=True)
     print(rog, g_tensor)
     #the first invariant is the rog
     self.assertAlmostEqual(
         g_tensor[0, 0] + g_tensor[1, 1] + g_tensor[2, 2], rog**2)
Пример #3
0
 def test_gyration_tensor_vs_rog(self):
     a1 = np.array([[1., 1., 1.], [0., 0., 0.],
                    [-1., -1., -1.], [-2, -2, -2]])
     rog = ftmd.radius_of_gyration(a1)
     g_tensor = ftmd.gyration_tensor(a1, diagonalize=True)
     print(rog, g_tensor)
     # the first invariant is the rog
     self.assertAlmostEqual(
         g_tensor[0, 0] + g_tensor[1, 1] + g_tensor[2, 2], rog**2)
Пример #4
0
 def test_gyration_tensor_diagonalize(self):
     a1 = np.array([[1., 1., 1.], [0., 0., 0.], [-1., -1., -1.],
                    [-2, -2, -2]])
     a2 = np.array([[1., 2., 1.], [0., 0., 0.], [-1., -1., -2.],
                    [-12, -2, -25]])
     for a in [a1, a2]:
         g_tensor = ftmd.gyration_tensor(a1, diagonalize=True)
         self.assertEqual(g_tensor[0, 1], 0)
         self.assertEqual(g_tensor[0, 2], 0)
         self.assertEqual(g_tensor[1, 2], 0)
         self.assertEqual(g_tensor[1, 0], 0)
         self.assertEqual(g_tensor[2, 0], 0)
         self.assertEqual(g_tensor[2, 1], 0)
         self.assertGreaterEqual(g_tensor[0, 0], g_tensor[1, 1])
         self.assertGreaterEqual(g_tensor[1, 1], g_tensor[2, 2])
Пример #5
0
 def test_gyration_tensor_diagonalize(self):
     a1 = np.array([[1., 1., 1.], [0., 0., 0.],
                    [-1., -1., -1.], [-2, -2, -2]])
     a2 = np.array([[1., 2., 1.], [0., 0., 0.],
                    [-1., -1., -2.], [-12, -2, -25]])
     for a in [a1, a2]:
         g_tensor = ftmd.gyration_tensor(a1, diagonalize=True)
         self.assertEqual(g_tensor[0, 1], 0)
         self.assertEqual(g_tensor[0, 2], 0)
         self.assertEqual(g_tensor[1, 2], 0)
         self.assertEqual(g_tensor[1, 0], 0)
         self.assertEqual(g_tensor[2, 0], 0)
         self.assertEqual(g_tensor[2, 1], 0)
         self.assertGreaterEqual(g_tensor[0, 0], g_tensor[1, 1])
         self.assertGreaterEqual(g_tensor[1, 1], g_tensor[2, 2])
Пример #6
0
 def test_gyration_tensor_no_coords(self):
     a = np.array([])
     g_tensor = ftmd.gyration_tensor(a, diagonalize=True)
     self.assertTrue(
         all(math.isnan(g_tensor[i, j]) for i, j in it.product(range(3), repeat=2)))