Esempio n. 1
0
def get_hopping_coulomb():
    N_site = 16
    norbs = 32
    U, t = 4.0, -1.0

    umat = np.zeros((norbs, norbs, norbs, norbs), dtype=np.complex128)
    for i in range(N_site):
        off = i * 2
        umat[off, off + 1, off + 1, off] = U

    hopp = np.zeros((N_site, N_site), dtype=np.complex128)
    indx = [[3, 1, 12, 4], [0, 2, 13, 5], [1, 3, 14, 6], [2, 0, 15, 7],
            [7, 5, 0, 8], [4, 6, 1, 9], [5, 7, 2, 10], [6, 4, 3, 11],
            [11, 9, 4, 12], [8, 10, 5, 13], [9, 11, 6, 14], [10, 8, 7, 15],
            [15, 13, 8, 0], [
                12,
                14,
                9,
                1,
            ], [13, 15, 10, 2], [14, 12, 11, 3]]

    for i, item in enumerate(indx):
        hopp[i, item[0]] = hopp[i, item[1]] = hopp[i,
                                                   item[2]] = hopp[i,
                                                                   item[3]] = t
    hopping = np.zeros((norbs, norbs), dtype=np.complex128)
    hopping[0:norbs:2, 0:norbs:2] = hopp
    hopping[1:norbs:2, 1:norbs:2] = hopp

    edrixs.write_emat(hopping, "hopping_i.in", 1E-10)
    edrixs.write_umat(umat, "coulomb_i.in", 1E-10)
def get_transop(loc, pos):
    # get dipole transition operator in local axis
    dop = edrixs.get_trans_oper('t2gp32')
    dop_g = np.zeros((2, 3, 6, 4), dtype=np.complex)
    # transform to golobal axis
    for i in range(2):
        for j in range(3):
            for k in range(3):
                dop_g[i, j] += loc[i, j, k] * dop[k]

    # RIXS settings
    thin, thout, phi = 30 / 180.0 * np.pi, 60 / 180.0 * np.pi, 0.0
    ein, eout = 11215.0, 11215.0  # eV
    # Wavevector
    kin, kout = edrixs.get_wavevector_rixs(thin, thout, phi, ein, eout)
    # polarization pi-pi and pi-sigma
    for key, alpha, beta in [('pp', 0, 0), ('ps', 0, np.pi / 2.0)]:
        ei, ef = edrixs.dipole_polvec_rixs(thin, thout, phi, alpha, beta)
        T_i = np.zeros((2, 6, 4), dtype=np.complex)
        T_f = np.zeros((2, 4, 6), dtype=np.complex)
        for i in range(2):
            for j in range(3):
                T_i[i] += dop_g[i, j] * ei[j]
                T_f[i] += np.conj(np.transpose(dop_g[i, j] * ef[j]))
            # multiply phase factor
            T_i[i] = T_i[i] * np.exp(+1j * np.dot(pos[i], kin))
            T_f[i] = T_f[i] * np.exp(-1j * np.dot(pos[i], kout))

        transop_rixs_i = np.zeros((20, 20), dtype=np.complex)
        transop_rixs_f = np.zeros((20, 20), dtype=np.complex)
        for i in range(2):
            off1, off2 = i * 6, 12 + i * 4
            transop_rixs_i[off1:off1 + 6, off2:off2 + 4] = T_i[i]
            transop_rixs_f[off2:off2 + 4, off1:off1 + 6] = T_f[i]
        # write to file
        edrixs.write_emat(transop_rixs_i, "rixs_" + key + "/transop_rixs_i.in")
        edrixs.write_emat(transop_rixs_f, "rixs_" + key + "/transop_rixs_f.in")

    # For XAS, use isotropic polarization
    ei = np.array([1, 1, 1]) / np.sqrt(3.0)
    T_i = np.zeros((2, 6, 4), dtype=np.complex)
    for i in range(2):
        for j in range(3):
            T_i[i] += dop_g[i, j] * ei[j]

    transop_xas = np.zeros((20, 20), dtype=np.complex128)
    for i in range(2):
        off1, off2 = i * 6, 12 + i * 4
        transop_xas[off1:off1 + 6, off2:off2 + 4] = T_i[i]
    edrixs.write_emat(transop_xas, "xas/transop_xas.in")
