Fix potential problem in Messenger related to MPI window
[hoomd-blue.git] / test / hoomd_script / test_bond_harmonic.py
blob2f1c6a4885150d9270a91d8d74bc30035c3a6aad
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # tests bond.harmonic
9 class bond_harmonic_tests (unittest.TestCase):
10 def setUp(self):
11 print
12 self.polymer1 = dict(bond_len=1.2, type=['A']*6 + ['B']*7 + ['A']*6, bond="linear", count=100);
13 self.polymer2 = dict(bond_len=1.2, type=['B']*4, bond="linear", count=10)
14 self.polymers = [self.polymer1, self.polymer2]
15 self.box = data.boxdim(L=35);
16 self.separation=dict(A=0.35, B=0.35)
17 init.create_random_polymers(box=self.box, polymers=self.polymers, separation=self.separation);
19 sorter.set_params(grid=8)
21 # test to see that se can create a force.constant
22 def test_create(self):
23 bond.harmonic();
25 # test setting coefficients
26 def test_set_coeff(self):
27 harmonic = bond.harmonic();
28 harmonic.bond_coeff.set('polymer', k=1.0, r0=1.0)
29 all = group.all();
30 integrate.mode_standard(dt=0.005);
31 integrate.nve(all);
32 run(100);
34 # test coefficient not set checking
35 def test_set_coeff_fail(self):
36 harmonic = bond.harmonic();
37 all = group.all();
38 integrate.mode_standard(dt=0.005);
39 integrate.nve(all);
40 self.assertRaises(RuntimeError, run, 100);
42 def tearDown(self):
43 init.reset();
46 if __name__ == '__main__':
47 unittest.main(argv = ['test.py', '-v'])