1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
8 # unit tests for dump.dcd
9 class dmp_dcd_tests (unittest
.TestCase
):
12 init
.create_random(N
=100, phi_p
=0.05);
14 sorter
.set_params(grid
=8)
16 # tests basic creation of the dump
18 dump
.dcd(filename
="dump_dcd", period
=100);
20 if (comm
.get_rank() == 0):
23 # tests unwrap_full option
24 def test_unwrap_full(self
):
25 dump
.dcd(filename
="dump_dcd", period
=100, unwrap_full
=True);
27 if (comm
.get_rank() == 0):
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);
36 if (comm
.get_rank() == 0):
41 typeA
= group
.type('A');
42 dump
.dcd(filename
="dump_dcd", group
=typeA
, period
=100);
44 if (comm
.get_rank() == 0):
47 # tests variable periods
48 def test_variable(self
):
49 dump
.dcd(filename
="dump_dcd", period
=lambda n
: n
*100);
51 if (comm
.get_rank() == 0):
55 def test_enable_disable(self
):
56 dcd
= dump
.dcd(filename
="dump_dcd", period
=100);
58 self
.assertRaises(RuntimeError, dcd
.enable
)
61 def test_set_period(self
):
62 dcd
= dump
.dcd(filename
="dump_dcd", period
=100);
63 self
.assertRaises(RuntimeError, dcd
.set_period
, 10)
69 if __name__
== '__main__':
70 unittest
.main(argv
= ['test.py', '-v'])