def two_conn_max(k, q, band1, band2):

    qmk = q - k
    ek, tmp = GLSW.eigensystem(k)
    eqmk, tmp = GLSW.eigensystem(qmk)
    funval = -(ek[band1] + eqmk[band2])

    return funval
예제 #2
0
    def integrand_decay(ndim, xx, ncopm, ff, userdata):
        """
        Integrand passed to cuba.

        Parameters
        ----------
        ndim : int
            dimension of integration.
        xx : np.array((3, ))
            input momentum.
        ncopm : int
            number of components.
        ff : np.array()
            integrand.
        userdata : c-type
            I don't know how to use this for python. try to avoid it

        Returns
        -------
        int
            value not relevent unless -999, see mannual.

        """

        # integration variable: k
        k1, k2, k3 = [xx[i] for i in range(ndim.contents.value)]
        k = np.array([k1, k2, k3])
        qmk = q - k

        ek, ubov_k = GLSW.eigensystem(k)
        eqmk, ubov_qmk = GLSW.eigensystem(qmk)
        tmp, ubov_mk = GLSW.eigensystem(-k)
        tmp, ubov_mqmk = GLSW.eigensystem(-qmk)

        tmpmat1 = ek[:2 * num_sub][:, None]
        tmpmat2 = eqmk[:2 * num_sub][None, :]
        esum = tmpmat1 + tmpmat2
        #denomin = eq[:2*num_sub, None, None] - esum[None, :, :] + 1j*cgf

        denomin = eq[None, None, :2 * num_sub] - esum[:, :, None] + 1j * cgf

        #v_decay = vertex.V_cubic_decay(q, k, qmk, ubov_q, ubov_k, ubov_qmk, \
        #                               ubov_mq, ubov_mk, ubov_mqmk)

        v_decay = vertex.V_cubic_decay(k, qmk, q, ubov_k, ubov_qmk, ubov_q, \
                                       ubov_mk, ubov_mqmk, ubov_mq)
        Intmat = (v_decay.conj() * v_decay) / denomin
        # 0.5 is the symmetry factor, return to the "on-shell" self-energy
        # for all bands
        Intvec = 0.5 * Intmat.sum(axis=(0, 1))

        for band in range(2 * num_sub):
            ff[2 * band] = np.real(Intvec[band])
            ff[2 * band + 1] = np.imag(Intvec[band])

        return 0
    def integrand_barN_onsite(ndim, xx, comp, ff, userdata):

        k1, k2, k3 = [xx[i] for i in range(ndim.contents.value)]
        k = np.array([k1, k2, k3])
        tmp, ubov = GLSW.eigensystem(k)
        ubov11 = ubov[:2 * num_sub, :2 * num_sub]
        ubov21 = ubov[2 * num_sub:, :2 * num_sub]
        ubov11_c = ubov11.conj()
        ubov21_c = ubov21.conj()

        for sub_lat in range(num_sub):
            counter = 0

            for flavor1 in range(2):
                for flavor2 in range(2):

                    X1 = num_sub * flavor1 + sub_lat
                    X2 = num_sub * flavor2 + sub_lat

                    # integration of barN_onsite must be real, because
                    # it corresponds to local boson number reduction
                    barN_onsite = (ubov21[X1, :] * ubov21_c[X2, :]).sum()
                    ff[4 * sub_lat + counter] = np.real(barN_onsite)
                    counter += 1

        return 0
    def integrand_barDelta_onsite(ndim, xx, comp, ff, userdata):

        k1, k2, k3 = [xx[i] for i in range(ndim.contents.value)]
        k = np.array([k1, k2, k3])
        tmp, ubov = GLSW.eigensystem(k)
        ubov11 = ubov[:2 * num_sub, :2 * num_sub]
        ubov21 = ubov[2 * num_sub:, :2 * num_sub]
        ubov11_c = ubov11.conj()
        ubov21_c = ubov21.conj()

        for sub_lat in range(num_sub):
            counter = 0

            for flavor1 in range(2):
                for flavor2 in range(2):

                    X1 = num_sub * flavor1 + sub_lat
                    X2 = num_sub * flavor2 + sub_lat

                    # integration of Delta_onsite is real
                    # need to think about the reason
                    barDelta_onsite = (ubov21[X1, :] * ubov11_c[X2, :]).sum()
                    ff[4 * sub_lat + counter] = np.real(barDelta_onsite)
                    counter += 1

        return 0
    def integrand_N_onsite(ndim, xx, comp, ff, userdata):

        k1, k2, k3 = [xx[i] for i in range(ndim.contents.value)]
        k = np.array([k1, k2, k3])
        tmp, ubov = GLSW.eigensystem(k)
        ubov11 = ubov[:2 * num_sub, :2 * num_sub]
        ubov21 = ubov[2 * num_sub:, :2 * num_sub]
        ubov11_c = ubov11.conj()
        ubov21_c = ubov21.conj()

        for sub_lat in range(num_sub):
            counter = 0

            for flavor1 in range(2):
                for flavor2 in range(2):

                    X1 = num_sub * flavor1 + sub_lat
                    X2 = num_sub * flavor2 + sub_lat

                    # N_onsite is pure real, imaginary part zero
                    N_onsite = (ubov11[X1, :] * ubov11_c[X2, :]).sum()
                    ff[4 * sub_lat + counter] = np.real(N_onsite)
                    counter += 1

        return 0
    def integrand_N(ndim, xx, comp, ff, userdata):

        k1, k2, k3 = [xx[i] for i in range(ndim.contents.value)]
        k = np.array([k1, k2, k3])
        tmp, ubov = GLSW.eigensystem(k)
        ubov11 = ubov[:2 * num_sub, :2 * num_sub]
        ubov21 = ubov[2 * num_sub:, :2 * num_sub]
        ubov11_c = ubov11.conj()
        ubov21_c = ubov21.conj()

        for bond in range(num_bond):

            counter = 0

            bond_vec = delta_ij[:, bond]
            cphase = np.exp(-1j * 2.0 * np.pi * k @ bond_vec)
            sub1 = sub_idx[bond, 0]
            sub2 = sub_idx[bond, 1]

            for flavor1 in range(2):
                for flavor2 in range(2):

                    X1 = num_sub * flavor1 + sub1
                    X2 = num_sub * flavor2 + sub2

                    # N_onsite is pure real, imaginary part zero
                    N_ij = (ubov11[X1, :] * ubov11_c[X2, :] * cphase).sum()
                    ff[8 * bond + 2 * counter] = np.real(N_ij)
                    ff[8 * bond + 2 * counter + 1] = np.imag(N_ij)
                    counter += 1

        return 0
