Fix potential problem in Messenger related to MPI window
[hoomd-blue.git] / test / hoomd_script / test_snapshot.py
blobf32d3a475c4383419e6e532a16eae6af385c798e
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # unit tests for init.create_random
9 class init_create_snapshot (unittest.TestCase):
10 def setUp(self):
11 pass
13 # test taking a snapshot and re-initializing
14 def test(self):
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)
20 del system
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)
36 del system
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)
44 del system
45 init.reset()
46 init.read_snapshot(snapshot)
48 def tearDown(self):
49 init.reset();
52 if __name__ == '__main__':
53 unittest.main(argv = ['test.py', '-v'])