Exemplo n.º 1
0
def main_raman_sb_cooling6():
    theta_raman = 0

    pumpp_name = '[.2]'
    dns_name = '(ones(100)).astype(int)'
    pumpp = eval(pumpp_name)
    dns = eval(dns_name)

    with open('res26.json', 'r') as fh:
        import json
        d = json.load(fh)
    rho0 = array(d['rho0.real']) + 1j * array(d['rho0.imag'])
    rho_t = [rho0]

    for i, dn in enumerate(dns):
        print("iteration: %d, dn: %d" % (i, dn))
        number = abs(sum(diag(rho0)))
        ntotal_init = calc_total_n(rho0)
        vmax = number**2 / ntotal_init
        print("atom number: %f" % number)
        print("total n: %f" % ntotal_init)
        print("v: %f" % vmax)
        ts, rhos = evolve_rho(rho0, 2, 0.1, 0.8, dn, 0.4, 0,
                              theta_raman, pi / 2, pumpp[dn - 1], 0.01)
        # ts, rhos = evolve_rho(rho0, 2, 0.1, 0.8, dn, 0.4, 0,
        #                       theta_raman, pi / 2, pumpp[dn - 1], 0.05)
        number = abs(sum(diag(rhos[-1])))
        ntotal = calc_total_n(rhos[-1])
        v = number**2 / ntotal
        print("atom number: %f" % number)
        print("total n: %f" % ntotal)
        print("v: %f" % v)
        print("n decreases: %f" % (ntotal_init - ntotal))
        print('')
        rho0 = rhos[-1]
        rho_t.append(rho0)
        print('\n')

    print(dns_name)
    print(pumpp_name)
    # for i, rho in enumerate(rho_t):
    #     print(i, rho)
    # for i, rho in enumerate(rho_t):
    #     print(i, diag(rho))
    rho_t = array(rho_t)
    with open('res29.json', 'w') as fh:
        import json
        json.dump({'dns_name': dns_name,
                   'pumpp_name': pumpp_name,
                   'ps': [abs(diag(rho)).tolist() for rho in rho_t],
                   'ns': [calc_total_n(rho) for rho in rho_t],
                   'rho0.real': rho0.real.tolist(),
                   'rho0.imag': rho0.imag.tolist()}, fh)