Esempio n. 3
0
def get_transop(loc, pos):
    dop = edrixs.get_trans_oper('t2gp')
    dop_g = np.zeros((2, 3, 6, 6), dtype=np.complex)
    for i in range(2):
        dop_g[i, 0] = loc[i, 0, 0] * dop[0] + loc[i, 0, 1] * dop[1] + loc[
            i, 0, 2] * dop[2]
        dop_g[i, 1] = loc[i, 1, 0] * dop[0] + loc[i, 1, 1] * dop[1] + loc[
            i, 1, 2] * dop[2]
        dop_g[i, 2] = loc[i, 2, 0] * dop[0] + loc[i, 2, 1] * dop[1] + loc[
            i, 2, 2] * dop[2]

    # for RIXS
    thin, thout, phi = 30 / 180.0 * np.pi, 60 / 180.0 * np.pi, 0.0
    ein, eout = 11215.0, 11215.0  # eV
    kin, kout = edrixs.get_wavevector_rixs(thin, thout, phi, ein, eout)
    # polarization pi-pi and pi-sigma
    for key, alpha, beta in [('pp', 0, 0), ('ps', 0, np.pi)]:
        ei, ef = edrixs.dipole_polvec_rixs(thin, thout, phi, alpha, beta)
        T_i = np.zeros((2, 6, 6), dtype=np.complex)
        T_o = np.zeros((2, 6, 6), dtype=np.complex)
        for i in range(2):
            T_i[i] = (dop_g[i, 0] * ei[0] + dop_g[i, 1] * ei[1] +
                      dop_g[i, 2] * ei[2]) * np.exp(1j * np.dot(pos[i], kin))
            T_o[i] = np.exp(-1j * np.dot(pos[i], kout)) * np.conj(
                np.transpose(dop_g[i, 0] * ef[0] + dop_g[i, 1] * ef[1] +
                             dop_g[i, 2] * ef[2]))
        transop_rixs_i = np.zeros((24, 24), dtype=np.complex)
        transop_rixs_f = np.zeros((24, 24), dtype=np.complex)
        for i in range(2):
            off1, off2 = i * 6, 12 + i * 6
            transop_rixs_i[off1:off1 + 6, off2:off2 + 6] = T_i[i]
            transop_rixs_f[off2:off2 + 6, off1:off1 + 6] = T_o[i]
        edrixs.write_emat(transop_rixs_i, "rixs_" + key + "/transop_rixs_i.in")
        edrixs.write_emat(transop_rixs_f, "rixs_" + key + "/transop_rixs_f.in")

    # For XAS
    ei = np.array([1, 1, 1]) / np.sqrt(3.0)
    T_i = np.zeros((2, 6, 6), dtype=np.complex)
    for i in range(2):
        T_i[i] = dop_g[i, 0] * ei[0] + dop_g[i, 1] * ei[1] + dop_g[i,
                                                                   2] * ei[2]
    transop_xas = np.zeros((24, 24), dtype=np.complex128)
    for i in range(2):
        off1, off2 = i * 6, 12 + i * 6
        transop_xas[off1:off1 + 6, off2:off2 + 6] = T_i[i]
    edrixs.write_emat(transop_xas, "xas/transop_xas.in")
