Пример #1
0
print("Building more classes.")
ti = time()
"""build observables classes"""
phi_0 = phi_twin_track(FHM1, FHM2, psi1_t, psi2_t)
J1_0 = FHM1.phi_dependent_current(phi_0, psi1_t, lat)
J2_0 = FHM2.phi_dependent_current(phi_0, psi2_t, lat2)
if np.isclose(J1_0, J2_0):
    J_0 = J2_0
    print("Both systems give the same current.")
else:
    print(
        "ERROR: initial current between the two systems after kick are not equal. Tracking failed."
    )
    sys.exit(1)

obs1 = observables(psi1_t, J_0, phi_0, FHM1)
obs2 = observables(psi2_t, J_0, phi_0, FHM2)
print("More classes built. This took {:.2f} seconds.".format(time() - ti))
"""evolve the states given the twinning hamiltonian"""
print("Starting to evolve the two systems by twinning Hamiltonian.")
ti = time()

for current_time in tqdm(t_p.times[:-1]):
    solver_args = dict(atol=1e-12)
    # print(psi_t.shape)
    psi1_t_new = evolve(v0=psi1_t,
                        t0=current_time,
                        times=np.array([current_time + t_p.delta]),
                        f=twinning_tracking_evolution,
                        f_params=[FHM1, FHM2, lat,
                                  psi2_t.copy()],
Пример #2
0
                                                                      ti))

    # get inital energy and state
    ti = time()
    E, psi_0 = FHM.operator_dict['ham_init'].eigsh(k=1, which='SA')
    # print(psi_0)
    psi_t = psi_0.reshape(-1)
    print(
        "Initial state and energy calculated. It took {:.2f} seconds to calculate"
        .format(time() - ti))
    print("Ground state energy was calculated to be {:.2f}".format(E[0]))

    # initialize the observables class
    obser = observables(psi_t,
                        J_target(0.0),
                        phi_J_track(lat, 0.0, J_target, FHM, psi_t),
                        FHM,
                        continuity=True)
    # obser.initialize_work()

    # make a directory for this specific set of parameters
    path = "scoop_branch_tracking/Data/{}sites-{}up-{}down-{}t0-{}U-{}cycles-{}steps" \
           "-{}pbcF0={:.2f}-J_scale={:.2f}".format(param.L, param.N_up, param.N_down, param.t0, param.U, t_p.cycles,
                                                   t_p.n_steps, param.pbc, param.F0, param.J_scale)

    try:
        os.mkdir(path)
    except OSError as error:
        shutil.rmtree(path)
        os.mkdir(path)
Пример #3
0
                          dict(J=FHM.operator_dict['current']))

    # define the tracked time parameters class and the target J
    t_p_track = time_evolution_params(perimeter_params=lat_track,
                                      cycles=2,
                                      nsteps=n_steps)
    J_target = UnivariateSpline(t_p_track.times,
                                param_track.J_scale * current['J'],
                                s=0)

    # generate our extended vector and create our observables class for things to work (we don't actually use it for its
    #   intended purpose here)
    gamma_t = np.append(np.squeeze(psi_0), 0.0)

    obs = observables(
        gamma_t[:-1], J_target(0.0),
        phi_J_track(lat_track, 0.0, J_target, FHM_track, gamma_t[:-1]),
        FHM_track)
    R_current = [
        J_target(0.0),
    ]

    # generate the current through runga-kutta of the state
    for newtime in tqdm(t_p.times[:-1]):
        solver_args = dict(atol=1e-3)
        gamma_t = evolve(v0=gamma_t,
                         t0=newtime,
                         times=np.array([newtime + t_p.delta]),
                         f=R_tracking_evolution_equation,
                         f_params=[FHM_track, obs, J_target],
                         solver_name='dop853',
                         **solver_args)
ti = time()
E, psi_0 = FHM.operator_dict['ham_init'].eigsh(k=1, which='SA')
gamma_t = np.append(np.squeeze(psi_0), 0.0)
print("Initial state and energy calculated. It took {:.2f} seconds to calculate".format(time() - ti))
print("Ground state energy was calculated to be {:.2f}".format(E[0]))

"""create number operator"""

