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