コード例 #1
0
def AkBkExplicit(ky,
                 kz,
                 N=None,
                 J=None,
                 S=None,
                 h=None,
                 eps=None,
                 a=None,
                 mu=None,
                 Nr=4,
                 Ng=4):
    xx = Dkxx(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    yy = Dkyy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    zz = Dkzz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    xy = Dkxy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)

    xx_table = xx.table(ky, kz, N)
    yy_table = yy.table(ky, kz, N)
    zz_table0 = zz.table(10**-6, 10**-6, N)
    xy_table = xy.table(ky, kz, N)

    Atemp = np.zeros((N, N), dtype=np.complex)
    Btemp = np.zeros((N, N), dtype=np.complex)
    for i in range(N):
        for j in range(N):
            if i == j:
                Atemp[i, j] = h + S * np.sum(zz_table0[i:i + N])
            Atemp[i, j] += S * Jk(i, j, ky, kz, N=N, a=a, J=J)
            Atemp[i, j] -= S / 2 * (xx_table[i - j + N - 1] +
                                    yy_table[i - j + N - 1])

            Btemp[i, j] = -0.5 * S * (xx_table[i - j + N - 1] -
                                      2j * xy_table[i - j + N - 1] -
                                      yy_table[i - j + N - 1])
    return Atemp, Btemp
コード例 #2
0
def AkBk(ky,
         kz,
         N=None,
         J=None,
         S=None,
         h=None,
         eps=None,
         a=None,
         mu=None,
         Nr=4,
         Ng=4):
    xx = Dkxx(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    yy = Dkyy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    zz = Dkzz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    xy = Dkxy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)

    xx_table = xx.table(ky, kz, N)
    yy_table = yy.table(ky, kz, N)
    zz_table0 = zz.table(10**-6, 10**-6, N)
    xy_table = xy.table(ky, kz, N)

    Atemp = np.zeros((N, N), dtype=np.complex)
    Btemp = np.zeros((N, N), dtype=np.complex)
    Atemp += np.diag([h + S * np.sum(zz_table0[i:i + N]) for i in range(N)])
    Atemp += np.diag(
        np.ones(N) * S * J * (6 - 2 * np.cos(ky * a) - 2 * np.cos(kz * a)))
    Atemp[0, 0] -= S * J
    Atemp[N - 1, N - 1] -= S * J
    Atemp += np.diag(np.ones(N - 1), -1) * -J * S
    Atemp += np.diag(np.ones(N - 1), 1) * -J * S
    for i in range(N):
        Atemp[i, :] -= .5 * S * np.flip(xx_table[i:i + N] + yy_table[i:i + N])
        Btemp[i, :] -= .5 * S * np.flip(xx_table[i:i + N] - 2j *
                                        xy_table[i:i + N] - yy_table[i:i + N])
    return Atemp, Btemp
コード例 #3
0
def AkBkAngle(ky,
              kz,
              phi,
              alpha,
              N=None,
              J=None,
              S=None,
              h=None,
              eps=None,
              a=None,
              mu=None,
              Nr=4,
              Ng=4):
    xx = Dkxx(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    yy = Dkyy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    zz = Dkzz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    xy = Dkxy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    xz = Dkxz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    yz = Dkyz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)

    zz_table0 = zz.table(10**-6, 10**-6, N)
    xx_table0 = xx.table(10**-6, 10**-6, N)
    xz_table0 = xz.table(10**-6, 10**-6, N)

    xx_table = xx.table(ky, kz, N)
    yy_table = yy.table(ky, kz, N)
    xy_table = xy.table(ky, kz, N)
    zz_table = zz.table(ky, kz, N)
    xz_table = xz.table(ky, kz, N)
    yz_table = yz.table(ky, kz, N)

    Atemp = np.zeros((N, N), dtype=np.complex)
    Btemp = np.zeros((N, N), dtype=np.complex)

    Atemp += np.diag([
        h * np.cos(phi - alpha) + S *
        np.sum(zz_table0[i:i + N] * np.cos(phi)**2 + xx_table0[i:i + N] *
               np.sin(phi)**2 + xz_table0[i:i + N] * np.sin(phi) * np.cos(phi))
        for i in range(N)
    ])

    Atemp += np.diag(
        np.ones(N) * S * J * (6 - 2 * np.cos(ky * a) - 2 * np.cos(kz * a)))
    Atemp[0, 0] -= S * J
    Atemp[N - 1, N - 1] -= S * J
    Atemp += np.diag(np.ones(N - 1), -1) * -J * S
    Atemp += np.diag(np.ones(N - 1), 1) * -J * S

    for i in range(N):
        Atemp[i, :] -= np.flip(
            S / 2 * (xx_table[i:i + N] * np.cos(phi)**2 + yy_table[i:i + N] +
                     zz_table[i:i + N] * np.sin(phi)**2) -
            2 * xz_table[i:i + N] * np.sin(phi) * np.cos(phi))
        Btemp[i, :] -= 0.5 * S * np.flip(
            xx_table[i:i + N] * np.cos(phi)**2 - yy_table[i:i + N] +
            zz_table[i:i + N] * np.sin(phi)**2 - 2 * xz_table[i:i + N] *
            np.sin(phi) * np.cos(phi) + 2j * xy_table[i:i + N] * np.cos(phi) -
            2j * yz_table[i:i + N] * np.sin(phi))
    return Atemp, Btemp
