def evolve_others(system): J_field = system.last_J.copy() phi_original = system.phi.copy() psi_temp = system.last_psi.copy() neighbours = system.neighbourexpec.copy() newphis = [] newtimes = [] inittime = 1 / system.freq + system.iter * (system.cycles - 1) / ( system.libN * system.freq) # times = np.linspace(inittime, (system.iter + 1) * (system.cycles-1) / (system.libN * system.freq), len(system.phi)) times = np.linspace( 0, 1 / system.freq + (system.iter + 1) * (system.cycles - 1) / (system.libN * system.freq), len(system.phi)) phi_func = interp1d(times, phi_original, fill_value='extrapolate', bounds_error=False, kind='cubic') h = hub.create_1e_ham(system, True) r = ode(evolve.integrate_f_discrim).set_integrator('zvode', method='bdf') r.set_initial_value(psi_temp, inittime).set_f_params(system, h, phi_func) f = system.freq while r.successful() and r.t < 1 / system.freq + (system.iter + 1) * ( system.cycles - 1) / (system.libN * system.freq): oldpsi = psi_temp r.integrate(r.t + system.delta) psi_temp = r.y newtime = r.t # add to expectations newphis.append(phi_func(newtime)) newtimes.append(newtime) # double occupancy fails for anything other than half filling. # D.append(evolve.DHP(prop,psi)) # harmonic.progress(N, int(newtime / delta)) neighbour = har_spec.nearest_neighbour_new(system, h, psi_temp) J_field.append( har_spec.J_expectation_track(system, h, psi_temp, phi_func(newtime))) neighbours.append(neighbour) # plt.plot(times, phi_func(times)) # plt.plot(newtimes,newphis,'--') # plt.show() system.last_psi = psi_temp system.last_J = J_field system.neighbourexpec = neighbours return system
def ham_J_track_ZVODE(current_time, psi, J_reconstruct, lat, h): current = J_reconstruct(current_time) # Arrange psi to calculate the nearest neighbour expectations D = harmonic.nearest_neighbour_new(lat, h, psi) angle = np.angle(D) mag = np.abs(D) scalefactor = 2 * lat.a * lat.t * mag # assert np.abs(current)/scalefactor <=1, ('Current too large to reproduce, ration is %s' % np.abs(current/scalefactor)) arg = -current / (2 * lat.a * lat.t * mag) phi = np.arcsin(arg + 0j) + angle h_forwards = np.triu(h) h_forwards[0, -1] = 0.0 h_forwards[-1, 0] = h[-1, 0] h_backwards = np.tril(h) h_backwards[-1, 0] = 0.0 h_backwards[0, -1] = h[0, -1] return np.exp(1.j * phi) * h_forwards + np.exp(-1.j * phi) * h_backwards
def evolve_track(system, k): phi_original = system.phi.copy() inittime = 1 / system.freq + k * sections / system.freq J_field = system.last_J.copy() last_current = J_field[-1] neighbours = system.neighbourexpec.copy() psi_temp = system.last_psi.copy() def J_func(current_time): J = last_current * np.exp(-5 * (current_time - inittime)) return J h = hub.create_1e_ham(system, True) r = ode(evolve.integrate_f_track_J).set_integrator('zvode', method='bdf') r.set_initial_value(psi_temp, inittime).set_f_params(system, h, J_func) branch = 0 delta = system.delta while r.successful( ) and r.t < 1 / system.freq + (k + 1) * sections / system.freq: r.integrate(r.t + system.delta) psi_temp = r.y newtime = r.t # add to expectations neighbour = har_spec.nearest_neighbour_new(system, h, psi_temp) # two_body.append(har_spec.two_body_old(system, psi_temp)) # tracking current newphi = evolve.phi_J_track(system, newtime, J_func, neighbour, psi_temp) if newphi - phi_original[-1] > 1.5 * np.pi: newphi = newphi - 2 * np.pi elif newphi - phi_original[-1] < -1.5 * np.pi: newphi = newphi + 2 * np.pi phi_original.append(newphi) J_field.append( har_spec.J_expectation_track(system, h, psi_temp, phi_original[-1])) harmonic.progress(N, int(newtime / delta)) neighbours.append(neighbour) system.last_psi = psi_temp system.phi = phi_original system.last_J = J_field system.neighbourexpec = neighbours return system
def long_pump(system): def phi_pump(current_time): frac = 1 phi = (system.a * system.F0 / system.field) * np.sin( current_time * system.field / (frac)) * np.sin( 0.5 * current_time * system.field / system.cycles)**2 return phi phi_original = [] J_field = [] neighbours = [] psi_temp = harmonic.hubbard(system)[1].astype(complex) init = psi_temp h = hub.create_1e_ham(system, True) r = ode(evolve.integrate_f_discrim).set_integrator('zvode', method='bdf') r.set_initial_value(psi_temp, 0).set_f_params(system, h, phi_pump) while r.successful() and r.t < system.cycles / system.freq: oldpsi = psi_temp r.integrate(r.t + system.delta) psi_temp = r.y newtime = r.t # add to expectations # double occupancy fails for anything other than half filling. # D.append(evolve.DHP(prop,psi)) # harmonic.progress(N, int(newtime / delta)) phi_original.append(phi_pump(newtime)) neighbour = har_spec.nearest_neighbour_new(system, h, psi_temp) J_field.append( har_spec.J_expectation_track(system, h, psi_temp, phi_original[-1])) neighbours.append(neighbour) system.last_psi = psi_temp system.last_J = J_field system.phi = phi_original system.neighbourexpec = neighbours return system
# r = ode(evolve.integrate_f_track_D).set_integrator('zvode', method='bdf') # set which observable to track r.set_initial_value(psi_temp, 0).set_f_params(lat, h, J_func) # r.set_initial_value(psi_temp, 0).set_f_params(lat,h,D_func) branch = 0 while r.successful() and r.t < time / lat.freq: oldpsi = psi_temp r.integrate(r.t + delta_track) psi_temp = r.y newtime = r.t # add to expectations harmonic.progress(N, int(newtime / delta_track)) neighbour.append(har_spec.nearest_neighbour_new(lat, h, psi_temp)) two_body.append(har_spec.two_body_old(lat, psi_temp)) # tracking current phi_original.append( evolve.phi_J_track(lat, newtime, J_func, neighbour[-1], psi_temp)) # tracking D # phi_original.append(evolve.phi_D_track(lat,newtime,D_func,two_body[-1],psi_temp)) J_field_track.append( har_spec.J_expectation_track(lat, h, psi_temp, phi_original[-1])) D_track.append(observable.DHP(lat, psi_temp)) # diff = (psi_temp - oldpsi) / delta # newerror = np.linalg.norm(diff + 1j * psierror)