1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
9 class pair_gauss_tests (unittest
.TestCase
):
12 init
.create_random(N
=100, phi_p
=0.05);
14 sorter
.set_params(grid
=8)
16 # basic test of creation
18 gauss
= pair
.gauss(r_cut
=3.0);
19 gauss
.pair_coeff
.set('A', 'A', epsilon
=1.0, sigma
=1.0);
20 gauss
.update_coeffs();
22 # test missing coefficients
23 def test_set_missing_epsilon(self
):
24 gauss
= pair
.gauss(r_cut
=3.0);
25 gauss
.pair_coeff
.set('A', 'A', sigma
=1.0);
26 self
.assertRaises(RuntimeError, gauss
.update_coeffs
);
28 # test missing coefficients
29 def test_missing_AA(self
):
30 gauss
= pair
.gauss(r_cut
=3.0);
31 self
.assertRaises(RuntimeError, gauss
.update_coeffs
);
34 def test_set_params(self
):
35 gauss
= pair
.gauss(r_cut
=3.0);
36 gauss
.set_params(mode
="no_shift");
37 gauss
.set_params(mode
="shift");
38 gauss
.set_params(mode
="xplor");
39 self
.assertRaises(RuntimeError, gauss
.set_params
, mode
="blah");
41 # test nlist subscribe
42 def test_nlist_subscribe(self
):
43 gauss
= pair
.gauss(r_cut
=2.5);
44 gauss
.pair_coeff
.set('A', 'A', simga
=1.0, epsilon
=1.0)
45 globals.neighbor_list
.update_rcut();
46 self
.assertAlmostEqual(2.5, globals.neighbor_list
.r_cut
);
48 gauss
.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
);
56 if __name__
== '__main__':
57 unittest
.main(argv
= ['test.py', '-v'])