Esempio n. 1
0
def momentum_3(i, sol, k):
    res = 0. + 0.J
    u = 1.J
    L = sol['L']
    for j in range(sol['L']):
        s1 = solver.sigma(i, j, sol['N'])
        res += numpy.exp(u * k * j) * numpy.exp(2.J * math.pi *
                                                (s1) / sol['N'])
    if sol['bc'] == 1:
        s1 = solver.sigma(i, 1, sol['N'])
        s2 = solver.sigma(i, sol['L'], sol['N'])
        #res += numpy.exp(u * k * numpy.exp(2.*math.pi*(s2-s1)/sol['N']))
    div = sol['L']
    #if sol['bc'] == 1:
    #div += 1
    return res / div
Esempio n. 2
0
def measure_scalar(sol, f, *args):

    res = 0. + 0.J
    sol['spin_expectations'] = []
    for j in range(0, sol['L']):
        se = 0. + 0.J
        for i, e in enumerate(sol['evec']):
            s1 = solver.sigma(i, j, sol['N'])
            angle = 2. * math.pi / sol['N'] * s1
            se += numpy.exp(1.J * angle) * e * numpy.conj(e)
            #se += angle*e*numpy.conj(e)

        #se /= len(sol['evec'])
        se = se.real
        sol['spin_expectations'].append(se)

    print sol['spin_expectations']
    for i, e in enumerate(sol['evec']):
        res += numpy.conj(e) * f(i, sol, *args) * e

    return res
Esempio n. 3
0
def current_1(i, sol, k):
    res = 0.
    L = sol['L']
    for j in range(1, sol['L']):
        s1 = solver.sigma(i, j, sol['N'])
        s2 = solver.sigma(i, j + 1, sol['N'])
        #res += numpy.sin(2*math.pi/sol['N'] * (s2-s1))
        #res += numpy.exp(u * k * numpy.exp(2.*math.pi*(s2-s1)/sol['N']))
    if sol['bc'] == 1:
        s1 = solver.sigma(i, sol['L'], sol['N'])
        s2 = solver.sigma(i, 1, sol['N'])
        #res += numpy.sin(2*math.pi/sol['N'] * (s2-s1))
        #res += numpy.exp(u * k * numpy.exp(2.*math.pi*(s2-s1)/sol['N']))
    s1 = solver.sigma(i, 0, sol['N'])
    s2 = solver.sigma(i, L - 1, sol['N'])
    res += numpy.sin(2. * math.pi / sol['N'] * (s2 - s1))
    div = sol['L']
    #if sol['bc'] == 1:
    #div += 1
    res = res.real
    return res / div
Esempio n. 4
0
def momentum_2(i, sol, k):
    res = 0. + 0.J
    u = 1.J
    L = sol['L']
    for j in range(2, sol['L']):
        s1 = solver.sigma(i, j - 1, sol['N'])
        s2 = solver.sigma(i, j, sol['N'])
        s3 = solver.sigma(i, j + 1, sol['N'])
        d1 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s2 - s1) / sol['N']))
        d2 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s3 - s2) / sol['N']))
        res += 0.5 * (d1 + d2)
    if sol['bc'] == 1:
        s1 = solver.sigma(i, L, sol['N'])
        s2 = solver.sigma(i, 1, sol['N'])
        s3 = solver.sigma(i, 2, sol['N'])
        d1 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s2 - s1) / sol['N']))
        d2 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s3 - s2) / sol['N']))
        res += 0.5 * (d1 + d2)
        s1 = solver.sigma(i, L - 1, sol['N'])
        s2 = solver.sigma(i, L, sol['N'])
        s3 = solver.sigma(i, 1, sol['N'])
        d1 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s2 - s1) / sol['N']))
        d2 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s3 - s2) / sol['N']))
        res += 0.5 * (d1 + d2)
    else:
        s1 = solver.sigma(i, 1, sol['N'])
        s2 = solver.sigma(i, 2, sol['N'])
        d1 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s2 - s1) / sol['N']))
        res += d1
        s1 = solver.sigma(i, L - 1, sol['N'])
        s2 = solver.sigma(i, L, sol['N'])
        d1 = numpy.exp(u * k * numpy.exp(2. * math.pi * (s2 - s1) / sol['N']))
        res += d1

    div = sol['L']
    #if sol['bc'] == 1:
    #div += 1
    return res / div
Esempio n. 5
0
def links(i):
    res = []
    for j in range(L):
        jf = (solver.sigma(i, j, N) + 1) % N
        res.append(solver.index(i, j, jf, N))
    return res
Esempio n. 6
0
import solver, data_processing, writer, measure

N = 3
L = 3
Q = N**L

columns = []

for total_charge in range(N):
    columns.append([])

for i in range(Q):
    for total_charge in range(N):
        x = 0
        for j in range(L):
            x += solver.sigma(i, j, N)
        x = x % N
        if total_charge == x:
            columns[total_charge].append(i)

X_mapping = []
for j in range(L):
    X_mapping.append([])
for i in range(N**L):
    for j in range(L):
        solver.sigma_j = solver.sigma(i, j, N)
        if (solver.sigma_j < 1):
            X_mapping[j].append(solver.index(i, j, solver.sigma_j + 1, N))
        elif (solver.sigma_j < N - 1):
            X_mapping[j].append(solver.index(i, j, solver.sigma_j + 1, N))
        else:
Esempio n. 7
0
f = open(output_file, 'w+')
f.write(output)
f.close()

k = 11.111

for sol in sol_list:
    L = sol['L']
    N = sol['N']
    res = ''
    total = 0.
    for j in range(0, L - 1):
        se = 0. + 0.J
        if 'evec' in sol:
            for i, e in enumerate(sol['evec']):
                s1 = solver.sigma(i, j, N)
                s2 = solver.sigma(i, j + 1, N)
                diff = (s2 - s1) % N
                se += diff * e * numpy.conj(e)
        total += se
        #res += '%9.2E %9.2E' % (se.real, se.imag) + ' '
        res += '%9.2E' % se.real + ' '
    if sol['bc'] == 1:
        se = 0. + 0.J
        if 'evec' in sol:
            for i, e in enumerate(sol['evec']):
                s1 = solver.sigma(i, L - 1, N)
                s2 = solver.sigma(i, 0, N)
                diff = (s2 - s1) % N
                se += diff * e * numpy.conj(e)
        #res += '%9.2E %9.2E' % (se.real, se.imag) + ' '