-
Notifications
You must be signed in to change notification settings - Fork 401
Description
Describe the issue
I am trying to use the LOW_RANK trotter simulation algorithm to simulate a Hamiltonian involving a particular type of fermionic interaction term-- spin exchange (see code below). However, I keep receiving 'TypeError: Invalid two-body coefficient tensor specification.', which traces back to low_rank.py. On looking through low_rank.py it appears as if the problem may be arising around lines 61-66 (there is a comment on line 60 that expresses a requirement for a spin-symmetric interaction)? This interaction term, while spin-dependent, should be spin symmetric so I'm a bit confused. Thanks!
What version of this software are you using?
Cirq version 1.6.1, Openfermion version 1.7.1
How can the issue be reproduced?
`import cirq
from openfermion.ops import FermionOperator
from openfermion import get_interaction_operator, count_qubits
from openfermion.circuits import simulate_trotter
Orbital mapping is just for illustration purposes. Maps spin-orbitals to Hamiltonian indices.
sites = [f"{ii}" for ii in range(0, 2)] # Spatial sites
spins = ["up", "down"] # Spin d.o.f.
orbital_map = {spin_orbital: ii for ii, spin_orbital in
enumerate([site + "_" + spin for site in sites for spin in spins])}
Create a simple spin-exchange Hamiltonian on two spatial orbitals (4 SOs)
h_sf = FermionOperator('0^ 3^ 1 2', 1.) + FermionOperator('2^ 1^ 3 0', 1.)
assert(2 * len(sites) == count_qubits(h_sf))
Create interaction Hamiltonian and Trotter circuit
sf_interaction_hamiltonian = get_interaction_operator(h_sf, n_qubits=2 * len(sites))
circuit = cirq.Circuit(simulate_trotter(qubits=2 * len(sites), hamiltonian=sf_interaction_hamiltonian, time=1))`