FHM.create_number_operator()

"""create current operator"""

FHM.create_current_operator()

"""create our observables class"""
obs = observables(gamma_t[:-1], J_target(0.0), phi_J_track(lat, 0.0, J_target, FHM, gamma_t[:-1]), FHM, continuity=1)

"""create our commutator operator with the hamiltonian H and the left hopping operator K"""

FHM.create_commutator()

"""Start our evolution"""

for newtime in tqdm(t_p.times[:-1]):
    solver_args = dict(atol=1e-4)
    gamma_t = evolve(v0=gamma_t, t0=newtime, times=np.array([newtime + t_p.delta]), f=R_tracking_evolution_equation,
                     f_params=[FHM, obs, J_target], solver_name='dopri5', **solver_args)
    gamma_t = gamma_t.reshape(-1)
    phi_t = obs.phi_init + np.angle(FHM.operator_dict['hop_left_op'].expt_value(gamma_t[:-1])) - gamma_t[-1]
    obs.append_observables(gamma_t[:-1], phi_t)
    # print(np.abs(obs.neighbour[-1]))
Пример #5
0
E = FHM.operator_dict["ham_init"].expt_value(psi_0)

psi_t = FHM.operator_dict['ham_init'].evolve(psi_0, 0.0, t_p.times)
psi_t = np.squeeze(psi_t)

expectations = obs_vs_time(psi_t, t_p.times, FHM.operator_dict)

current = -1j * lat.a * lat.t * (expectations['hop_left_op'] - expectations['hop_left_op'].conj())

J_target = UnivariateSpline(t_p.times, param.J_scale * current.real, s=0)

plt.plot(t_p.times * lat.freq, current)

gamma_t = np.append(psi_0, 0)

obs = observables(gamma_t[:-1], J_target(0.0), 0, FHM)

for newtime in tqdm(t_p.times[:-1]):
    solver_args = dict(atol=1e-4)
    gamma_t = evolve(v0=gamma_t, t0=newtime, times=np.array([newtime + t_p.delta]), f=H_tracking_evolution_equation,
                     f_params=[FHM, obs, J_target], solver_name='dopri5', **solver_args)
    gamma_t = gamma_t.reshape(-1)
    phi_t = fixed_point(H_tracking_implicit_phi_function, obs.phi[-1], args=(gamma_t, J_target(newtime),
                                                                                   FHM, obs))
    # phi_t = 0
    obs.append_observables(gamma_t[:-1], phi_t)
    # print(np.abs(obs.neighbour[-1]))
    # print(phi_t)

plt.figure('quick compare')
plt.plot(t_p.times, current)
Пример #6
0
# plt.figure('current')
# plt.plot(t_p.times, J_target(t_p.times))
# plt.plot(t_p.times, expectations['current'], ".")
"""setup quspin operators and lists"""
FHM = Fermi_Hubbard(lat, t_p.cycles)
"""get inital energy and state"""
ti = time()
E, psi_0 = FHM.operator_dict['ham_init'].eigsh(k=1, which='SA')
psi_t = np.squeeze(psi_0)
print(
    "Initial state and energy calculated. It took {:.2f} seconds to calculate".
    format(time() - ti))
print("Ground state energy was calculated to be {:.2f}".format(E[0]))
"""create our observables class"""
obs = observables(psi_t, J_target(0.0),
                  phi_J_track(lat, 0.0, J_target, FHM, psi_t), FHM)
"""evolve that energy and state"""

for newtime in tqdm(t_p.times[:-1]):
    solver_args = dict(atol=1e-12)
    psi_t = evolve(v0=psi_t,
                   t0=newtime,
                   times=np.array([newtime + t_p.delta]),
                   f=original_tracking_evolution,
                   f_params=[FHM, J_target, lat],
                   **solver_args)
    psi_t = psi_t.reshape(-1)
    obs.append_observables(
        psi_t, phi_J_track(lat, newtime + t_p.delta, J_target, FHM, psi_t))
"""save all observables to a file"""
outfile = './Data/expectations:{}sites-{}up-{}down-{}t0-{}U-{}cycles-{}steps-{}pbc:a_scale={:.2f}-J_scale={:.2f}.npz'.\