示例#1
0
 def test_is_coord_subset_pbc(self):
     c1 = [0,0,0]
     c2 = [0,1.2,-1]
     c3 = [2.3,0,1]
     c4 = [1.3-9e-9, -1-9e-9, 1-9e-9]
     self.assertTrue(is_coord_subset_pbc([c1, c2, c3], [c1, c4, c2]))
     self.assertTrue(is_coord_subset_pbc([c1], [c2, c1]))
     self.assertTrue(is_coord_subset_pbc([c1, c2], [c2, c1]))
     self.assertFalse(is_coord_subset_pbc([c1, c2], [c2, c3]))
     self.assertFalse(is_coord_subset_pbc([c1, c2], [c2]))
示例#2
0
 def test_is_coord_subset_pbc(self):
     c1 = [0,0,0]
     c2 = [0,1.2,-1]
     c3 = [2.3,0,1]
     c4 = [1.3-9e-9, -1-9e-9, 1-9e-9]
     self.assertTrue(is_coord_subset_pbc([c1, c2, c3], [c1, c4, c2]))
     self.assertTrue(is_coord_subset_pbc([c1], [c2, c1]))
     self.assertTrue(is_coord_subset_pbc([c1, c2], [c2, c1]))
     self.assertFalse(is_coord_subset_pbc([c1, c2], [c2, c3]))
     self.assertFalse(is_coord_subset_pbc([c1, c2], [c2]))
示例#3
0
    def _cmp_fstruct(self, s1, s2, frac_tol, mask):
        """
        Returns true if a matching exists between s2 and s2
        under frac_tol. s2 should be a subset of s1
        """
        if len(s2) > len(s1):
            raise ValueError("s1 must be larger than s2")
        if mask.shape != (len(s2), len(s1)):
            raise ValueError("mask has incorrect shape")

        return is_coord_subset_pbc(s2, s1, frac_tol, mask)
示例#4
0
    def _cmp_fstruct(self, s1, s2, frac_tol, mask):
        """
        Returns true if a matching exists between s2 and s2
        under frac_tol. s2 should be a subset of s1
        """
        if len(s2) > len(s1):
            raise ValueError("s1 must be larger than s2")
        if mask.shape != (len(s2), len(s1)):
            raise ValueError("mask has incorrect shape")

        return is_coord_subset_pbc(s2, s1, frac_tol, mask)
示例#5
0
    def test_is_coord_subset_pbc(self):
        c1 = [0, 0, 0]
        c2 = [0, 1.2, -1]
        c3 = [2.3, 0, 1]
        c4 = [1.3-9e-9, -1-9e-9, 1-9e-9]
        self.assertTrue(is_coord_subset_pbc([c1, c2, c3], [c1, c4, c2]))
        self.assertTrue(is_coord_subset_pbc([c1], [c2, c1]))
        self.assertTrue(is_coord_subset_pbc([c1, c2], [c2, c1]))
        self.assertFalse(is_coord_subset_pbc([c1, c2], [c2, c3]))
        self.assertFalse(is_coord_subset_pbc([c1, c2], [c2]))

        # test tolerances
        c5 = [0.1, 0.1, 0.2]
        atol1 = [0.25, 0.15, 0.15]
        atol2 = [0.15, 0.15, 0.25]
        self.assertFalse(is_coord_subset_pbc([c1], [c5], atol1))
        self.assertTrue(is_coord_subset_pbc([c1], [c5], atol2))

        # test mask
        mask1 = [[True]]
        self.assertFalse(is_coord_subset_pbc([c1], [c5], atol2, mask1))
        mask2 = [[True, False]]
        self.assertTrue(is_coord_subset_pbc([c1], [c2, c1], mask=mask2))
        self.assertFalse(is_coord_subset_pbc([c1], [c1, c2], mask=mask2))