Ejemplo n.º 1
0
    def test_error_bound_superset_hubbard(self):
        FO = FermionOperator
        terms = []

        for i in [0, 2]:
            terms.append(
                FO(((i, 1), (i + 1, 0)), -0.01) + FO(((i + 1, 1),
                                                      (i, 0)), -0.01))

        for i in [0, 1]:
            terms.append(
                FO(((i, 1), (i + 2, 0)), -0.03) + FO(((i + 2, 1),
                                                      (i, 0)), -0.03))
            terms.append(FO(((i + 2, 1), (i, 1), (i + 2, 0), (i, 0)), 3.))

        indices = [
            set([0, 1]),
            set([2, 3]),
            set([0, 2]),
            set([0, 2]),
            set([1, 3]),
            set([1, 3])
        ]
        is_hopping_operator = [True, True, True, False, True, False]

        self.assertAlmostEqual(
            low_depth_second_order_trotter_error_bound(terms, indices,
                                                       is_hopping_operator),
            0.0608)
Ejemplo n.º 2
0
    def test_error_bound_using_info_even_side_length(self):
        # Generate the Hamiltonian.
        hamiltonian = normal_ordered(
            fermi_hubbard(4, 4, 0.5, 0.2, periodic=False))
        hamiltonian.compress()

        # Unpack result into terms, indices they act on, and whether they're
        # hopping operators.
        result = simulation_ordered_grouped_hubbard_terms_with_info(
            hamiltonian)
        terms, indices, is_hopping = result

        self.assertAlmostEqual(
            low_depth_second_order_trotter_error_bound(terms, indices,
                                                       is_hopping), 13.59)
Ejemplo n.º 3
0
    def test_error_bound_using_info_1d(self):
        # Generate the Hamiltonian.
        grid = hypercube_grid_with_given_wigner_seitz_radius_and_filling(
            dimension=1, grid_length=4, wigner_seitz_radius=10.)
        hamiltonian = normal_ordered(
            jellium_model(grid, spinless=True, plane_wave=False))
        hamiltonian.compress()

        # Unpack result into terms, indices they act on, and whether they're
        # hopping operators.
        result = simulation_ordered_grouped_low_depth_terms_with_info(
            hamiltonian)
        terms, indices, is_hopping = result
        self.assertAlmostEqual(
            low_depth_second_order_trotter_error_bound(terms, indices,
                                                       is_hopping),
            7.4239378440953283)
Ejemplo n.º 4
0
 def test_error_bound(self):
     self.assertAlmostEqual(
         low_depth_second_order_trotter_error_bound(self.terms,
                                                    jellium_only=True),
         6.92941899358)