Fix potential problem in Messenger related to MPI window
[hoomd-blue.git] / test / hoomd_script / test_improper_harmonic.py
blob25e9c843ec8d36a4bcf55a4785cbe7948cb1efb0
1 # -*- coding: iso-8859-1 -*-
2 # Maintainer: joaander
4 from hoomd_script import *
5 import unittest
6 import os
8 # tests improper.harmonic
9 class improper_harmonic_tests (unittest.TestCase):
10 def setUp(self):
11 print
12 # create a polymer system and add a dihedral 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);
19 sys.impropers.add('improperA',0, 1, 2, 3);
21 sorter.set_params(grid=8)
23 # test to see that se can create an angle.harmonic
24 def test_create(self):
25 improper.harmonic();
27 # test setting coefficients
28 def test_set_coeff(self):
29 harmonic = improper.harmonic();
30 harmonic.set_coeff('improperA', k=30.0, chi=1.57)
31 all = group.all();
32 integrate.mode_standard(dt=0.005);
33 integrate.nve(all);
34 run(100);
36 # test coefficient not set checking
37 def test_set_coeff_fail(self):
38 harmonic = improper.harmonic();
39 all = group.all();
40 integrate.mode_standard(dt=0.005);
41 integrate.nve(all);
42 self.assertRaises(RuntimeError, run, 100);
44 def tearDown(self):
45 init.reset();
48 if __name__ == '__main__':
49 unittest.main(argv = ['test.py', '-v'])