Enable parallel tests.
[hoomd-blue.git] / test / hoomd_script / test_angle_harmonic.py
blob2bc2e26e5e2f9bac3a882d261860a1041d6b21c1
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # tests angle.harmonic
9 class angle_harmonic_tests (unittest.TestCase):
10 def setUp(self):
11 print
12 # create a polymer system and add a few angles to it
13 self.polymer1 = dict(bond_len=1.2, type=['A']*6 + ['B']*7 + ['A']*6, bond="linear", count=100);
14 self.polymer2 = dict(bond_len=1.2, type=['B']*4, bond="linear", count=10)
15 self.polymers = [self.polymer1, self.polymer2]
16 self.box = data.boxdim(L=35);
17 self.separation=dict(A=0.35, B=0.35)
18 sys = init.create_random_polymers(box=self.box, polymers=self.polymers, separation=self.separation);
20 angle_data = globals.system_definition.getAngleData();
21 sys.angles.add('angleA', 0, 1, 2);
23 sorter.set_params(grid=8)
25 # test to see that se can create an angle.harmonic
26 def test_create(self):
27 angle.harmonic();
29 # test setting coefficients
30 def test_set_coeff(self):
31 harmonic = angle.harmonic();
32 harmonic.set_coeff('angleA', k=1.0, t0=0.78125)
33 all = group.all();
34 integrate.mode_standard(dt=0.005);
35 integrate.nve(all);
36 run(100);
38 # test coefficient not set checking
39 def test_set_coeff_fail(self):
40 harmonic = angle.harmonic();
41 all = group.all();
42 integrate.mode_standard(dt=0.005);
43 integrate.nve(all);
44 self.assertRaises(RuntimeError, run, 100);
46 def tearDown(self):
47 init.reset();
49 if __name__ == '__main__':
50 unittest.main(argv = ['test.py', '-v'])