Created
March 19, 2021 02:35
-
-
Save brandonlou/7d96427b1e9fed8650407510e804f1a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cirq | |
from qiskit import IBMQ, execute, QuantumCircuit | |
IBMQ.save_account('API_TOKEN') # Make a IBMQ account and copy your API token here. | |
provider = IBMQ.load_account() | |
backend = provider.backend.ibmq_athens # Change as necessary. | |
circuit = cirq.Circuit() | |
# Create your cirq circuit here. | |
# Convert cirq circuit to QASM. | |
qasm_output = cirq.QasmOutput((circuit.all_operations()), qubits) | |
# Convert to qiskit circuit. | |
qiskit_circuit = QuantumCircuit().from_qasm_str(str(qasm_output)) | |
# print(qiskit_circuit) | |
# Run on IBM's computer. | |
job = execute(qiskit_circuit, backend, shots=1000) | |
# Keep track of the job ID! | |
print('Job ID:', job.job_id()) | |
# This might take a few minutes to hours depending on the backend. | |
result = job.result() | |
counts = result.get_counts() | |
print(counts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment