I'm just getting started with OpenQASM, but I'm feeling a bit confused. Is there a way to run the
.qasm file I've written in Qiskit (i.e. in Python), or is OpenQasm only meant to be used within the IBM Quantum experience?
You can use qasm files to create a quantum circuit, two ways : via the methods
from_qasm_file on a
QuantumCircuit. See the documentation about this. For example :
test = ''' OPENQASM 2.0; include "qelib1.inc"; qreg q; creg c; h q; cx q,q; ''' from qiskit import QuantumCircuit qc = QuantumCircuit.from_qasm_str(test)
This will create a
QuantumCircuit from the str
test. The same syntax work with the other method, just replace
test with the path to the qasm file.
Hope this helps! :)