Esempio n. 4
0
def get_transop():
    tmp = edrixs.get_trans_oper('t2gp')
    dipole = np.zeros((3, 28, 28), dtype=np.complex)
    for i in range(3):
        tmp[i] = edrixs.cb_op2(tmp[i], edrixs.tmat_c2j(1), edrixs.tmat_c2j(1))
        dipole[i, 0:6, 24:28] = tmp[i, 0:6, 2:6]

    # for RIXS
    thin, thout, phi = 45 / 180.0 * np.pi, 45 / 180.0 * np.pi, 0.0
    # polarization pi-pi and pi-sigma
    for key, alpha, beta in [('pp', 0, 0), ('ps', 0, np.pi)]:
        ei, ef = edrixs.dipole_polvec_rixs(thin, thout, phi, alpha, beta)
        transop_rixs_i = dipole[0] * ei[0] + dipole[1] * ei[1] + dipole[
            2] * ei[2]
        transop_rixs_f = np.conj(
            np.transpose(dipole[0] * ef[0] + dipole[1] * ef[1] +
                         dipole[2] * ef[2]))
        edrixs.write_emat(transop_rixs_i, "rixs_" + key + "/transop_rixs_i.in")
        edrixs.write_emat(transop_rixs_f, "rixs_" + key + "/transop_rixs_f.in")

    # For XAS
    ei = np.array([1, 1, 1]) / np.sqrt(3.0)
    transop_xas = dipole[0] * ei[0] + dipole[1] * ei[1] + dipole[2] * ei[2]
    edrixs.write_emat(transop_xas, "xas/transop_xas.in")
Esempio n. 5
0
def get_hopping_coulomb(locaxis):
    # Number of orbitals
    nt2g, nporb, norbs = 6, 6, 24

    # On-site Coulomb interaction tensor
    Ud, JH = edrixs.UJ_to_UdJH(2, 0.3)
    F0_d, F2_d, F4_d = edrixs.UdJH_to_F0F2F4(Ud, JH)

    G1_dp, G3_dp = 0.957, 0.569
    F0_dp, F2_dp = edrixs.get_F0('dp', G1_dp, G3_dp), 1.107

    umat_t2g_i = edrixs.get_umat_slater('t2g', F0_d, F2_d, F4_d)

    params = [
        F0_d,
        F2_d,
        F4_d,  # Fk for d
        F0_dp,
        F2_dp,  # Fk for dp
        G1_dp,
        G3_dp,  # Gk for dp
        0.0,
        0.0  # Fk for p
    ]
    umat_t2gp_n = edrixs.get_umat_slater('t2gp', *params)

    # static core-hole potential
    static_v = 2.0
    for i in range(0, nt2g):
        for j in range(nt2g, nt2g + nporb):
            umat_t2gp_n[i, j, j, i] += static_v

    umat_i = np.zeros((norbs, norbs, norbs, norbs), dtype=np.complex128)
    umat_n = np.zeros((norbs, norbs, norbs, norbs), dtype=np.complex128)

    umat_i[0:6, 0:6, 0:6, 0:6] = umat_t2g_i
    umat_i[6:12, 6:12, 6:12, 6:12] = umat_t2g_i

    indx = np.array([[0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16, 17],
                     [6, 7, 8, 9, 10, 11, 18, 19, 20, 21, 22, 23]])
    for m in range(2):
        for i in range(12):
            for j in range(12):
                for k in range(12):
                    for l in range(12):
                        umat_n[indx[m, i], indx[m, j], indx[m, k],
                               indx[m, l]] += umat_t2gp_n[i, j, k, l]

    emat_i = np.zeros((norbs, norbs), dtype=np.complex128)
    emat_n = np.zeros((norbs, norbs), dtype=np.complex128)

    # SOC
    zeta_d_i, zeta_p_n = 0.35, 1072.6666666666667
    soc_d = edrixs.atom_hsoc('t2g', zeta_d_i)
    soc_p = edrixs.atom_hsoc('p', zeta_p_n)

    emat_i[0:6, 0:6] += soc_d
    emat_i[6:12, 6:12] += soc_d

    emat_n[0:6, 0:6] += soc_d
    emat_n[6:12, 6:12] += soc_d

    emat_n[12:18, 12:18] += soc_p
    emat_n[18:24, 18:24] += soc_p
    for i in range(2 * nt2g):
        emat_n[i, i] -= 6 * static_v

    # Crystal field and hoppings between the two Ir-sites
    t1, t2, delta = -0.18, 0.036, -0.03
    # Uncomment the following line to do calculation without hopping and crystal filed splitting.
    # t1, t2, delta = 0, 0, -0.03
    crys_tmp = np.array(
        [[0, delta, delta, t1, t2, t1], [delta, 0, delta, t2, t1, t1],
         [delta, delta, 0, t1, t1, t2], [t1, t2, t1, 0, delta, delta],
         [t2, t1, t1, delta, 0, delta], [t1, t1, t2, delta, delta, 0]],
        dtype=np.complex)

    # transform spin to local axis
    dmat = np.zeros((2, 2, 2), dtype=np.complex128)
    ang1, ang2, ang3 = edrixs.rmat_to_euler(locaxis[0])
    dmat[0] = edrixs.dmat_spinor(ang1, ang2, ang3)
    ang1, ang2, ang3 = edrixs.rmat_to_euler(locaxis[1])
    dmat[1] = edrixs.dmat_spinor(ang1, ang2, ang3)

    t_spinor = np.zeros((12, 12), dtype=np.complex128)
    for i in range(2):
        off = i * 6
        t_spinor[off + 0:off + 2, off + 0:off + 2] = dmat[i]
        t_spinor[off + 2:off + 4, off + 2:off + 4] = dmat[i]
        t_spinor[off + 4:off + 6, off + 4:off + 6] = dmat[i]

    crys_spin = np.zeros((12, 12), dtype=np.complex128)
    crys_spin[0:12:2, 0:12:2] = crys_tmp
    crys_spin[1:12:2, 1:12:2] = crys_tmp
    t_orb = np.zeros((12, 12), dtype=np.complex128)
    t_orb[0:6, 0:6] = edrixs.tmat_r2c('t2g', True)
    t_orb[6:12, 6:12] = edrixs.tmat_r2c('t2g', True)
    crys_spin[:, :] = edrixs.cb_op(crys_spin, np.dot(t_spinor, t_orb))

    emat_i[0:12, 0:12] += crys_spin
    emat_n[0:12, 0:12] += crys_spin

    # Write to files
    # ED inputs
    edrixs.write_emat(emat_i, "ed/hopping_i.in")
    edrixs.write_umat(umat_i, "ed/coulomb_i.in")

    # XAS inputs
    edrixs.write_emat(emat_n, "xas/hopping_n.in")
    edrixs.write_umat(umat_n, "xas/coulomb_n.in")

    # RIXS inputs
    edrixs.write_emat(emat_i, "rixs_pp/hopping_i.in")
    edrixs.write_umat(umat_i, "rixs_pp/coulomb_i.in")
    edrixs.write_emat(emat_n, "rixs_pp/hopping_n.in")
    edrixs.write_umat(umat_n, "rixs_pp/coulomb_n.in")

    edrixs.write_emat(emat_i, "rixs_ps/hopping_i.in")
    edrixs.write_umat(umat_i, "rixs_ps/coulomb_i.in")
    edrixs.write_emat(emat_n, "rixs_ps/hopping_n.in")
    edrixs.write_umat(umat_n, "rixs_ps/coulomb_n.in")
