コード例 #1
0
 def test_close_within2(self, setup):
     g = setup.g.repeat(6, 0).repeat(6, 1)
     for ia in g:
         shapes = [Sphere(0.1, g[ia]), Sphere(1.5, g[ia])]
         i = g.close(ia, R=(0.1, 1.5))
         ii = g.within(shapes)
         assert np.all(i[0] == ii[0])
         assert np.all(i[1] == ii[1])
コード例 #2
0
 def test_close_within1(self, setup):
     three = range(3)
     for ia in setup.mol:
         shapes = [Sphere(0.1, setup.mol[ia]), Sphere(1.1, setup.mol[ia])]
         i = setup.mol.close(ia, R=(0.1, 1.1), idx=three)
         ii = setup.mol.within(shapes, idx=three)
         assert np.all(i[0] == ii[0])
         assert np.all(i[1] == ii[1])
コード例 #3
0
 def test_close_within2(self):
     g = self.g.repeat(6, 0).repeat(6, 1)
     for ia in g:
         shapes = [Sphere(0.1, g[ia, :]), Sphere(1.5, g[ia, :])]
         i = g.close(ia, dR=(0.1, 1.5))
         ii = g.within(shapes)
         assert_true(np.all(i[0] == ii[0]))
         assert_true(np.all(i[1] == ii[1]))
コード例 #4
0
 def test_close_within3(self, setup):
     g = setup.g.repeat(6, 0).repeat(6, 1)
     args = {'ret_xyz': True, 'ret_rij': True}
     for ia in g:
         shapes = [Sphere(0.1, g[ia]), Sphere(1.5, g[ia])]
         i, xa, d = g.close(ia, R=(0.1, 1.5), **args)
         ii, xai, di = g.within(shapes, **args)
         for j in [0, 1]:
             assert np.all(i[j] == ii[j])
             assert np.allclose(xa[j], xai[j])
             assert np.allclose(d[j], di[j])
コード例 #5
0
 def test_close_within3(self):
     g = self.g.repeat(6, 0).repeat(6, 1)
     args = {'ret_coord': True, 'ret_dist': True}
     for ia in g:
         shapes = [Sphere(0.1, g[ia, :]), Sphere(1.5, g[ia, :])]
         i, xa, d = g.close(ia, dR=(0.1, 1.5), **args)
         ii, xai, di = g.within(shapes, **args)
         for j in [0, 1]:
             assert_true(np.all(i[j] == ii[j]))
             assert_true(np.allclose(xa[j], xai[j]))
             assert_true(np.allclose(d[j], di[j]))
 def test_iter_shape3(self, setup):
     g = setup.g.tile(50, 0).tile(50, 1)
     i = 0
     for ias, _ in g.iter_block(method='sphere'):
         i += len(ias)
     assert i == len(g)
     i = 0
     for ias, _ in g.iter_block(method='cube'):
         i += len(ias)
     assert i == len(g)
     i = 0
     for ias, _ in g.iter_block_shape(Sphere(g.maxR() * 20)):
         i += len(ias)
     assert i == len(g)