def run(Ns, step, dt, acc, c):
    args = (m, omega, acc, x0, c)
    v = harmonic_potential(x, t, args=args)
    sch = Schrodinger(x, psi_x, v, k, hbar=hbar, m=m, t=0, args=args)
    for i in range(Ns):
        sch.evolve_t(N_steps=step, dt=dt)
    return sch.expectation_x()
Exemple #2
0
def run(A, choen=False):
    V_x = barrier(x, A, x1, x2)
    sch = Schrodinger(x, Psi_x, V_x, hbar=hbar, m=m, args=x2, t=0)
    I = sch.impedencePacket()
    while sch.t < finalt:
        print("Height :{h} Time:{t}".format(h=A, t=sch.t))
        sch.evolve_t(step, dt)
    T = sch.barrier_transmition()
    return T, I
Exemple #3
0
 def runAll(self, N_step=1):
     psi_comb = np.zeros((self.n, len(self.x)), dtype=complex)
     for initial in self.initarray:
         x0, v0, a0, g0 = initial
         psi_x = self.hellerPacket(x0, v0, a0, g0)
         sch = Schrodinger(self.x, psi_x, self.v, hbar=self.hbar, m=self.m)
         for i in range(self.n):
             if i != 0:
                 sch.evolve_t(N_step, self.dt)
             psi_sol = sch.psi_x
             psi_comb[i] += psi_sol / np.sqrt(self.N_packet)
     self.psi_comb = psi_comb
     return psi_comb
def run_A(A):
    Psi_x = gauss_init(x, k0, x0=x0, d=sig)
    V_x = gauss_barrier(x, A, x1, omeg)
    sch = Schrodinger(x, Psi_x, V_x, hbar=hbar, m=m, t=0, args=x1)

    imp = sch.impedencePacket(tol=10**-11)
    time_list = []
    Trans_list = []
    while sch.t < t_final:
        sch.evolve_t(N_steps=step, dt=dt)
        time_list.append(sch.t)
        Trans_list.append(sch.barrier_transmition())
        print("Height {v}, Time {t}".format(v=A / scale, t=sch.t))

    return sch.barrier_transmition(), imp
Exemple #5
0
def run(acc):
    t = 0
    psi_x = gauss_init(x, k_initial, x0=0, d=d)
    V_x = gaussbox(x, w, L, x0=xb, A=Amp, a=acc)
    sch = Schrodinger(x, psi_x, V_x, k, hbar=hbar, m=m, t=t)

    t_list = []
    x_list = []

    for i in range(Ns):
        sch.evolve_t(N_steps=step, dt=dt)
        t_list.append(sch.t)
        x_list.append(sch.expectation_x())

    dat = list(zip(t_list, x_list))
    # np.savetxt("GBox_{}.txt".format(a), dat)
    return dat
Exemple #6
0
def run(x2, time=False):
    V_x = barrier(x, A, x1, x2)
    psi_init = gauss_init(x, k_init, x0=x0, d=sig)

    sch = Schrodinger(x, psi_init, V_x, k, hbar=hbar, m=m, t=0, args=x2)

    dat = []
    t_list = []
    for i in range(0, Ns):
        sch.evolve_t(step, dt)
        dat.append(sch.barrier_transmition())
        t_list.append(sch.t)

    # plt.plot(sch.k, abs(sch.psi_k))
    # plt.show()

    if time:
        return dat, t_list
    else:
        return dat
Exemple #7
0
    def onePacket(self, vkick, init):
        nhalf = int(self.n / 2)
        psi_arr = np.zeros((self.n, len(self.x)), dtype=complex)

        x0, v0, a0, g0 = init
        psi_init = self.hellerPacket(x0, v0, a0, g0)
        tempsch = Schrodinger(self.x,
                              psi_init,
                              self.v,
                              hbar=self.hbar,
                              m=self.m)
        for i in range(nhalf):
            tempsch.evolve_t(1, dt=self.dt)
            psi_arr[i] = tempsch.psi_x

        tempsch.momentum_kick(self.m * vkick / self.hbar)
        for i in range(nhalf):
            tempsch.evolve_t(1, dt=self.dt)
            psi_arr[i + nhalf] = tempsch.psi_x
        return psi_arr
            V_x,
            step,
            dt,
            lim1=((0, x_length), (0, max(np.real(psi_x)))),
            lim2=((ks[0], ks[N - 1]), (0, 30)))
a.make_fig()

t_list = []
norm_x = []
expec_x = []
expec_xs = []
expec_k = []

for i in range(Ns):
    if i != 0:
        sch.evolve_t(step, dt)
    t_list.append(sch.t)
    norm_x.append(sch.norm_x() - 1)
    expec_x.append(sch.expectation_x())
    expec_xs.append(np.sqrt(sch.expectation_x_square() - expec_x[i]**2))
    expec_k.append(sch.expectation_k())

# x_pos_list = [x_pos(j, x0, k_initial, hbar=hbar, m=m) for j in t_list]
# xdiff = [np.abs(expec_x[n] - x_pos_list[n]) for n in range(len(expec_x))]

# popt1, pcov = curve_fit(func, t_list, x_pos_list)
# print("Expected x :", popt1)
#
# popt2, pcov = curve_fit(func, t_list, expec_x)
# print("Calculated x :", popt2)
#
Exemple #9
0
plt.plot(x, V)
plt.show()

sch = Schrodinger(x, psi_init, V, hbar=hbar, m=m, t=0)


# a = Animate(sch, V, 1, dt,lim1=((-xmax, xmax), (0, max(sch.psi_squared))))
# a.make_fig()

simx = []
tl = []
El = []

temp = 0
while temp < Nt:
    sch.evolve_t(1, dt=dt)
    temp += 1
    if (temp % nsave) == 0:
        simx.append(sch.expectation_x())
        tl.append(temp * dt)
        El.append(sch.energy())

actualx = x_pos(np.asarray(tl), x0, omegax, 0)
diff = abs(np.asarray(simx) - actualx)

plt.plot(tl, simx)
plt.plot(tl, actualx, linestyle="--")
plt.show()

plt.plot(tl, diff)
plt.show()