Enable parallel tests.
[hoomd-blue.git] / test / hoomd_script / test_pair_table.py
blobba40b3d49b282e7365a7325c348976f68e1e914f
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # pair.table
9 class pair_table_tests (unittest.TestCase):
10 def setUp(self):
11 print
12 init.create_random(N=100, phi_p=0.05);
14 sorter.set_params(grid=8)
16 # basic test of creation
17 def test(self):
18 table = pair.table(width=1000);
19 table.pair_coeff.set('A', 'A', rmin=0.0, rmax=1.0, func=lambda r, rmin, rmax: (r, 2*r), coeff=dict());
20 table.update_coeffs();
22 # test missing coefficients
23 def test_set_missing_epsilon(self):
24 table = pair.table(width=1000);
25 table.pair_coeff.set('A', 'A', rmin=0.0, rmax=1.0);
26 self.assertRaises(RuntimeError, table.update_coeffs);
28 # test missing coefficients
29 def test_missing_AA(self):
30 table = pair.table(width=1000);
31 self.assertRaises(RuntimeError, table.update_coeffs);
33 # test nlist subscribe
34 def test_nlist_subscribe(self):
35 table = pair.table(width=1000);
36 table.pair_coeff.set('A', 'A', rmin=0.0, rmax=1.0, func=lambda r, rmin, rmax: (r, 2*r), coeff=dict());
37 table.update_coeffs();
38 globals.neighbor_list.update_rcut();
39 self.assertAlmostEqual(1.0, globals.neighbor_list.r_cut);
41 table.pair_coeff.set('A', 'A', rmax = 2.5)
42 globals.neighbor_list.update_rcut();
43 self.assertAlmostEqual(2.5, globals.neighbor_list.r_cut);
45 def tearDown(self):
46 init.reset();
49 if __name__ == '__main__':
50 unittest.main(argv = ['test.py', '-v'])