VT=VT,
               alphaT=alphaT,
               nmax=nmax,
               OBC=OBC)

# Imaginary-time dynamics
G.many_time_steps(1.0j * dt, nsteps=nsteps)

# Print some output and save the density profile
print('End of ground-state search (via imaginary-time evolution)')
print('Chemical potential:         mu/U = %.6f' % (G.mu / G.U))
print('Final number of particles:  E/U =  %.6f' % G.N)
print('Final density:              <n> =  %.6f' % numpy.mean(G.density))
print('Final energy:               E/U =  %.6f' % (G.E / G.U))
print()
G.save_densities('data_ex3_densities_before_time_evolution.dat')

# Change some parameters
VT_new = VT * 0.1
G.update_VT(VT_new)

# Parameters for real-time evolution
dt = 0.01 / J
nsteps = 200

# Real-time evolution
alldata = []
for step in range(nsteps):
    alldata.append([step * dt * U] + numpy.array(G.density).tolist())
    G.many_time_steps(dt,
                      nsteps=1,
               U=U,
               mu=mu,
               D=D,
               L=L,
               VT=VT,
               alphaT=alphaT,
               nmax=nmax,
               OBC=OBC)

# Find ground state via imaginary-time dynamics
dt = 0.1 / J  # Time interval
nsteps = 200  # Number of time-evolution steps
G.many_time_steps(1.0j * dt, nsteps=nsteps)

# Print some output and save the density profile
G.save_densities('data_ex5_densities_pre_quench.dat')
print()
print('End of initial-state preparation (via imaginary-time dynamics)')
print('Chemical potential:   mu/U = %.8f, mu/J = %.8f' %
      (G.mu / G.U, G.mu / G.J))
print('Number of particles:  <N> =  %.6f' % G.N)
print('Energy:               E/U =  %.6f' % (G.E / G.U))
print()

# Save local state at site
site = L // 2
G.save_gutzwiller_coefficients_at_one_site(
    site, 'data_ex5_coefficients_pre_quench.dat')

# Quench
A = 2.0