Example #1
0
 def symmetrize(self, a_g, op_scc, ft_sc=None):
     if len(op_scc) == 1:
         return
     
     A_g = self.collect(a_g)
     if self.comm.rank == 0:
         B_g = np.zeros_like(A_g)
         for i, op_cc in enumerate(op_scc):
             if ft_sc == None:
                 _gpaw.symmetrize(A_g, B_g, op_cc)
             else:
                 _gpaw.symmetrize_ft(A_g, B_g, op_cc, ft_sc[i])
     else:
         B_g = None
     self.distribute(B_g, a_g)
     a_g /= len(op_scc)
 def symmetrize(self, a_g, op_scc, ft_sc=None):
     if len(op_scc) == 1:
         return
     
     if ft_sc is not None and not ft_sc.any():
         ft_sc = None
         
     A_g = self.collect(a_g)
     if self.comm.rank == 0:
         B_g = np.zeros_like(A_g)
         for s, op_cc in enumerate(op_scc):
             if ft_sc is None:
                 _gpaw.symmetrize(A_g, B_g, op_cc)
             else:
                 _gpaw.symmetrize_ft(A_g, B_g, op_cc, ft_sc[s])
     else:
         B_g = None
     self.distribute(B_g, a_g)
     a_g /= len(op_scc)
Example #3
0
    def symmetrize(self, a_g, op_scc, ft_sc=None):
        # ft_sc: fractional translations
        # XXXX documentation missing.  This is some kind of array then?
        if len(op_scc) == 1:
            return

        if ft_sc is not None and not ft_sc.any():
            ft_sc = None

        A_g = self.collect(a_g)
        if self.comm.rank == 0:
            B_g = np.zeros_like(A_g)
            for s, op_cc in enumerate(op_scc):
                if ft_sc is None:
                    _gpaw.symmetrize(A_g, B_g, op_cc)
                else:
                    _gpaw.symmetrize_ft(A_g, B_g, op_cc, ft_sc[s])
        else:
            B_g = None
        self.distribute(B_g, a_g)
        a_g /= len(op_scc)