Exemplo n.º 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])
Exemplo n.º 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])
Exemplo n.º 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])
Exemplo n.º 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])
Exemplo n.º 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:]))
Exemplo n.º 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:]))
Exemplo n.º 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])
Exemplo n.º 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])