1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
8 # tests dihedral.harmonic
9 class dihedral_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
);
20 dihedral_data
= globals.system_definition
.getDihedralData();
21 sys
.dihedrals
.add('dihedralA', 0, 1, 2, 3);
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
= dihedral
.harmonic();
32 harmonic
.set_coeff('dihedralA', k
=1.0, d
=1, n
=4)
34 integrate
.mode_standard(dt
=0.005);
38 # test coefficient not set checking
39 def test_set_coeff_fail(self
):
40 harmonic
= dihedral
.harmonic();
42 integrate
.mode_standard(dt
=0.005);
44 self
.assertRaises(RuntimeError, run
, 100);
51 if __name__
== '__main__':
52 unittest
.main(argv
= ['test.py', '-v'])