Esempio n. 6
0
def get_hopping_coulomb():
    norbs = 28

    Ud, JH = edrixs.UJ_to_UdJH(6, 0.45)
    F0_d, F2_d, F4_d = edrixs.UdJH_to_F0F2F4(Ud, JH)

    scale_dp = 0.9
    G1_dp, G3_dp = 0.894 * scale_dp, 0.531 * scale_dp
    F2_dp = 1.036 * scale_dp
    Udp_av = 0.0
    F0_dp = Udp_av + edrixs.get_F0('dp', G1_dp, G3_dp)

    params = [F0_d, F2_d, F4_d]
    umat_i = edrixs.get_umat_slater('t2g', *params)

    params = [F0_d, F2_d, F4_d, F0_dp, F2_dp, G1_dp, G3_dp, 0.0, 0.0]

    umat_tmp = edrixs.get_umat_slater('t2gp', *params)
    tmat = np.zeros((12, 12), dtype=np.complex128)
    tmat[0:6, 0:6] = edrixs.tmat_c2j(1)
    tmat[6:12, 6:12] = edrixs.tmat_c2j(1)
    umat_i[:, :, :, :] = edrixs.transform_utensor(umat_i, edrixs.tmat_c2j(1))

    umat_tmp[:, :, :, :] = edrixs.transform_utensor(umat_tmp, tmat)
    id1 = [0, 1, 2, 3, 4, 5, 8, 9, 10, 11]
    id2 = [0, 1, 2, 3, 4, 5, 24, 25, 26, 27]
    umat_n = np.zeros((norbs, norbs, norbs, norbs), dtype=np.complex)
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for ll in range(10):
                    umat_n[id2[i], id2[j], id2[k],
                           id2[ll]] = umat_tmp[id1[i], id1[j], id1[k], id1[ll]]

    emat_i = np.zeros((norbs, norbs), dtype=np.complex128)
    emat_n = np.zeros((norbs, norbs), dtype=np.complex128)
    # bath energy level & hybridization strength
    N_site = 3
    data = np.loadtxt('bath_sites.in')
    e1, v1 = data[:, 0], data[:, 1]
    e2, v2 = data[:, 2], data[:, 3]

    h = np.zeros((24, 24), dtype=np.complex)
    h[0, 0] = h[1, 1] = -14.7627972353
    h[2, 2] = h[3, 3] = h[4, 4] = h[5, 5] = -15.4689430453
    for i in range(N_site):
        o = 6 + 6 * i
        # orbital j=1/2
        h[o + 0, o + 0] = h[o + 1, o + 1] = e1[i]
        h[0, o + 0] = h[1, o + 1] = h[o + 0, 0] = h[o + 1, 1] = v1[i]
        # orbital j=3/2
        h[o + 2, o + 2] = h[o + 3, o + 3] = h[o + 4, o + 4] = h[o + 5,
                                                                o + 5] = e2[i]
        h[2, o + 2] = h[3, o + 3] = h[4, o + 4] = h[5, o + 5] = v2[i]
        h[o + 2, 2] = h[o + 3, 3] = h[o + 4, 4] = h[o + 5, 5] = v2[i]

    emat_i[0:24, 0:24] += h
    emat_n[0:24, 0:24] += h

    # static core-hole potential
    static_V = 2.0
    for i in range(6):
        emat_n[i, i] -= static_V

    # Write to files
    # Search GS inputs
    edrixs.write_emat(emat_i, "search_gs/hopping_i.in")
    edrixs.write_umat(umat_i, "search_gs/coulomb_i.in")

    # ED inputs
    edrixs.write_emat(emat_i, "ed/hopping_i.in")
    edrixs.write_umat(umat_i, "ed/coulomb_i.in")

    # XAS inputs
    edrixs.write_emat(emat_n, "xas/hopping_n.in")
    edrixs.write_umat(umat_n, "xas/coulomb_n.in")

    # RIXS inputs
    edrixs.write_emat(emat_i, "rixs_pp/hopping_i.in")
    edrixs.write_umat(umat_i, "rixs_pp/coulomb_i.in")
    edrixs.write_emat(emat_n, "rixs_pp/hopping_n.in")
    edrixs.write_umat(umat_n, "rixs_pp/coulomb_n.in")

    edrixs.write_emat(emat_i, "rixs_ps/hopping_i.in")
    edrixs.write_umat(umat_i, "rixs_ps/coulomb_i.in")
    edrixs.write_emat(emat_n, "rixs_ps/hopping_n.in")
    edrixs.write_umat(umat_n, "rixs_ps/coulomb_n.in")
    params = [F0_f, F2_f, F4_f, F6_f]
    umat_i = edrixs.get_umat_slater('f', *params)
    # SOC strength
    zeta_f_i = 0.261 * 0.9
    hsoc_i = edrixs.atom_hsoc('f', zeta_f_i)

    # prepare files for ed.x
    # write control parameters to file
    edrixs.write_config(ed_solver=2,
                        num_val_orbs=norbs,
                        neval=100,
                        ncv=200,
                        nvector=1,
                        idump=True)
    # write nonzeros terms of two-fermion terms hsoc_i to file 'hopping_i.in', read by ed.x
    edrixs.write_emat(hsoc_i, 'hopping_i.in', 1E-10)
    # write nonzeros terms of four-fermion terms umat to file 'coulomb_i.in', read by ed.x
    edrixs.write_umat(umat_i, 'coulomb_i.in', 1E-10)
    # write fock basis of decimal format to file 'fock_i.in', read by ed.x
    edrixs.write_fock_dec_by_N(norbs, noccu, "fock_i.in")

    # we also use pure Python ED solver to get the eigenvalues
    print("edrixs >>> building Fock basis ...")
    basis_i = edrixs.get_fock_bin_by_N(norbs, noccu)
    print("edrixs >>> Done!")

    print("edrixs >>> building Hamiltonian ...")
    H = edrixs.build_opers(2, hsoc_i, basis_i)
    H += edrixs.build_opers(4, umat_i, basis_i)
    print("edrixs >>> Done!")
