예제 #1
0
파일: testcases.py 프로젝트: csmm/multiase
 def test_weights(self):
     cb = CalcBox(name="testbox", pos=(0., 0., 0.),
                  cutoff=2.0,
                  dim=(100.0, 100.0, 100.0),
                  inner_dim=(50.0, 50.0, 50.0))
     # test all three axis
     test_positions = np.column_stack((np.linspace(-55.0, 55.0, 100),
                                       np.zeros(100),
                                       np.zeros(100)))
     test_positions = np.append(test_positions, np.column_stack(
                             (np.zeros(100),
                              np.linspace(-55.0, 55.0, 100),
                              np.zeros(100))), axis=0)
     test_positions = np.append(test_positions, np.column_stack(
                             (np.zeros(100),
                              np.zeros(100),
                              np.linspace(-55.0, 55.0, 100))),
                              axis=0)
     # and all 8 corners too
     a = 37.5
     test_positions = np.append(test_positions, np.array((
                             (-a, -a, -a),
                             (-a, -a, a),
                             (-a, a, -a),
                             (-a, a, -a),
                             (a, -a, -a),
                             (a, -a, a),
                             (a, a, -a),
                             (a, a, a))),
                             axis=0)
     correct_weights = np.loadtxt("weight_test.csv", delimiter=",")
     for i in range(len(test_positions)):
         w = cb.get_weight(test_positions[i])
         self.assertEqual(correct_weights[i], w)
예제 #2
0
 def test_weights(self):
     cb = CalcBox(name="testbox",
                  pos=(0., 0., 0.),
                  cutoff=2.0,
                  dim=(100.0, 100.0, 100.0),
                  inner_dim=(50.0, 50.0, 50.0))
     # test all three axis
     test_positions = np.column_stack(
         (np.linspace(-55.0, 55.0, 100), np.zeros(100), np.zeros(100)))
     test_positions = np.append(test_positions,
                                np.column_stack(
                                    (np.zeros(100),
                                     np.linspace(-55.0, 55.0,
                                                 100), np.zeros(100))),
                                axis=0)
     test_positions = np.append(test_positions,
                                np.column_stack(
                                    (np.zeros(100), np.zeros(100),
                                     np.linspace(-55.0, 55.0, 100))),
                                axis=0)
     # and all 8 corners too
     a = 37.5
     test_positions = np.append(test_positions,
                                np.array(
                                    ((-a, -a, -a), (-a, -a, a), (-a, a, -a),
                                     (-a, a, -a), (a, -a, -a), (a, -a, a),
                                     (a, a, -a), (a, a, a))),
                                axis=0)
     correct_weights = np.loadtxt("weight_test.csv", delimiter=",")
     for i in range(len(test_positions)):
         w = cb.get_weight(test_positions[i])
         self.assertEqual(correct_weights[i], w)