Enable parallel tests.
[hoomd-blue.git] / test / hoomd_script / test_pair_max_rcut.py
blobca2d330f70d2cc29a747ae7c2d28e6e86e36b55b
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # pair - multiple type max_rcut test
9 class pair_max_rcut_tests (unittest.TestCase):
10 def setUp(self):
11 #print
12 init.create_empty(N=100, box=data.boxdim(L=20), particle_types=['A', 'B']);
14 sorter.set_params(grid=8)
16 def test_max_rcut(self):
17 lj = pair.lj(r_cut=2.5);
18 lj.pair_coeff.set('A', 'A', simga=1.0, epsilon=1.0)
19 lj.pair_coeff.set('A', 'B', simga=1.0, epsilon=1.0)
20 lj.pair_coeff.set('B', 'B', simga=1.0, epsilon=1.0)
21 self.assertAlmostEqual(2.5, lj.get_max_rcut());
22 lj.pair_coeff.set('A', 'A', r_cut = 2.0)
23 self.assertAlmostEqual(2.5, lj.get_max_rcut());
24 lj.pair_coeff.set('A', 'B', r_cut = 3.0)
25 self.assertAlmostEqual(3.0, lj.get_max_rcut());
26 lj.pair_coeff.set('B', 'B', r_cut = 3.5)
27 self.assertAlmostEqual(3.5, lj.get_max_rcut());
29 def test_nlist_subscribe(self):
30 lj = pair.lj(r_cut=2.5);
31 lj.pair_coeff.set('A', 'A', simga=1.0, epsilon=1.0, r_cut=3.0)
32 lj.pair_coeff.set('A', 'B', simga=1.0, epsilon=1.0, r_cut=2.5)
33 lj.pair_coeff.set('B', 'B', simga=1.0, epsilon=1.0, r_cut=3.1)
35 globals.neighbor_list.update_rcut()
36 self.assertAlmostEqual(3.1, globals.neighbor_list.r_cut);
38 gauss = pair.gauss(r_cut=1.0)
39 gauss.pair_coeff.set('A', 'A', simga=1.0, epsilon=1.0, r_cut=1.0)
40 gauss.pair_coeff.set('A', 'B', simga=1.0, epsilon=1.0, r_cut=2.0)
41 gauss.pair_coeff.set('B', 'B', simga=1.0, epsilon=1.0, r_cut=5.1)
43 globals.neighbor_list.update_rcut()
44 self.assertAlmostEqual(5.1, globals.neighbor_list.r_cut);
46 gauss.pair_coeff.set('B', 'B', simga=1.0, epsilon=1.0, r_cut=1.0)
47 run(1)
48 self.assertAlmostEqual(3.1, globals.neighbor_list.r_cut);
50 def tearDown(self):
51 init.reset();
54 if __name__ == '__main__':
55 unittest.main(argv = ['test.py', '-v'])