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)
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)