1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
8 # tests improper.harmonic
9 class improper_harmonic_tests (unittest
.TestCase
):
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
):
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)
32 integrate
.mode_standard(dt
=0.005);
36 # test coefficient not set checking
37 def test_set_coeff_fail(self
):
38 harmonic
= improper
.harmonic();
40 integrate
.mode_standard(dt
=0.005);
42 self
.assertRaises(RuntimeError, run
, 100);
48 if __name__
== '__main__':
49 unittest
.main(argv
= ['test.py', '-v'])