def get_hopping_coulomb(locaxis):
    # Number of orbitals for each site
    ndorb, nporb = 6, 4
    # Number of sites
    nsite = 2
    # Total number of orbitals
    ntot = nsite * (ndorb + nporb)
    # orbital orders:
    # 0-5:    1st-site-t2g
    # 6-11:   2nd-site-t2g
    # 12-15:  1st-site-2p
    # 16-19:  2nd-site-2p

    # On-site Coulomb interaction tensor
    U, J = 2.0, 0.3
    Ud, JH = edrixs.UJ_to_UdJH(U, J)
    F0_dd, F2_dd, F4_dd = edrixs.UdJH_to_F0F2F4(Ud, JH)  # k=0, 2, 2*l

    G1_dp, G3_dp = 0.957, 0.569  # k=|2-1|, |2+1|
    F0_dp, F2_dp = edrixs.get_F0('dp', G1_dp,
                                 G3_dp), 1.107  # k=0, min(2*2, 2*1)

    # just one site t2g-subspace
    umat_tmp_i = edrixs.get_umat_slater('t2g', F0_dd, F2_dd, F4_dd)

    params = [
        F0_dd,
        F2_dd,
        F4_dd,  # FX for dd
        F0_dp,
        F2_dp,  # FX for dp
        G1_dp,
        G3_dp,  # GX for dp
        0,
        0  # FX for pp
    ]
    # just one site
    umat_tmp_n = edrixs.get_umat_slater('t2gp32', *params)  # 2p_3/2 -> t2g

    # static core-hole potential
    static_v = 2.0
    for i in range(0, ndorb):
        for j in range(ndorb, ndorb + nporb):
            umat_tmp_n[i, j, j, i] += static_v

    # two sites as a whole
    umat_i = np.zeros((ntot, ntot, ntot, ntot), dtype=np.complex)
    umat_n = np.zeros((ntot, ntot, ntot, ntot), dtype=np.complex)

    umat_i[0:ndorb, 0:ndorb, 0:ndorb,
           0:ndorb] = umat_tmp_i  # 1st site 5d-valence
    umat_i[ndorb:2 * ndorb, ndorb:2 * ndorb, ndorb:2 * ndorb,
           ndorb:2 * ndorb] = umat_tmp_i  # 2nd site 5d-valence

    indx = np.array([
        [
            0,
            1,
            2,
            3,
            4,
            5,  # orbital indices for 1st site 5d-t2g
            12,
            13,
            14,
            15
        ],  # orbital indices for 1st site 2p-core
        [
            6,
            7,
            8,
            9,
            10,
            11,  # orbital indices for 2nd site 5d-t2g
            16,
            17,
            18,
            19
        ]  # orbital indices for 2nd site 2p-core
    ])
    # copy umat_tmp_n (one site) to umat_n (two sites)
    ndp = ndorb + nporb
    for m in range(nsite):
        for i in range(ndp):
            for j in range(ndp):
                for k in range(ndp):
                    for l in range(ndp):
                        umat_n[indx[m, i], indx[m, j], indx[m, k],
                               indx[m, l]] += umat_tmp_n[i, j, k, l]

    # two fermion terms, SOC, crystal field, and hopping between the two sites
    emat_i = np.zeros((ntot, ntot), dtype=np.complex)
    emat_n = np.zeros((ntot, ntot), dtype=np.complex)

    # SOC
    zeta_d_i = 0.35
    soc_d = edrixs.atom_hsoc('t2g', zeta_d_i)

    emat_i[0:ndorb, 0:ndorb] += soc_d
    emat_i[ndorb:2 * ndorb, ndorb:2 * ndorb] += soc_d

    emat_n[0:ndorb, 0:ndorb] += soc_d
    emat_n[ndorb:2 * ndorb, ndorb:2 * ndorb] += soc_d

    # Terms from static core-hole potential
    for i in range(2 * ndorb):
        emat_n[i, i] -= nporb * static_v

    # Crystal field and hoppings between the two Ir-sites
    d = -0.03  # trgional splitting in t2g-subspace

    # Uncomment the following line to do calculation without hopping and crystal filed splitting.
    t1, t2 = -0.18, 0.036  # hopping between the two-sites in t2g-subspace

    cf_tmp = np.array([  # dzx_1, dzy_1,  dxy_1,    dzx_2, dzy_2,  dxy_2
        [0, d, d, t1, t2, t1],  # dzx_1
        [d, 0, d, t2, t1, t1],  # dzy_1
        [d, d, 0, t1, t1, t2],  # dxy_1
        [t1, t2, t1, 0, d, d],  # dzx_2
        [t2, t1, t1, d, 0, d],  # dzy_2
        [t1, t1, t2, d, d, 0],  # dxy_2
    ])
    # Including spin degree of freedom, in global axis
    cf_spin = np.zeros((2 * ndorb, 2 * ndorb), dtype=np.complex)
    cf_spin[0:2 * ndorb:2, 0:2 * ndorb:2] = cf_tmp
    cf_spin[1:2 * ndorb:2, 1:2 * ndorb:2] = cf_tmp

    # Transform spin basis to local axis
    # 1/2-spinor matrix
    t_spinor = np.zeros((2 * ndorb, 2 * ndorb), dtype=np.complex128)
    for i in range(nsite):
        alpha, beta, gamma = edrixs.rmat_to_euler(locaxis[i])
        dmat = edrixs.dmat_spinor(alpha, beta, gamma)
        for j in range(ndorb // 2):
            off = i * ndorb + j * 2
            t_spinor[off:off + 2, off:off + 2] = dmat

    # Transform orbital basis from real cubic to complex harmonics
    t_orb = np.zeros((2 * ndorb, 2 * ndorb), dtype=np.complex128)
    t_orb[0:ndorb, 0:ndorb] = edrixs.tmat_r2c('t2g', True)
    t_orb[ndorb:2 * ndorb, ndorb:2 * ndorb] = edrixs.tmat_r2c('t2g', True)
    # Do the tranformation
    cf_spin[:, :] = edrixs.cb_op(cf_spin, np.dot(t_spinor, t_orb))

    emat_i[0:2 * ndorb, 0:2 * ndorb] += cf_spin
    emat_n[0:2 * ndorb, 0:2 * ndorb] += cf_spin

    # Write emat and umat to files
    # ED inputs
    edrixs.write_emat(emat_i, "ed/hopping_i.in")
    edrixs.write_umat(umat_i, "ed/coulomb_i.in")

    # XAS inputs
    edrixs.write_emat(emat_n, "xas/hopping_n.in")
    edrixs.write_umat(umat_n, "xas/coulomb_n.in")

    # RIXS inputs
    edrixs.write_emat(emat_i, "rixs_pp/hopping_i.in")
    edrixs.write_umat(umat_i, "rixs_pp/coulomb_i.in")
    edrixs.write_emat(emat_n, "rixs_pp/hopping_n.in")
    edrixs.write_umat(umat_n, "rixs_pp/coulomb_n.in")

    edrixs.write_emat(emat_i, "rixs_ps/hopping_i.in")
    edrixs.write_umat(umat_i, "rixs_ps/coulomb_i.in")
    edrixs.write_emat(emat_n, "rixs_ps/hopping_n.in")
    edrixs.write_umat(umat_n, "rixs_ps/coulomb_n.in")