Пример #1
0
    def expand_kpts(self):
        """ Take a list of qpoints and symmetry operations and return the full brillouin zone
        with the corresponding index in the irreducible brillouin zone
        """

        #check if the kpoints were already exapnded
        if self.expanded == True:
            return self.kpoints_full, self.kpoints_indexes, self.symmetry_indexes

        kpoints_indexes = []
        kpoints_full = []
        symmetry_indexes = []

        #kpoints in the full brillouin zone organized per index
        kpoints_full_i = {}

        #expand using symmetries
        for nk, k in enumerate(self.car_kpoints):
            for ns, sym in enumerate(self.sym_car):
                new_k = np.dot(sym, k)

                #check if the point is inside the bounds
                k_red = car_red([new_k], self.rlat)[0]
                k_bz = (k_red + atol) % 1

                #if the index in not in the dicitonary add a list
                if nk not in kpoints_full_i:
                    kpoints_full_i[nk] = []

                #if the vector is not in the list of this index add it
                if not vec_in_list(k_bz, kpoints_full_i[nk]):
                    kpoints_full_i[nk].append(k_bz)
                    kpoints_full.append(new_k)
                    kpoints_indexes.append(nk)
                    symmetry_indexes.append(ns)

        #calculate the weights of each of the kpoints in the irreducible brillouin zone
        self.full_nkpoints = len(kpoints_full)
        weights = np.zeros([self.nkpoints])
        for nk in kpoints_full_i:
            weights[nk] = float(len(kpoints_full_i[nk])) / self.full_nkpoints

        #set the variables
        self.expanded = True
        self.weights = np.array(weights)
        self.kpoints_full = np.array(kpoints_full)
        self.kpoints_indexes = np.array(kpoints_indexes)
        self.symmetry_indexes = np.array(symmetry_indexes)

        print("%d kpoints expanded to %d" %
              (len(self.car_kpoints), len(kpoints_full)))

        return self.kpoints_full, self.kpoints_indexes, self.symmetry_indexes
Пример #2
0
 def red_kpoints(self):
     """convert from cartesian coordinates to reduced coordinates"""
     if not hasattr(self, "_red_kpoints"):
         self._red_kpoints = car_red(self.car_kpoints, self.rlat)
     return self._red_kpoints
Пример #3
0
 def red_atomic_positions(self):
     return car_red(self.car_atomic_positions, self.lat)