Enable parallel tests.
[hoomd-blue.git] / test / hoomd_script / test_replicate.py
blob1a7914e8c2418fae652e6e6b17d5bd1552658b52
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 replicate(unittest.TestCase):
10 def setUp(self):
11 self.polymer1 = dict(bond_len=1.2, type=['A']*6 + ['B']*7 + ['A']*6, bond="linear", count=100);
12 self.polymer2 = dict(bond_len=1.2, type=['B']*4, bond="linear", count=10)
13 self.polymers = [self.polymer1, self.polymer2]
14 self.box = data.boxdim(L=35);
15 self.separation=dict(A=0.42, B=0.42)
16 self.s = init.create_random_polymers(box=self.box, polymers=self.polymers, separation=self.separation);
17 self.assert_(globals.system_definition);
18 self.assert_(globals.system);
19 self.harmonic = bond.harmonic();
20 self.harmonic.bond_coeff.set('polymer', k=1.0, r0=1.0)
21 self.pair = pair.lj(r_cut=2.5)
22 self.pair.pair_coeff.set('A','A',epsilon=1.0, sigma=1.0)
23 self.pair.pair_coeff.set('A','B',epsilon=1.0, sigma=1.0)
24 self.pair.pair_coeff.set('B','B',epsilon=1.0, sigma=1.0)
26 def test_replicate(self):
27 self.s.replicate(nx=2,ny=2,nz=2)
28 integrate.mode_standard(dt=0.005);
29 integrate.nve(group.all());
30 run(100)
31 self.assertEqual(len(self.s.particles),8*(19*100+4*10))
32 self.assertEqual(len(self.s.bonds),8*(18*100+3*10))
33 self.assertEqual(globals.neighbor_list.cpp_nlist.getNumExclusions(2), 8*(17*100+2*10))
34 self.assertEqual(globals.neighbor_list.cpp_nlist.getNumExclusions(1), 8*(2*100+2*10))
35 run(100);
37 def tearDown(self):
38 del self.harmonic
39 del self.pair
40 del self.s
41 init.reset();
43 if __name__ == '__main__':
44 unittest.main(argv = ['test.py', '-v'])