Include tests for gather_angles, gather_dihedrals & gather_impropers in python-scatter-gather.py
This commit is contained in:
committed by
GitHub
parent
10ab0ffe19
commit
755766220c
@ -115,6 +115,128 @@ class PythonGather(unittest.TestCase):
|
||||
count += self.checkBond(bonds[3*i:3*i+3], 5, 27, 29)
|
||||
self.assertEqual(count,10)
|
||||
|
||||
@unittest.skipIf(not has_full, "Gather_angles test")
|
||||
def testGatherAngle_newton_on(self):
|
||||
"""Test gather_angles() with newton on"""
|
||||
self.lmp.command("newton on on")
|
||||
self.lmp.file("in.fourmol")
|
||||
self.lmp.command("run 0 post no")
|
||||
nangles, angles = self.lmp.gather_angles()
|
||||
self.assertEqual(nangles, 30)
|
||||
self.assertEqual(len(angles), 120)
|
||||
count = 0;
|
||||
for i in range(0,nangles):
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 4, 2, 1, 3)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 4, 1, 3, 6)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 2, 4, 3, 6)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 3, 7, 6, 8)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 3, 8, 10, 16)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 2, 8, 10, 11)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 1, 12, 10, 16)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 2, 10, 12, 14)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 1, 19, 18, 20)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 1, 28, 27, 29)
|
||||
self.assertEqual(count,10)
|
||||
|
||||
@unittest.skipIf(not has_full, "Gather_angles test")
|
||||
def testGatherAngle_newton_off(self):
|
||||
"""Test gather_angles() with newton off"""
|
||||
self.lmp.command("newton off off")
|
||||
self.lmp.file("in.fourmol")
|
||||
self.lmp.command("run 0 post no")
|
||||
nangles, angles = self.lmp.gather_angles()
|
||||
self.assertEqual(nangles, 30)
|
||||
self.assertEqual(len(angles), 120)
|
||||
count = 0;
|
||||
for i in range(0,nangles):
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 4, 2, 1, 3)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 4, 1, 3, 6)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 2, 4, 3, 6)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 3, 7, 6, 8)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 3, 8, 10, 16)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 2, 8, 10, 11)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 1, 12, 10, 16)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 2, 10, 12, 14)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 1, 19, 18, 20)
|
||||
count += self.checkAngle(angles[4*i:4*i+4], 1, 28, 27, 29)
|
||||
self.assertEqual(count,10)
|
||||
|
||||
@unittest.skipIf(not has_full, "Gather_dihedrals test")
|
||||
def testGatherDihedral_newton_on(self):
|
||||
"""Test gather_dihedrals() with newton on"""
|
||||
self.lmp.command("newton on on")
|
||||
self.lmp.file("in.fourmol")
|
||||
self.lmp.command("run 0 post no")
|
||||
ndihedrals, dihedrals = self.lmp.gather_dihedrals()
|
||||
self.assertEqual(ndihedrals, 31)
|
||||
self.assertEqual(len(dihedrals), 155)
|
||||
count = 0;
|
||||
for i in range(0,ndihedrals):
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 2, 2, 1, 3, 6)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 3, 2, 1, 3, 5)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 1, 1, 3, 6, 7)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 5, 4, 3, 6, 7)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 4, 3, 6, 8, 9)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 2, 6, 8, 10, 16)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 5, 8, 10, 12, 13)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 1, 8, 10, 12, 14)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 2, 11, 10, 16, 17)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 5, 16, 10, 12, 14)
|
||||
self.assertEqual(count,10)
|
||||
|
||||
@unittest.skipIf(not has_full, "Gather_dihedrals test")
|
||||
def testGatherDihedral_newton_off(self):
|
||||
"""Test gather_dihedrals() with newton off"""
|
||||
self.lmp.command("newton off off")
|
||||
self.lmp.file("in.fourmol")
|
||||
self.lmp.command("run 0 post no")
|
||||
ndihedrals, dihedrals = self.lmp.gather_dihedrals()
|
||||
self.assertEqual(ndihedrals, 31)
|
||||
self.assertEqual(len(dihedrals), 155)
|
||||
count = 0;
|
||||
for i in range(0,ndihedrals):
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 2, 2, 1, 3, 6)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 3, 2, 1, 3, 5)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 1, 1, 3, 6, 7)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 5, 4, 3, 6, 7)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 4, 3, 6, 8, 9)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 2, 6, 8, 10, 16)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 5, 8, 10, 12, 13)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 1, 8, 10, 12, 14)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 2, 11, 10, 16, 17)
|
||||
count += self.checkDihedral(dihedrals[5*i:5*i+5], 5, 16, 10, 12, 14)
|
||||
self.assertEqual(count,10)
|
||||
|
||||
@unittest.skipIf(not has_full, "Gather_impropers test")
|
||||
def testGatherImproper_newton_on(self):
|
||||
"""Test gather_impropers() with newton on"""
|
||||
self.lmp.command("newton on on")
|
||||
self.lmp.file("in.fourmol")
|
||||
self.lmp.command("run 0 post no")
|
||||
nimpropers, impropers = self.lmp.gather_impropers()
|
||||
self.assertEqual(nimpropers, 2)
|
||||
self.assertEqual(len(impropers), 10)
|
||||
count = 0;
|
||||
for i in range(0,nimpropers):
|
||||
count += self.checkImproper(impropers[5*i:5*i+5], 1, 6, 3, 8, 7)
|
||||
count += self.checkImproper(impropers[5*i:5*i+5], 2, 8, 6, 10, 9)
|
||||
self.assertEqual(count,10)
|
||||
|
||||
@unittest.skipIf(not has_full, "Gather_impropers test")
|
||||
def testGatherImproper_newton_off(self):
|
||||
"""Test gather_impropers() with newton off"""
|
||||
self.lmp.command("newton off off")
|
||||
self.lmp.file("in.fourmol")
|
||||
self.lmp.command("run 0 post no")
|
||||
nimpropers, impropers = self.lmp.gather_impropers()
|
||||
self.assertEqual(nimpropers, 2)
|
||||
self.assertEqual(len(impropers), 10)
|
||||
count = 0;
|
||||
for i in range(0,nimpropers):
|
||||
count += self.checkImproper(impropers[5*i:5*i+5], 1, 6, 3, 8, 7)
|
||||
count += self.checkImproper(impropers[5*i:5*i+5], 2, 8, 6, 10, 9)
|
||||
self.assertEqual(count,10)
|
||||
|
||||
##############################
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user