Enable parallel tests.
[hoomd-blue.git] / test / hoomd_script / test_pair_morse.py
blobd4784d7a966a6fbf22eb3250c5f1e564d5e8bcdc
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # pair.yukawa
9 class pair_morse_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 p = pair.morse(r_cut=3.0);
19 p.pair_coeff.set('A', 'A', D0=1.0, alpha=3.0, r0=1.0, r_cut=3.0, r_on=2.0);
20 p.update_coeffs();
22 # test missing coefficients
23 def test_set_missing_epsilon(self):
24 p = pair.morse(r_cut=3.0);
25 p.pair_coeff.set('A', 'A', D0=1.0);
26 self.assertRaises(RuntimeError, p.update_coeffs);
28 # test missing coefficients
29 def test_missing_AA(self):
30 p = pair.morse(r_cut=3.0);
31 self.assertRaises(RuntimeError, p.update_coeffs);
33 # test set params
34 def test_set_params(self):
35 p = pair.morse(r_cut=3.0);
36 p.set_params(mode="no_shift");
37 p.set_params(mode="shift");
38 p.set_params(mode="xplor");
39 self.assertRaises(RuntimeError, p.set_params, mode="blah");
41 # test nlist subscribe
42 def test_nlist_subscribe(self):
43 p = pair.morse(r_cut=2.5);
44 p.pair_coeff.set('A', 'A', D0=1.0, alpha=3.0, r0=1.0)
45 globals.neighbor_list.update_rcut();
46 self.assertAlmostEqual(2.5, globals.neighbor_list.r_cut);
48 p.pair_coeff.set('A', 'A', r_cut = 2.0)
49 globals.neighbor_list.update_rcut();
50 self.assertAlmostEqual(2.0, globals.neighbor_list.r_cut);
52 def tearDown(self):
53 init.reset();
56 if __name__ == '__main__':
57 unittest.main(argv = ['test.py', '-v'])