Closed quantum-rookie closed 3 years ago
Looks like you are generating a circuit below half filling. The example in the openfermion paper is for half filling. I'd need to see the code you used to generate this plot to help diagnose any potential problem.
Ok. The following code:
import cirq import openfermion import openfermioncirq as ofc
hubbard_model = openfermion.fermi_hubbard(2, 2, 1.0, 4.0) quad_ham = openfermion.get_quadratic_hamiltonian(hubbard_model, ignore_incompatible_terms=True)
qubits = cirq.LineQubit.range(8) circuit = cirq.Circuit.from_ops( ofc.prepare_gaussian_state(qubits, quad_ham) )
print (circuit.to_text_diagram(transpose=False , use_unicode_characters=False))
Looks like you are generating a circuit below half filling. The example in the openfermion paper is for half filling. I'd need to see the code you used to generate this plot to help diagnose any potential problem.
so could you tell me how to change the number of electrons in Hubbard model
@quantum-rookie You can specify the orbitals to occupy by passing the occupied_orbitals
argument. The orbitals are in ascending order by energy, so to fill the lowest energy 4 orbitals (out of 8) you would do
ofc.prepare_gaussian_state(qubits, quad_ham, occupied_orbitals=range(4))
If you want to fill 2 spin-up orbitals and 2 spin-down orbitals, then pass in 2 sequences:
openfermion.prepare_gaussian_state(qubits, quad_ham, occupied_orbitals=[range(2), range(2)])
i dont know why. so far so bad.
python 3.85
openfermion 0.11.0
openfermioncirq 0.40
cirq0.8.2
@kevinsung
Circuit.from_ops
was removed in cirq 0.8. Instead of Circuit.from_ops(...)
, just do Circuit(...)
. Or downgrade to cirq 0.7.
ok. i really appreciate your help. thank you!
Hi.when i tried to get the ground state of the tunneling term of a FermiHubbard model Hamiltonian in pycharm, The circuit diagrams I got were different from those in the literature(OpenFermion: The Electronic Structure Package for Quantum Computers).What's wrong?![image](https://user-images.githubusercontent.com/63296937/84374758-0a924100-ac11-11ea-99c1-263f218e9690.png)