def perform_imaginary_time_evolution_1D(J):
    if J == 0.15:
        E_expected = -3.9412627297
    elif J == 0.05:
        E_expected = -3.317526309839
    else:
        sys.exit('ERROR: test_imaginary_time_evolution_1D called with J=%s.' %
                 J)

    G = Gutzwiller(seed=12311123,
                   J=J,
                   U=1.0,
                   D=1,
                   mu=0.5,
                   L=19,
                   VT=0.02,
                   alphaT=2,
                   nmax=4,
                   OBC=1)
    G.many_time_steps(0.5j,
                      nsteps=1000,
                      normalize_at_each_step=1,
                      update_variables=0)
    print('J/U: %s' % (G.J / G.U))
    print('E:   %.12f' % G.E)
    print('E:   %.12f (expexted)' % E_expected)
    print()
    assert abs(G.E - E_expected) < 1e-4
예제 #2
0
def test_neighbors_reciprocity():
    for OBC in [0, 1]:
        for D in [1, 2]:
            for L in [5, 10]:
                G = Gutzwiller(D=D, L=L, OBC=OBC)
                for i_site in range(G.N_sites):
                    for j_nbr in range(G.N_nbr[i_site]):
                        j_site = G.nbr[i_site, j_nbr]
                        assert i_site in list(G.nbr[j_site, :])
def test_bisection_to_find_mu():
    Ntarget = 10.0
    tol = 0.1
    G = Gutzwiller(J=0.05,
                   U=1.0,
                   D=1,
                   mu=0.0,
                   L=15,
                   VT=0.05,
                   alphaT=2,
                   nmax=4,
                   OBC=1)
    n_iterations = G.set_mu_via_bisection(Ntarget=Ntarget,
                                          mu_min=-0.5,
                                          mu_max=1.5,
                                          tol_N=tol)
    print('#iterations: %i' % n_iterations)
    print('Ntarget:     %f' % Ntarget)
    print('G.mu:        %.8f   (N=%f)' % (G.mu, G.N))
    assert (G.N - Ntarget) < tol
예제 #4
0
def test_lattice_definition_2D():
    xy = numpy.empty(2, dtype=numpy.int32)
    for L in [2, 3, 10, 11]:
        G = Gutzwiller(D=2, L=L)
        for i_site in range(G.N_sites):
            x, y = G.site_coords[i_site, :]
            assert i_site == G.xy2i(x, y)
        for x, y in itertools.product(range(L), repeat=2):
            i_site = G.xy2i(x, y)
            G.i2xy(i_site, xy)
            assert x == xy[0]
            assert y == xy[1]
예제 #5
0
OBC = 0  # Whether to impose open (OBC=1) or periodic (OBC=0) boundary conditions
VT = 0.0  # Trap prefactor, as in V(r) = VT * r^alpha
alphaT = 0.0  # Trap exponent, as in V(r) = VT * r^alpha

# Parameters for the bisection algorithm (that is, to look for the chemical potential giving the right number of particles)
Ntarget = 17  # Expected number of particles
tol_N = 0.01  # Tolerance on the average N
mu_min = 0.0  # The bisection algorithm will search the optimal chemical potential in the interval [mu_min, mu_max]
mu_max = 2.0  # The bisection algorithm will search the optimal chemical potential in the interval [mu_min, mu_max]

# Initialize the state
G = Gutzwiller(seed=12312311,
               J=J,
               U=U,
               mu=-20.0,
               D=D,
               L=L,
               VT=VT,
               alphaT=alphaT,
               nmax=nmax,
               OBC=OBC)

# Perform bisection to find the right chemical potential
n_iterations = G.set_mu_via_bisection(Ntarget=Ntarget,
                                      mu_min=mu_min,
                                      mu_max=mu_max,
                                      tol_N=tol_N)

print()
print('Final chemical potential:   mu/U = %.6f' % (G.mu / G.U))
print('Final number of particles:  E/U =  %.6f' % G.N)
print('Final density:              <n> =  %.6f' % np.mean(G.density))
nmax = 4  # Cutoff on the local occupation
OBC = 1  # Whether to impose open (OBC=1) or periodic (OBC=0) boundary conditions
VT = 0.2  # Trap prefactor, as in V(r) = VT * r^alpha
alphaT = 2.0  # Trap exponent, as in V(r) = VT * r^alpha
mu = 1.2  # Chemical potential

# Parameters for imaginary-time evolution
dt = 0.1 / J  # Time interval, in units of
nsteps = 300  # Number of time-evolution steps

# Initialize the state
G = Gutzwiller(seed=12312311,
               J=J,
               U=U,
               mu=mu,
               D=D,
               L=L,
               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()
U = 0.2  # On-site repulsion
J = 1.0  # Hopping amplitude
mu = -0.49260342  # Chemical potential
nmax = 32  # Cutoff on the local occupation
OBC = 1  # Open (OBC=1) or periodic (OBC=0) boundary conditions
Ntarget = 20  # Target number of particles

VT = 0.3 * J  # Trap prefactor, as in V(r) = VT * r^alpha
alphaT = 2.0  # Trap exponent, as in V(r) = VT * r^alpha

# Initialize the state
G = Gutzwiller(seed=12312311,
               J=J,
               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' %
예제 #8
0
OBC = 0  # Whether to impose open (OBC=1) or periodic (OBC=0) boundary conditions
VT = 0.0  # Trap prefactor, as in V(r) = VT * r^alpha
alphaT = 0.0  # Trap exponent, as in V(r) = VT * r^alpha
mu = 1.2  # Chemical potential

# Parameters for imaginary-time evolution
dt = 0.1 / J  # Time interval, in units of
nsteps = 200  # Number of time-evolution steps

# Initialize the state
G = Gutzwiller(seed=12312311,
               J=J,
               U=U,
               mu=mu,
               D=D,
               L=L,
               Vnn=Vnn,
               VT=VT,
               alphaT=alphaT,
               nmax=nmax,
               OBC=OBC)
G.print_parameters()

# Imaginary-time dynamics
G.many_time_steps(1.0j * dt, nsteps=nsteps)
print('Optimization completed')
print('Number of particles:  <N> =  %.6f' % G.N)
print('Energy:               E/U =  %.6f' % (G.E / G.U))
print('Densities:')
for i_site in range(G.N_sites):
    print('    site %2i, n=%.6f' % (i_site, G.density[i_site]))