diff --git a/masci_tools/tools/greensf_calculations.py b/masci_tools/tools/greensf_calculations.py index 15262c421..5597cf0a4 100644 --- a/masci_tools/tools/greensf_calculations.py +++ b/masci_tools/tools/greensf_calculations.py @@ -91,16 +91,6 @@ def calculate_heisenberg_jij(hdffileORgreensfunctions: FileLike | list[GreensFun delta_i = onsite_delta[g1.atomType - 1, g1.l, 3 - g1.l:4 + g1.l, 3 - g1.l:4 + g1.l] delta_j = onsite_delta[g1.atomTypep - 1, g1.l, 3 - g1.l:4 + g1.l, 3 - g1.l:4 + g1.l] - #Rotate into global spin frame - alpha, alphap = g1._angle_alpha #pylint: disable=protected-access - beta, betap = g1._angle_beta #pylint: disable=protected-access - - rot_spin = get_spin_rotation(-alpha, -beta) - rotp_spin = get_spin_rotation(-alphap, -betap) - - delta_i = np.einsum('ij,xyjk,km->xyim', rot_spin, delta_i, rot_spin.T.conj()) - delta_j = np.einsum('ij,xyjk,km->xyim', rotp_spin, delta_j, rotp_spin.T.conj()) - if transform_func is not None: delta_i = transform_func(delta_i) delta_j = transform_func(delta_j) diff --git a/masci_tools/tools/greensfunction.py b/masci_tools/tools/greensfunction.py index 146077ee5..d4c5113ac 100644 --- a/masci_tools/tools/greensfunction.py +++ b/masci_tools/tools/greensfunction.py @@ -667,24 +667,32 @@ def average_spindiagonal(self) -> None: Average out ferromagnetic contributions on the local spin-diagonals """ - # alpha, alphap = self._angle_alpha - # beta, betap = self._angle_beta - # if not self._local_real_frame: - # rot_real_space = get_wigner_matrix(self.l, alpha, beta) - # rotp_real_space = get_wigner_matrix(self.lp, alphap, betap) + alpha, alphap = self._angle_alpha + beta, betap = self._angle_beta + if not self._local_real_frame: + rot_real_space = get_wigner_matrix(self.l, alpha, beta) + rotp_real_space = get_wigner_matrix(self.lp, alphap, betap) - # for name, data in self._data.items(): - # data = np.einsum('ij,xjk...,km->xim...', rot_real_space.T.conj(), data, rotp_real_space) - # self._data[name] = data - # self._local_real_frame = True + for name, data in self._data.items(): + data = np.einsum('ij,xjk...,km->xim...', rot_real_space.T.conj(), data, rotp_real_space) + self._data[name] = data for name in self._data.keys(): - for m in range(self.lmax): + for m in range(2*self.lmax+1): self._data[name][:, m, m, 0] = (self._data[name][:, m, m, 0] + self._data[name][:, m, m, min(1, self.nspins - 1)]) / 2 if self.nspins > 1: self._data[name][:, m, m, 1] = self._data[name][:, m, m, 0] + if not self._local_real_frame: + rot_real_space = get_wigner_matrix(self.l, alpha, beta, inverse=True) + rotp_real_space = get_wigner_matrix(self.lp, alphap, betap, inverse=True) + + for name, data in self._data.items(): + data = np.einsum('ij,xjk...,km->xim...', rot_real_space.T.conj(), data, rotp_real_space) + self._data[name] = data + + def to_global_frame(self) -> None: """ Rotate the Green's function into the global real space and spin space frame