예제 #1
0
    def test_Utils_CheckGeom_GoodCheck(self):
        from opan.utils import check_geom as cg
        from opan.const import atom_num

        # check_geom returns a tuple; success or not is the first element
        self.assertTrue(cg(self.coords, self.atoms,
                           self.coords, self.atoms)[0])

        # Also check if the atoms are swapped with atomic numbers
        self.assertTrue(cg(self.coords, [atom_num[s] for s in self.atoms],
                           self.coords, self.atoms)[0])
예제 #2
0
    def test_Utils_CheckGeom_GoodCheck(self):
        from opan.utils import check_geom as cg
        from opan.const import atom_num

        # check_geom returns a tuple; success or not is the first element
        self.assertTrue(
            cg(self.coords, self.atoms, self.coords, self.atoms)[0])

        # Also check if the atoms are swapped with atomic numbers
        self.assertTrue(
            cg(self.coords, [atom_num[s] for s in self.atoms], self.coords,
               self.atoms)[0])
예제 #3
0
    def test_Utils_CheckGeom_GeomSizeMismatch(self):
        from opan.utils import check_geom as cg

        tup = cg(self.coords, self.atoms, self.coords[:9], self.atoms[:3])

        self.assertFalse(tup[0])
        self.assertEqual(tup[1], self.ECGM.DIMENSION)
        self.assertIsNone(tup[2])
예제 #4
0
    def test_Utils_CheckGeom_GeomSizeMismatch(self):
        from opan.utils import check_geom as cg

        tup = cg(self.coords, self.atoms, self.coords[:9], self.atoms[:3])

        self.assertFalse(tup[0])
        self.assertEqual(tup[1], self.ECGM.DIMENSION)
        self.assertIsNone(tup[2])
예제 #5
0
    def test_Utils_CheckGeom_CoordMismatch(self):
        from opan.utils import check_geom as cg

        # Change one of the coordinates to achieve mismatch
        coord_mod = self.coords.copy()
        coord_mod[0] = -12

        # Store the call result and check its contents
        tup = cg(coord_mod, self.atoms, self.coords, self.atoms)
        self.assertFalse(tup[0])
        self.assertEqual(tup[1], self.ECGM.COORDS)
        self.assertFalse(tup[2][0])
        self.assertTrue(all(tup[2][1:]))
예제 #6
0
    def test_Utils_CheckGeom_CoordMismatch(self):
        from opan.utils import check_geom as cg

        # Change one of the coordinates to achieve mismatch
        coord_mod = self.coords.copy()
        coord_mod[0] = -12

        # Store the call result and check its contents
        tup = cg(coord_mod, self.atoms, self.coords, self.atoms)
        self.assertFalse(tup[0])
        self.assertEqual(tup[1], self.ECGM.COORDS)
        self.assertFalse(tup[2][0])
        self.assertTrue(all(tup[2][1:]))
예제 #7
0
    def test_Utils_CheckGeom_AtomMismatch(self):
        from opan.utils import check_geom as cg

        # Change one of the atoms to achieve mismatch
        atoms_mod = self.atoms.copy()
        atoms_mod[2] = 'C'

        # Store the call result and check its contents
        tup = cg(self.coords, atoms_mod, self.coords, self.atoms)
        self.assertFalse(tup[0])
        self.assertEqual(tup[1], self.ECGM.ATOMS)
        self.assertFalse(tup[2][2])
        self.assertTrue(all(tup[2][:2]))
        self.assertTrue(tup[2][3])
예제 #8
0
    def test_Utils_CheckGeom_AtomMismatch(self):
        from opan.utils import check_geom as cg

        # Change one of the atoms to achieve mismatch
        atoms_mod = self.atoms.copy()
        atoms_mod[2] = 'C'

        # Store the call result and check its contents
        tup = cg(self.coords, atoms_mod, self.coords, self.atoms)
        self.assertFalse(tup[0])
        self.assertEqual(tup[1], self.ECGM.ATOMS)
        self.assertFalse(tup[2][2])
        self.assertTrue(all(tup[2][:2]))
        self.assertTrue(tup[2][3])