#import numpy.testing as npt
import GLSW
import GNLSW_vertex_new as vertex
import GNLSW_vertex as vertex_old
import cofig as cf
import time



num_sub = cf.num_sub

# the self energy input
omega = np.array([0.12, 0.22, 0.13])
# incoming particle
q = np.array([0.12, 0.53, 0.0])
eq, ubov_q = GLSW.eigensystem(q)
tmp, ubov_mq = GLSW.eigensystem(-q)
# intermediate particles
k = np.array([0.2, 0.1, 0.0])
qmk = q - k
ek, ubov_k = GLSW.eigensystem(k)
eqmk, ubov_qmk = GLSW.eigensystem(qmk)
tmp, ubov_mk = GLSW.eigensystem(-k)
tmp, ubov_mqmk = GLSW.eigensystem(-qmk)

# =============================================================================
# V2_old = vertex_old.V2_cubic_bm(1, 7, 6, q, k, qmk, \
#                              ubov_q, ubov_k, ubov_qmk, \
#                              ubov_mq, ubov_mk, ubov_mqmk)
# =============================================================================
import numpy as np
#import cofig as cf
import GLSW
import GNLSW_vertex_new as vertex
import GNLSW_vertex as vertex_old
from matplotlib import pyplot as plt

path_H = 0.5
path_K = 0.0

q = np.zeros((3))
q[0] = 4.0 * path_H + 2.0 * path_K
q[1] = path_K
q[2] = 0.5 * path_K - path_H

eq, ubov_q = GLSW.eigensystem(q)
tmp, ubov_mq = GLSW.eigensystem(-q)

print("incoming energy is", )
kk = np.linspace(0.0, 1.0, num=40)
v1 = np.zeros((len(kk)))
v2 = np.zeros((len(kk)))

for flag in range(len(kk)):

    k = np.array([0.0, kk[flag], 0.0])
    q2 = k
    q3 = q - k
    e2, ubov_2 = GLSW.eigensystem(q2)
    tmp, ubov_m2 = GLSW.eigensystem(-q2)
    e3, ubov_3 = GLSW.eigensystem(q3)
예제 #9
0
data = np.loadtxt(inFile)
lenf = len(data[:, 0])
k = np.arange(lenf)

num_sub = cf.num_sub

ek = np.zeros((lenf, 2*num_sub))
omega = np.zeros((lenf, 2*num_sub))
Gamma = np.zeros((lenf, 2*num_sub))