Exemplo n.º 2
0
def main_raman_sb_cooling3():
    # pumpp = 1
    # theta_raman = 0
    # [8, 5, 10, 5, 5, 7, 5, 3, 7, 5, 3, 9, 6, 4, 8, 4, 2, 6, 5, 5, 3, 7, 3,
    #  7, 2, 6, 6, 4, 2, 8, 5, 3, 7, 2, 6, 5, 3, 1, 8, 6]
    # 6.302077

    # pumpp = 2
    # theta_raman = 0
    # [8, 6, 6, 6, 4, 8, 4, 7, 3, 6, 6, 4, 8, 3, 7, 5, 3, 10, 6, 3, 8, 2, 6,
    #  4, 4, 2, 8, 5, 3, 2, 6, 4, 2, 8, 4, 2, 6, 2, 5, 3]
    # 5.244526

    # pumpp = 2
    # theta_raman = -pi / 5
    # [11, 9, 7, 13, 6, 10, 5, 9, 9, 5, 11, 7, 4, 12, 10, 6, 3, 10, 5, 12, 8,
    #  4, 3, 11, 7, 5, 2, 10, 4, 12, 7, 3, 11, 5, 2, 9, 4, 3, 2, 10]
    # 4.248303

    # pumpp = 4
    # theta_raman = -pi / 5
    # [11, 9, 7, 13, 11, 8, 6, 6, 13, 10, 5, 8, 4, 12, 6, 10, 5, 8, 4, 12, 6,
    #  4, 10, 3, 8, 5, 13, 6, 4, 3, 10, 5, 3, 8, 4, 12, 6, 3, 5, 4]
    # 6.325143

    n = 100
    nstart = 30

    # pumpp = 2 * ones(n)
    theta_raman = 0
    # dns = (exp(-arange(40) * 0.028) * 7.8).astype(int) 7.112772
    # dns = (exp(-arange(40) * 0.025) * 8).astype(int) 6.451
    # dns = (exp(-arange(40) * 0.022) * 8.2).astype(int) 5.848752
    # dns = (exp(-arange(40) * 0.020) * 8.2).astype(int) 5.675294
    # dns = (exp(-arange(40) * 0.022) * 8.4).astype(int) 5.553641
    # dns = (exp(-arange(40) * 0.020) * 8.4).astype(int) 5.547241
    # dns = (exp(-arange(40) * 0.018) * 8.4).astype(int) 5.736700
    # dns = (exp(-arange(40) * 0.020) * 8.6).astype(int) 5.478592
    # dns = (exp(-arange(40) * 0.018) * 8.6).astype(int) 5.544554
    # dns = (exp(-arange(40) * 0.020) * 9).astype(int) 5.299673

    # pumpp = 1 * exp(arange(20) * .09) 3.046997
    # pumpp = 1.1 * exp(arange(20) * .08) 3.035428
    # pumpp = .9 * exp(arange(20) * .1) 3.081284
    # pumpp = .9 * exp(arange(20) * .08) 3.177622
    # pumpp = 1.1 * exp(arange(20) * .1) 3.013128
    # pumpp_name = '1.2 * exp(arange(20) * .1)' 3.039314
    # pumpp_name = '1.2 * exp(arange(20) * .12)' 3.086417
    # pumpp_name = '1.1 * exp(arange(20) * .12)' 3.028615
    # pumpp_name = '1.1 * exp(arange(20) * .1) * arange(20)**0.05' 2.865663
    # pumpp_name = '1.0 * exp(arange(20) * .1) * arange(20)**0.05' 2.860178
    # pumpp_name = '0.9 * exp(arange(20) * .1) * arange(20)**0.05' 2.899644
    # pumpp_name = '1.1 * exp(arange(20) * .1) * arange(20)**0.1' 3.040471
    # pumpp_name = '1. * exp(arange(20) * .1) * arange(20)**0.1' 2.859388
    # pumpp_name = '0.9 * exp(arange(20) * .1) * arange(20)**0.1' 2.869879
    # pumpp_name = '1.05 * exp(arange(20) * .1) * arange(20)**0.15' 2.905376
    # pumpp_name = '1. * exp(arange(20) * .1) * arange(20)**0.15' 2.880614
    # pumpp_name = '1.05 * exp(arange(20) * .1) * arange(20)**0.1' 2.870642
    # pumpp_name = '1.1 * exp(arange(20) * .1) * arange(20)**0.15' 2.938827
    # pumpp_name = '1. * exp(arange(20) * .1) * arange(20)**0.15'
    # pumpp_name = '1.1 * exp(arange(20) * .1) * arange(20)**0.1' 2.859388
    # pumpp_name = '.9 * exp(arange(20) * .1) * arange(20)**0.15' 2.862172
    # pumpp_name = '.95 * exp(arange(20) * .1) * arange(20)**0.15' 2.865720
    # pumpp_name = '.9 * exp(arange(20) * .1) * arange(20)**0.1' 2.869879
    # pumpp_name = '.95 * exp(arange(20) * .1) * arange(20)**0.1' 2.858590
    # pumpp_name = '.95 * exp(arange(20) * .1) * arange(20)**0.1' 2.391270
    pumpp_name = '.95 * exp(arange(20) * .1) * arange(20)**0.1'
    # theta_raman = 0
    # dns = (exp(-arange(80) * 0.020) * 9).astype(int) 3.325853
    # dns = (exp(-arange(80) * 0.020) * 9.5).astype(int) 2.589682
    # dns = (exp(-arange(80) * 0.020) * 10).astype(int) 2.391270
    # dns = (exp(-arange(80) * 0.020) * 11).astype(int) 1.992798
    # dns = (exp(-arange(80) * 0.020) * 12).astype(int) 1.742741
    dns_name = '(exp(-arange(80) * 0.020) * 13).astype(int)' # 1.670308
    # dns_name = '(exp(-arange(80) * 0.020) * 14).astype(int)' 1.727176
    # dns_name = '(exp(-arange(80) * 0.020) * 15).astype(int)' 2.004741
    pumpp = eval(pumpp_name)

    # pumpp = 2 * ones(n)
    # theta_raman = -pi / 5
    # dns = exp(2.48 - arange(40) * 0.028).astype(int) 4.728015
    # dns = exp(2.50 - arange(40) * 0.030).astype(int) 4.500523
    # dns = exp(2.46 - arange(40) * 0.030).astype(int) 4.839641
    # dns = exp(2.46 - arange(40) * 0.026).astype(int) 4.752056
    # dns = exp(2.50 - arange(40) * 0.026).astype(int) 4.387730

    # pumpp = 4 * ones(n)
    # theta_raman = -pi / 5
    # dns = exp(2.48 - arange(40) * 0.028).astype(int) 7.151005
    # dns = exp(2.5 - arange(40) * 0.025).astype(int) 6.577263
    # dns = exp(2.52 - arange(40) * 0.022).astype(int) 6.347822

    dns = eval(dns_name)

    ps0 = (exp(-arange(n + 1, dtype=complex128) / nstart) *
           (1 - exp(-1 / nstart)))
    rho0 = diag(r_[ps0, zeros(n + 1, dtype=complex128)])
    rho_t = [rho0]

    for i, dn in enumerate(dns):
        print("iteration: %d, dn: %d" % (i, dn))
        number = abs(sum(diag(rho0)))
        ntotal_init = calc_total_n(rho0)
        vmax = number**2 / ntotal_init
        print("atom number: %f" % number)
        print("total n: %f" % ntotal_init)
        print("v: %f" % vmax)
        ts, rhos = evolve_rho(rho0, 2, 0.1, 0.8, dn, 0.4, 0,
                              theta_raman, pi / 2, pumpp[dn - 1], 0.05)
        number = abs(sum(diag(rhos[-1])))
        ntotal = calc_total_n(rhos[-1])
        v = number**2 / ntotal
        print("atom number: %f" % number)
        print("total n: %f" % ntotal)
        print("v: %f" % v)
        print("n decreases: %f" % (ntotal_init - ntotal))
        print('')
        rho0 = rhos[-1]
        rho_t.append(rho0)
        print('\n')

    print(dns_name)
    print(pumpp_name)
    # for i, rho in enumerate(rho_t):
    #     print(i, rho)
    # for i, rho in enumerate(rho_t):
    #     print(i, diag(rho))
    rho_t = array(rho_t)
    with open('res9.json', 'w') as fh:
        import json
        json.dump({'dns_name': dns_name,
                   'pumpp_name': pumpp_name,
                   'ps': [abs(diag(rho)).tolist() for rho in rho_t],
                   'ns': [calc_total_n(rho) for rho in rho_t],
                   'rho0.real': rho0.real.tolist(),
                   'rho0.imag': rho0.imag.tolist()}, fh)
