1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
8 # unit tests for init.create_random
9 class init_create_snapshot (unittest
.TestCase
):
13 # test taking a snapshot and re-initializing
15 system
= init
.create_random(N
=100, phi_p
=0.05);
16 self
.assertTrue(globals.system_definition
);
17 self
.assertTrue(globals.system
);
18 snapshot
= system
.take_snapshot(all
=True)
19 system
.restore_snapshot(snapshot
)
22 # tests options to take_snapshot
23 def test_options(self
):
24 system
= init
.create_random(N
=100, phi_p
=0.05);
25 self
.assertTrue(globals.system_definition
);
26 self
.assertTrue(globals.system
);
27 snapshot
= system
.take_snapshot(particles
=True)
28 system
.restore_snapshot(snapshot
)
29 snapshot
= system
.take_snapshot(bonds
=True)
30 snapshot
= system
.take_snapshot(angles
=True)
31 snapshot
= system
.take_snapshot(dihedrals
=True)
32 snapshot
= system
.take_snapshot(impropers
=True)
33 snapshot
= system
.take_snapshot(walls
=True)
34 snapshot
= system
.take_snapshot(rigid_bodies
=True)
35 snapshot
= system
.take_snapshot(integrators
=True)
39 def test_read_snapshot(self
):
40 system
= init
.create_random(N
=100, phi_p
=0.05);
41 self
.assertTrue(globals.system_definition
);
42 self
.assertTrue(globals.system
);
43 snapshot
= system
.take_snapshot(all
=True)
46 init
.read_snapshot(snapshot
)
52 if __name__
== '__main__':
53 unittest
.main(argv
= ['test.py', '-v'])