コード例 #4
0
def AkBkAngleExplicit(ky,
                      kz,
                      phi,
                      alpha,
                      N=None,
                      J=None,
                      S=None,
                      h=None,
                      eps=None,
                      a=None,
                      mu=None,
                      Nr=4,
                      Ng=4):
    xx = Dkxx(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    yy = Dkyy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    zz = Dkzz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    xy = Dkxy(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    xz = Dkxz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)
    yz = Dkyz(eps=eps, a=a, mu=mu, Nr=Nr, Ng=Ng)

    zz_table0 = zz.table(10**-6, 10**-6, N)
    xx_table0 = xx.table(10**-6, 10**-6, N)
    xz_table0 = xz.table(10**-6, 10**-6, N)

    xx_table = xx.table(ky, kz, N)
    yy_table = yy.table(ky, kz, N)
    xy_table = xy.table(ky, kz, N)
    zz_table = zz.table(ky, kz, N)
    xz_table = xz.table(ky, kz, N)
    yz_table = yz.table(ky, kz, N)

    A = np.zeros((N, N), dtype=np.complex)
    B = np.zeros((N, N), dtype=np.complex)

    for i in range(N):
        for j in range(N):
            if i == j:
                A[i, j] = h * np.cos(phi - alpha) + S * np.sum(
                    zz_table0[i:i + N] * np.cos(phi)**2 +
                    xx_table0[i:i + N] * np.sin(phi)**2 +
                    xz_table0[i:i + N] * np.sin(phi) * np.cos(phi))
            A[i, j] += S * Jk(i, j, ky, kz, N=N, a=a, J=J)
            A[i,
              j] -= (S / 2 * (xx_table[i - j + N - 1] * np.cos(phi)**2 +
                              yy_table[i - j + N - 1] +
                              zz_table[i - j + N - 1] * np.sin(phi)**2) -
                     2 * xz_table[i - j + N - 1] * np.sin(phi) * np.cos(phi))

            B[i, j] = -0.5 * S * (
                xx_table[i - j + N - 1] * np.cos(phi)**2 -
                yy_table[i - j + N - 1] +
                zz_table[i - j + N - 1] * np.sin(phi)**2 -
                2 * xz_table[i - j + N - 1] * np.sin(phi) * np.cos(phi) +
                2j * xy_table[i - j + N - 1] * np.cos(phi) -
                2j * yz_table[i - j + N - 1] * np.sin(phi))
    return A, B
コード例 #5
0
def spin_momentum_nonlinear(ev, ky, kz, N, a=None, mu=None, S=None):
    ev_HP = ev_in_HP_basis(ev)
    ev_S = ev_HP_to_S(ev_HP, S=S)

    eps = a**(-2)

    xx = Dkxx(eps=eps, a=a, mu=mu).table(ky, kz, N)
    yy = Dkyy(eps=eps, a=a, mu=mu).table(ky, kz, N)
    zz = Dkzz(eps=eps, a=a, mu=mu).table(ky, kz, N)
    xy = Dkxy(eps=eps, a=a, mu=mu).table(ky, kz, N)
    xz = Dkxz(eps=eps, a=a, mu=mu).table(ky, kz, N)
    yz = Dkyz(eps=eps, a=a, mu=mu).table(ky, kz, N)

    res = []  # first calculate per x_i point
    for i in range(N):
        Si = ev_S[:, i]
        temp_res = []
        for j in range(N):
            # delta = i - j + N - 1
            if i != j:
                continue
            Sj = ev_S[:, j]
            Sx = Sj[0]
            Sy = Sj[1]
            Sz = Sj[2]
            x = Sx * xx[i - j + N - 1] + Sy * xy[i - j + N -
                                                 1] + Sz * xz[i - j + N - 1]
            y = Sy * yy[i - j + N - 1] + Sz * yz[i - j + N -
                                                 1] + Sx * xy[i - j + N - 1]
            z = Sz * zz[i - j + N - 1] + Sy * yz[i - j + N -
                                                 1] + Sx * xz[i - j + N - 1]
            G = np.stack((x, y, z))
            temp_res.append(np.cross(G, Si))
        temp_res = np.array(temp_res)
        res.append(np.sum(temp_res, axis=0))
    res = np.array(res)
    return res
コード例 #6
0
def Dkzz_uni(ky, kz, x, theta=None, mu=None, a=None):
    if x == 0:
        return Dkzz(eps=a**(-2), a=a, mu=mu).run(0, ky, kz)
    return -1 * np.cos(theta)**2 * Dkxx_uni(ky, kz, x, mu=mu, a=a)
コード例 #7
0
ファイル: test_sums.py プロジェクト: pgunnink/magnons-python
from magnons.dipolar_sums import Dkxx, Dkzz, Dkxy
import numpy as np
import matplotlib.pyplot as plt
from magnons.yig import a, S, mu, J

if __name__ == '__main__':
    eps = a**(-2)
    for NN in [1, 2, 3, 4]:
        xx = Dkzz(eps=eps, a=a, mu=mu, Nr=NN, Ng=NN)
        plt.plot(np.real(xx.table(10**5, 10**5, 400)), label=NN)
    plt.legend()
    plt.show()
コード例 #8
0
def spin_momentum_linear_old(ev,
                             ky,
                             kz,
                             N,
                             phi=None,
                             a=None,
                             mu=None,
                             S=None,
                             J=None,
                             h=None,
                             alpha=None):
    ev = ev_in_HP_basis(ev)
    sqrS = .5 * np.sqrt(2 * S)
    eps = a**(-2)

    xx = Dkxx(eps=eps, a=a, mu=mu).table(ky, kz, N)
    yy = Dkyy(eps=eps, a=a, mu=mu).table(ky, kz, N)
    zz = Dkzz(eps=eps, a=a, mu=mu).table(ky, kz, N)
    xy = Dkxy(eps=eps, a=a, mu=mu).table(ky, kz, N)
    xz = Dkxz(eps=eps, a=a, mu=mu).table(ky, kz, N)
    yz = Dkyz(eps=eps, a=a, mu=mu).table(ky, kz, N)
    zz0 = Dkzz(eps=eps, a=a, mu=mu).table(10**(-10), 10**(-10), N)
    Q = np.sin(phi)
    C = np.cos(phi)
    res = []  # first calculate per x_i point
    for i in range(N):
        bi = ev[i]
        temp_res = []
        for j in range(N):
            # delta = i - j + N - 1
            if i != j:
                continue
            bj = ev[j]
            x = 0
            z = 0
            d = i - j + N - 1

            SxSx = S**2 * Q**2 + 2 * sqrS * S * C * Q * (bj + bj.conj())
            SxSy = -1j * sqrS * S * (bj - bj.conj()) * Q
            SxSz = sqrS * S * (bj + bj.conj()) * (C**2 - Q**2) + S**2 * Q * C
            SySy = 0
            SySz = -1j * sqrS * S * (bj - bj.conj()) * C
            SzSz = S**2 * C**2 - 2 * sqrS * S * C * Q * (bj + bj.conj())
            sum_z0 = 0
            for n in range(N):
                sum_z0 += zz0[i - n + N - 1]

            # y = SxSx * xz[d] + SxSy * yz[d] + SxSz * zz[d]
            y = SxSx * xz[d] + SxSy * yz[d] + SxSz * sum_z0
            y -= SxSz * xx[d] + SySz * xy[d] + SzSz * xz[d]

            # y = sqrS * 2 * S * ((xx[d] - np.sum(zz0[i:i + N])) *
            #                     (bi + bi.conj()) + 1j * xy[d] *
            #                     (bi - bi.conj()))
            J0 = S * J * (6 - 2 * (np.cos(ky * a) + np.cos(kz * a)))
            if i == 0:
                J0 -= S * J
            if i == N - 1:
                J0 -= S * J
            # y += J0 * sqrS * (bi + bi.conj()) + h
            temp_res.append([x, y, z])
        temp_res = np.array(temp_res)
        res.append(np.sum(temp_res, axis=0))
    res = np.array(res)
    return res
コード例 #9
0
def spin_momentum_linear(ev,
                         ky,
                         kz,
                         N,
                         phi=None,
                         a=None,
                         mu=None,
                         S=None,
                         J=None,
                         h=None,
                         alpha=None):
    ev = ev_in_HP_basis(ev)
    eps = a**(-2)
    xx = Dkxx(eps=eps, a=a, mu=mu)
    yy = Dkyy(eps=eps, a=a, mu=mu)
    zz = Dkzz(eps=eps, a=a, mu=mu)
    xy = Dkxy(eps=eps, a=a, mu=mu)
    xz = Dkxz(eps=eps, a=a, mu=mu)
    yz = Dkyz(eps=eps, a=a, mu=mu)

    zz_table0 = zz.table(np.finfo('float64').eps, np.finfo('float64').eps, N)
    xx_table0 = xx.table(np.finfo('float64').eps, np.finfo('float64').eps, N)
    xz_table0 = xz.table(np.finfo('float64').eps, np.finfo('float64').eps, N)

    xx_table = xx.table(ky, kz, N)
    yy_table = yy.table(ky, kz, N)
    xy_table = xy.table(ky, kz, N)
    zz_table = zz.table(ky, kz, N)
    xz_table = xz.table(ky, kz, N)
    yz_table = yz.table(ky, kz, N)
    temp = []
    for i in range(N):
        bi = ev[i]
        dt_bi = []
        for j in range(N):
            A = 0
            if i != j:
                continue
            if i == j:
                A += h * np.cos(phi - alpha) + S * np.sum(
                    zz_table0[i:i + N] * np.cos(phi)**2 +
                    xx_table0[i:i + N] * np.sin(phi)**2 +
                    xz_table0[i:i + N] * np.sin(phi) * np.cos(phi))
            A += S * Jk(i, j, ky, kz, N=N, a=a, J=J)
            A -= (S / 2 * (xx_table[i - j + N - 1] * np.cos(phi)**2 +
                           yy_table[i - j + N - 1] +
                           zz_table[i - j + N - 1] * np.sin(phi)**2) -
                  2 * xz_table[i - j + N - 1] * np.sin(phi) * np.cos(phi))

            B = -0.5 * S * (xx_table[i - j + N - 1] * np.cos(phi)**2 -
                            yy_table[i - j + N - 1] +
                            zz_table[i - j + N - 1] * np.sin(phi)**2 - 2 *
                            xz_table[i - j + N - 1] * np.sin(phi) * np.cos(phi)
                            + 2j * xy_table[i - j + N - 1] * np.cos(phi) -
                            2j * yz_table[i - j + N - 1] * np.sin(phi))

            dt_bi.append(-1j * (bi * A + bi.conj() * B.conj()))
        dt_bi = np.array(dt_bi)
        y = -1j / 2 * (dt_bi.sum() - dt_bi.sum().conj())
        x = 1 / 2 * (dt_bi.sum() + dt_bi.sum().conj())
        z = -dt_bi.sum() * dt_bi.sum().conj()
        temp.append([x, y, z])
    temp = np.array(temp)
    return temp