Beispiel #1
0
 def test_find_in_coord_list(self):
     coords = [[0, 0, 0], [0.5, 0.5, 0.5]]
     test_coord = [0.1, 0.1, 0.1]
     self.assertFalse(find_in_coord_list(coords, test_coord))
     self.assertEqual(find_in_coord_list(coords, test_coord, atol=0.15)[0],
                      0)
     self.assertFalse(find_in_coord_list([0.99, 0.99, 0.99], test_coord,
                                         atol=0.15))
     coords = [[0, 0, 0], [0.5, 0.5, 0.5], [0.1, 0.1, 0.1]]
     self.assertArrayEqual(find_in_coord_list(coords, test_coord,
                                              atol=0.15), [0, 2])
Beispiel #2
0
    def is_valid_op(self, symmop):
        """
        Check if a particular symmetry operation is a valid symmetry operation
        for a molecule, i.e., the operation maps all atoms to another
        equivalent atom.

        Args:
            symmop:
                Symmetry op to test.
        """
        coords = self.centered_mol.cart_coords
        for site in self.centered_mol:
            coord = symmop.operate(site.coords)
            ind = find_in_coord_list(coords, coord, self.tol)
            if not (len(ind) == 1 and
                    self.centered_mol[ind[0]].species_and_occu
                    == site.species_and_occu):
                return False
        return True
Beispiel #3
0
    def is_valid_op(self, symmop):
        """
        Check if a particular symmetry operation is a valid symmetry operation
        for a molecule, i.e., the operation maps all atoms to another
        equivalent atom.

        Args:
            symmop:
                Symmetry op to test.
        """
        coords = self.centered_mol.cart_coords
        for site in self.centered_mol:
            coord = symmop.operate(site.coords)
            ind = find_in_coord_list(coords, coord, self.tol)
            if not (len(ind) == 1
                    and self.centered_mol[ind[0]].species_and_occu
                    == site.species_and_occu):
                return False
        return True