1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
9 class force_constant_tests (unittest
.TestCase
):
12 init
.create_random(N
=100, phi_p
=0.05);
14 sorter
.set_params(grid
=8)
16 # test to see that se can create a force.constant
17 def test_create(self
):
18 force
.constant(fx
=1.0, fy
=0.5, fz
=0.74);
20 # test changing the force
21 def test_change_force(self
):
22 const
= force
.constant(fx
=1.0, fy
=0.5, fz
=0.74);
23 const
.set_force(fx
=1.45, fy
=0.25, fz
=-0.1);
25 # test the initialization checks
26 def test_init_checks(self
):
27 const
= force
.constant(fx
=1.0, fy
=0.5, fz
=0.74);
28 const
.cpp_force
= None;
30 self
.assertRaises(RuntimeError, const
.set_force
, fx
=1.45, fy
=0.25, fz
=-0.1);
31 self
.assertRaises(RuntimeError, const
.enable
);
32 self
.assertRaises(RuntimeError, const
.disable
);
33 self
.assertRaises(RuntimeError, const
.benchmark
, 500);
39 if __name__
== '__main__':
40 unittest
.main(argv
= ['test.py', '-v'])