Exemplo n.º 3
0
def main_raman_sb_cooling2():
    # from pylab import plot, show, imshow, figure, colorbar, xlabel, ylabel
    # from pylab import legend, title, savefig, close, grid

    # pumpp = 2
    # theta_raman = 0
    # [8, 6, 6, 6, 4, 8, 4, 7, 3, 6, 6, 4, 8, 3, 7, 5, 3, 10, 6, 3, 8, 2, 6,
    #  4, 4, 2, 8, 5, 3, 2, 6, 4, 2, 8, 4, 2, 6, 2, 5, 3]
    # 5.244526

    n = 100
    nstart = 30
    # pumpp = 1
    pumpp = 2
    # pumpp = 4
    theta_raman = 0
    # theta_raman = -pi / 5
    ps0 = (exp(-arange(n + 1, dtype=complex128) / nstart) *
           (1 - exp(-1 / nstart)))
    rho0 = diag(r_[ps0, zeros(n + 1, dtype=complex128)])
    dns = []

    dnrange = range(20, 0, -1)
    for i in range(40):
        print("start iteration: %d" % i)
        number = abs(sum(diag(rho0)))
        ntotal_init = calc_total_n(rho0)
        dnmax = 0
        vmax = number**2 / ntotal_init
        print("atom number: %f" % number)
        print("total n: %f" % ntotal_init)
        print("v: %f" % vmax)
        for dn in dnrange:
            print("iteration: %d, dn: %d" % (i, dn))
            ts, rhos = evolve_rho(rho0, 2, 0.1, 0.8, dn, 0.4, 0,
                                  theta_raman, pi / 2, pumpp, 0.05)
            number = abs(sum(diag(rhos[-1])))
            ntotal = calc_total_n(rhos[-1])
            v = number**2 / ntotal
            print("atom number: %f" % number)
            print("total n: %f" % ntotal)
            print("v: %f" % v)
            if v > vmax:
                print("use new dn: %d, v = %f, n decreases: %f" %
                      (dn, v, ntotal_init - ntotal))
                dnmax = dn
                vmax = v
                new_rho0 = rhos[-1]
            # plot(abs(diag(rhos[0])), label='before')
            # plot(abs(diag(rhos[-1])), label='after')
            # legend()
            # figure()
            # plot(abs(diag(rhos[-1])) - abs(diag(rhos[0])))
            # figure()
            # imshow(abs(rhos[0]))
            # figure()
            # imshow(abs(rhos[-1]))
            # show()
            print('')
        rho0 = new_rho0
        if dnmax == 0:
            print("cooling stopped, abort")
            break
        dns.append(dnmax)
        dnrange = range(max(dnmax - 8, 1), dnmax + 9)
        print('\n')

    print(rho0)
    print(diag(rho0))
    print("atom number: %f\n" % sum(diag(rho0)))
    print("total n: %f\n" % calc_total_n(rho0))
    print(dns)