def symmetrize(self, a_g, op_scc): 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 op_cc in op_scc: _gpaw.symmetrize(A_g, B_g, op_cc) 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 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)
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)
m += 1 if m == nbands: break # Representation matrix representation_nn = np.zeros((ndeg, ndeg, nops)) for nop, op_cc in enumerate(op_scc): # Bands from n to m are (possibly) degenerate for n1 in range(n, m): for n2 in range(n, m): wf1 = calc.get_pseudo_wave_function(band=n1) wf2 = calc.get_pseudo_wave_function(band=n2) norm1 = np.sqrt(calc.wfs.gd.integrate(wf1, wf1)) norm2 = np.sqrt(calc.wfs.gd.integrate(wf2, wf2).real) wf_rot = np.zeros_like(wf2) symmetrize(wf2, wf_rot, op_cc) # Indices of representation matrix are from 0 to ndeg i1, i2 = n1 - n, n2 - n representation_nn[i1, i2, nop] = calc.wfs.gd.integrate(wf1, wf_rot) representation_nn[i1, i2, nop] /= norm1 * norm2 # Calculate traces of irreducible representations # If bands i1 and i2 are accidentally degenerate (i.e. not due to symmetry) # they belong to different irreducible representations and the # corresponding representation matrix elements are zero for all # symmetry operations. for i1 in range(ndeg): for i2 in range(ndeg): if np.any(abs(representation_nn[i1, i2, :]) > 0.01): characters[n + i1, :] += representation_nn[i2, i2, :]