for flag in range(lenf):
    q1 = data[flag, 1]
    q2 = data[flag, 2]
    q3 = data[flag, 3]
    q = np.array([q1, q2, q3])
    energy, tmp = GLSW.eigensystem(q)
    ek[flag, :] = energy[:2*num_sub] 

    for band in range(2*num_sub):
        spec_nlsw = energy[band] + data[flag, 2*band+4] + data[flag, band+20]
        omega[flag, band] = spec_nlsw
        decay_rate = data[flag, 2*band+5]
        Gamma[flag, band] = decay_rate


ekmax = omega + Gamma
ekmin = omega - Gamma

fig, ax = plt.subplots()

for band in range(2*num_sub-1):
예제 #10
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 10 15:16:55 2019

@author: Hao
"""

import numpy as np
import GLSW
import GNLSW_selfE as selfE
import time

st = time.time()
q = np.array([0.1, 0.2, 0.0])
eq, ubov_q = GLSW.eigensystem(q)
tmp, ubov_mq = GLSW.eigensystem(-q)

E1 = selfE.Sigma_decay(q, eq, ubov_q, ubov_mq)
et = time.time()
print(E1)
print('time elapse =', et-st, 's')
예제 #11
0
data_min = np.loadtxt(fname2)
data_max = np.loadtxt(fname3)

lenk = len(data_min[:, 0])
k = np.arange(lenk)
ek = np.zeros((lenk, 2 * num_sub))

for flag in range(lenk):

    k1 = data_min[flag, 1]
    k2 = data_min[flag, 2]
    k3 = data_min[flag, 3]

    kk = np.array([k1, k2, k3])
    omegak, tmp = GLSW.eigensystem(kk)
    ek[flag, :] = omegak[:2 * num_sub]

fig, ax = plt.subplots()

for band in range(2 * num_sub):
    plt.plot(k, ek[:, band], 'k-')

for flag1 in range((2 * num_sub)**2):
    plt.plot(k, data_min[:, 4 + flag1], 'r-.')
    plt.plot(k, data_max[:, 4 + flag1], 'b-.')

for band1 in range(2 * num_sub):
    for band2 in range(2 * num_sub):

        tmin = data_min[:, 4 + 8 * band1 + band2]
예제 #12
0
# fname = 'tmp/ubov_mq1.txt'
# np.savetxt(fname, ubov1)

# tmp, ubov2 = GLSW.eigensystem(q2)
# fname = 'tmp/ubov2.txt'
# np.savetxt(fname, ubov2)

# tmp, ubov3 = GLSW.eigensystem(q3)
# fname = 'tmp/ubov3.txt'
# np.savetxt(fname, ubov3)

# JJI = vertex.JJI
# print(JJI[10, 0, :, :])
# print(JJI[10, 1, :, :])

tmp, ubov1 = GLSW.eigensystem(q1)
tmp, ubov2 = GLSW.eigensystem(q2)
tmp, ubov3 = GLSW.eigensystem(q3)

tmp, ubovm1 = GLSW.eigensystem(-q1)
tmp, ubovm2 = GLSW.eigensystem(-q2)
tmp, ubovm3 = GLSW.eigensystem(-q3)

# band1 = 1
# band2 = 5
# band3 = 7

# for band1 in range(6):
# band2 = band1 + 2
# band3 = 4
# v1 = vertex.V2_cubic_bm(band1, band2, band3, q1, q2, q3, \
예제 #13
0
# Author            : Hao Zhang <*****@*****.**>
# Date              : 01.16.2020
# Last Modified Date: 01.18.2020
# Last Modified By  : Hao Zhang <*****@*****.**>

import numpy as np
import GLSW
from matplotlib import pyplot as plt

kk = np.arange(100)

lenk = len(kk)
omega = np.zeros((6, lenk))
omega_imag = np.zeros((6, lenk))

for flag in range(lenk):
    k3 = 4.0 / lenk * flag
    k = np.array([0.0, 0.0, k3])
    ek, tmp, imagpart = GLSW.eigensystem(k)
    omega[:, flag] = ek[:6]
    omega_imag[:, flag] = imagpart[:6]

print(imagpart)
fig, ax = plt.subplots(2, 1)
for band in range(6):
    ax[0].plot(kk, omega[band, :])
    ax[1].plot(kk, omega_imag[band, :])

plt.ylim(0, 20)
plt.show()
예제 #14
0
K = -0.5
inputpath1 = 'cuts/K=' + str(K) + '/path_domain1.dat'
field = cf.field
#inputpath2 = 'cuts/K=' + str(K) + '/path_domain2.dat'
#inputpath3 = 'cuts/K=' + str(K) + '/path_domain3.dat'

domain1 = np.loadtxt(inputpath1)
# domain2 = np.loadtxt(inputpath2)
# domain3 = np.loadtxt(inputpath3)

lenk1 = len(domain1[:, 0])

k = np.arange(lenk1)
omega = np.zeros((8, lenk1))

for flag in range(lenk1):

    q1 = domain1[flag, 0]
    q2 = domain1[flag, 1]
    q3 = domain1[flag, 2]
    q = np.array([q1, q2, q3])
    ek, tmp = GLSW.eigensystem(q)
    omega[:, flag] = ek[:8]

fname = 'disp.txt'
np.savetxt(fname, omega)

for band in range(8):
    plt.plot(k, omega[band, :])
plt.show()
예제 #15
0
def greenfunction_gnlsw(omega, q, selfE_re, selfE_im):
    """
    calculates the green function of H-P bosons after 1/NS correction
    
    Parameters
    ----------
    omega   : np.array((anylength,))
              the frequency 
    q       : np.array((3,))
              input momentum
    selfE_re: np.array((2*num_sub, ))
              real part self-energy using on-shell approximation 
    
    selfE_im: np.array((2*num_sub, ))
              imag part self-energy using on-shell approximation
              
    Returns
    -------
    gf: np.array((4*num_sub, 4*num_sub)) 
    """

    len_omega = len(omega)
    gf = np.zeros([len_omega, 4 * num_sub, 4 * num_sub], dtype=complex)

    ek, ubov = GLSW.eigensystem(q)
    ek_m, ubov_m = GLSW.eigensystem(-q)

    ubov_m = ubov_m.conj()
    minus_mat = np.zeros([4 * num_sub, 4 * num_sub], dtype=complex)
    plus_mat = np.zeros([4 * num_sub, 4 * num_sub], dtype=complex)

    u11 = ubov[:2 * num_sub, :2 * num_sub]
    u21 = ubov[2 * num_sub:, :2 * num_sub]
    u11_m = ubov_m[:2 * num_sub, :2 * num_sub]
    u21_m = ubov_m[2 * num_sub:, :2 * num_sub]

    for band in range(2 * num_sub):

        minus_mat[:2 * num_sub, :2 * num_sub] = np.outer(
            u11[:, band], u11[:, band].conj())
        minus_mat[:2 * num_sub,
                  2 * num_sub:] = np.outer(u11[:, band], u21[:, band].conj())
        minus_mat[2 * num_sub:, :2 * num_sub] = np.outer(
            u21[:, band], u11[:, band].conj())
        minus_mat[2 * num_sub:,
                  2 * num_sub:] = np.outer(u21[:, band], u21[:, band].conj())

        plus_mat[:2 * num_sub, :2 * num_sub] = np.outer(
            u21_m[:, band], u21_m[:, band].conj())
        plus_mat[:2 * num_sub,
                 2 * num_sub:] = np.outer(u21_m[:, band], u11_m[:,
                                                                band].conj())
        plus_mat[2 * num_sub:, :2 * num_sub] = np.outer(
            u11_m[:, band], u21_m[:, band].conj())
        plus_mat[2 * num_sub:,
                 2 * num_sub:] = np.outer(u11_m[:, band], u11_m[:,
                                                                band].conj())

        tmp1 = np.reshape(
            omega - (ek[band] + selfE_re[band]) - 1j * selfE_im[band] +
            1j * 0.06, len_omega)
        tmp2 = np.reshape(
            omega + (ek_m[band] + selfE_re[band]) - 1j * selfE_im[band] +
            1j * 0.06, len_omega)

        # use this to avoid loop
        gf += -minus_mat / (tmp1[:, None, None]) + plus_mat / (tmp2[:, None,
                                                                    None])

    return gf
예제 #16
0
# Date              : 02.17.2020
# Last Modified Date: 02.17.2020
# Last Modified By  : Hao Zhang <*****@*****.**>

import numpy as np
import GLSW

num_sub = 4
q = np.array([0.1, 0.1, 0.1])
G1 = np.array([1.0, 0.0, 0.0])
G2 = np.array([2.0, 1.0, 3.0])
G3 = np.array([0.0, 0.0, 1.0])

q1 = q + G1
q2 = q + G2
q3 = q + G3

e1, ubov1 = GLSW.eigensystem(q1)
e2, ubov2 = GLSW.eigensystem(q2)
e3, ubov3 = GLSW.eigensystem(q3)

ubov1_11 = ubov1[:2 * num_sub, :2 * num_sub]
ubov2_11 = ubov2[:2 * num_sub, :2 * num_sub]
ubov1_21 = ubov1[2 * num_sub:, :2 * num_sub]
ubov2_21 = ubov2[2 * num_sub:, :2 * num_sub]

print('ubov11/ubov11')
print(ubov1_11[:, 0] / ubov2_11[:, 0])
print('difference between e2, e3 is ')
print(e2 - e3)