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
norm_x = [] expec_x = [] expec_xs = [] expec_k = [] for i in range(int(Ns / 2)): 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() - sch.expectation_x()**2)) expec_k.append(sch.expectation_k()) sch.momentum_kick(-2 * k_initial) for i in range(int(Ns / 2)): 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() - sch.expectation_x()**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)