Enable parallel tests.
[hoomd-blue.git] / test / hoomd_script / test_dump_dcd.py
blob971405f9d891793a34df81463600168e492330ca
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # unit tests for dump.dcd
9 class dmp_dcd_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 # tests basic creation of the dump
17 def test(self):
18 dump.dcd(filename="dump_dcd", period=100);
19 run(100)
20 if (comm.get_rank() == 0):
21 os.remove('dump_dcd')
23 # tests unwrap_full option
24 def test_unwrap_full(self):
25 dump.dcd(filename="dump_dcd", period=100, unwrap_full=True);
26 run(100)
27 if (comm.get_rank() == 0):
28 os.remove('dump_dcd')
30 # tests unwrap_rigid option
31 def test_unwrap_rigid(self):
32 # only supported in single-processor mode
33 if comm.get_num_ranks()==1:
34 dump.dcd(filename="dump_dcd", period=100, unwrap_rigid=True);
35 run(100)
36 if (comm.get_rank() == 0):
37 os.remove('dump_dcd')
39 # tests group option
40 def test_group(self):
41 typeA = group.type('A');
42 dump.dcd(filename="dump_dcd", group=typeA, period=100);
43 run(100)
44 if (comm.get_rank() == 0):
45 os.remove('dump_dcd')
47 # tests variable periods
48 def test_variable(self):
49 dump.dcd(filename="dump_dcd", period=lambda n: n*100);
50 run(100)
51 if (comm.get_rank() == 0):
52 os.remove('dump_dcd')
54 # test disable/enable
55 def test_enable_disable(self):
56 dcd = dump.dcd(filename="dump_dcd", period=100);
57 dcd.disable()
58 self.assertRaises(RuntimeError, dcd.enable)
60 # test set_period
61 def test_set_period(self):
62 dcd = dump.dcd(filename="dump_dcd", period=100);
63 self.assertRaises(RuntimeError, dcd.set_period, 10)
65 def tearDown(self):
66 init.reset();
69 if __name__ == '__main__':
70 unittest.main(argv = ['test.py', '-v'])