示例#1
0
            tuple = []
            for j in range(num_constrain):
                tuple.append(num_constrain*i + j)
            tuplelist.addTuple(tuple)
            stored.append(tuple)

        num_constrain = N*N/2
        for i in range(N*N*N/num_constrain, 2*N*N*N/num_constrain):
            tuple = []
            for j in range(num_constrain):
                tuple.append(num_constrain*i + j)
            tuplelist.addTuple(tuple)
            stored.append(tuple)

	# check the size of FixedLocalTupleList
        self.assertEqual(sum(tuplelist.size(), 0), 1.5*N*N*N/num_constrain)

        # check the contained particles id
        g_tuplelist = tuplelist.getTuples()
        s_id = 0
        for i in range(3*N*N*N/num_constrain/2):
            for j in range(espressopp.MPI.COMM_WORLD.size):
                if stored[s_id] in g_tuplelist[j]:
                    break
            self.assertEqual(stored[s_id] in g_tuplelist[j], True)
            s_id += 1

if __name__ == "__main__":
    unittest.main()

示例#2
0
       # now build Verlet List

       vl = espressopp.VerletList(system, 0.0)

       self.assertEqual(vl.totalSize(), 0)

       vl = espressopp.VerletList(system, 1.0)

       # there are N * N * N * 6 / 2 pairs in cutoff 1.0

       self.assertEqual(vl.totalSize(), N * N * N * 3)

       # there are N * N * N * 18 / 2 pairs in cutoff  sqrt(2.0)

       vl = espressopp.VerletList(system, math.sqrt(2.0))

       self.assertEqual(vl.totalSize(), N * N * N * 9);

       vl = espressopp.VerletList(system, math.sqrt(3.0))

       # there are N * N * N * 26 / 2 pairs in cutoff

       self.assertEqual(vl.totalSize(), N * N * N * 13)



if __name__ == "__main__":
    unittest.main()