Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
janssenhenning committed Oct 13, 2022
1 parent 6763bbb commit 536b232
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
10 changes: 0 additions & 10 deletions masci_tools/tools/greensf_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
28 changes: 18 additions & 10 deletions masci_tools/tools/greensfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 536b232

Please sign in to comment.