Example #1
0
                      tracking=1)
"""generating our class of scaled parameters"""
"""this is used for most of the calculations"""
lat = hhg(field=param.field,
          nup=param.N_up,
          ndown=param.N_down,
          nx=param.L,
          ny=0,
          U=param.U,
          t=param.t0,
          F0=param.F0,
          a=param.a,
          pbc=param.pbc)
"""setup our evolution time parameters"""
t_p = time_evolution_params(perimeter_params=lat,
                            cycles=2,
                            nsteps=int(2e3),
                            plotting=1)
"""prepare to load our data to be plotted"""
outfile = './Data/expectations:{}sites-{}up-{}down-{}t0-{}U-{}cycles-{}steps-{}pbc:a_scale={:.2f}-J_scale={:.2f}.npz'.\
    format(param.L, param.N_up, param.N_down, param.t0, param.U, t_p.cycles, t_p.n_steps, param.pbc, param.a_scale
           , param.J_scale)
expectations = np.load(outfile)
"""plot out expectations"""
"""Plotting field"""
plt.figure("Control field")
plt.xlabel("Time (cycles)")
plt.ylabel("$\\Phi(t)$")
plt.grid(True)
plt.tight_layout()
plt.plot(t_p.times, expectations['phi'])
plt.plot(t_p.times, expectations['tracking_phi'], ".")
Example #2
0
os.environ['MKL_NUM_THREADS'] = '{}'.format(threads)
sys.path.append('../')
# note cpu_count for logical=False returns the wrong number for multi-socket CPUs.
print("logical cores available {}".format(psutil.cpu_count(logical=True)))
t_init = time()
np.__config__.show()

"""Generate our class for the unscaled parameters. These are primarily used for saving our data"""
param = unscaledparam(L=6, t0=0.52, U=0.6, pbc=False, field=32.9, F0=10, a=4)

"""Generating our class of scaled parameters. This is used for most of the calculations"""
lat = hhg(field=param.field, nup=param.N_up, ndown=param.N_down, nx=param.L, ny=0, U=param.U, t=param.t0, F0=param.F0
          , a=param.a, pbc=param.pbc)

"""setup our evolution time parameters"""
t_p = time_evolution_params(perimeter_params=lat, cycles=2, nsteps=int(4e3))

"""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['H'].eigsh(k=1, which='SA')
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]))

"""evolve that energy and state"""
print('Starting Evolution')
ti = time()
psi_t = FHM.operator_dict["H"].evolve(psi_0, 0.0, t_p.times)
psi_t = np.squeeze(psi_t)
                       a_scale=1,
                       J_scale=1,
                       tracking=1)
"""Generating our class of scaled parameters for the twinned system."""
lat2 = hhg(field=param2.field,
           nup=param2.N_up,
           ndown=param2.N_down,
           nx=param2.L,
           ny=0,
           U=param2.U,
           t=param2.t0,
           F0=param2.F0,
           a=param2.a,
           pbc=param2.pbc)
"""setup our evolution time parameters"""
t_p = time_evolution_params(perimeter_params=lat, cycles=10, nsteps=int(2e3))

# 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"""
FHM1 = Fermi_Hubbard(lat, t_p.cycles)
FHM2 = Fermi_Hubbard(lat2, t_p.cycles)

print("Initial classes built. This took {:.2f} seconds".format(time() - ti))
"""get inital energy and state"""
print("Determining ground states of the two systems.")
ti = time()
E1, psi1_0 = FHM1.operator_dict['ham_init'].eigsh(k=1, which='SA')
psi1_0 = np.squeeze(psi1_0)
E2, psi2_0 = FHM2.operator_dict['ham_init'].eigsh(k=1, which='SA')
Example #4
0
E_track, psi_0_track = FHM.operator_dict['H'].eigsh(k=1, which='SA')
"""start running R tracking and prelim simulation starting with 1000 steps incrimenting by 100 until 10000"""
t_a_absolute_err = []
t_a_absolute_err_R_track = []
t_a_relative_err_R_track = []
t_a_absolute_err_R_prime_track = []
t_a_relative_err_R_prime_track = []
t_a_relative_err_delay = []
min_steps = 1000
max_steps = 10000
delta_steps = 100
for j in range(int((max_steps - min_steps) / delta_steps) + 1):
    # create our time parameters class
    n_steps = min_steps + j * delta_steps
    t_p = time_evolution_params(perimeter_params=lat, cycles=2, nsteps=n_steps)

    # evolve the untracked state
    psi_t = FHM.operator_dict["H"].evolve(psi_0, 0.0, t_p.times)
    psi_t = np.squeeze(psi_t)

    # find expectation from these states
    current = obs_vs_time(psi_t, t_p.times,
                          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'],