示例#1
0
文件: test_box.py 项目: zijiewu3/gmso
 def test_scaled_vectors(self):
     box = Box(lengths=u.unyt_array((2, 2, 2), u.nm), angles=u.degree*[40.0, 50.0, 60.0])
     vectors = box.get_vectors()
     test_vectors = np.array([[1, 0, 0],
                             [0.5, 0.86603, 0],
                             [0.64278, 0.51344, 0.56852]])
     test_vectors = (test_vectors.T * box.lengths).T
     assert_allclose_units(vectors, test_vectors, rtol=1e-5, atol=u.nm*1e-3)
     assert vectors.units == u.nm
示例#2
0
文件: test_box.py 项目: zijiewu3/gmso
    def test_scaling_unit_vectors(self):
        box = Box(lengths=u.unyt_array((2, 2, 2), u.nm), angles=u.degree*[40.0, 50.0, 60.0])
        u_vectors = box.get_unit_vectors()
        scaled_u_vectors = (u_vectors.T * box.lengths).T

        scaled_vectors = box.get_vectors()

        assert_allclose_units(scaled_vectors, scaled_u_vectors, rtol=1e-5, atol=u.nm*1e-3)
        assert scaled_u_vectors.units == u.nm