Last active
March 4, 2021 20:58
-
-
Save brianlechthaler/d26ab5f37f99808876da4681e859e123 to your computer and use it in GitHub Desktop.
VQE UCCSD Ansatz in QASM 2.0
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
OPENQASM 2.0; | |
include "qelib1.inc"; | |
qreg q[5]; | |
creg c[5]; | |
# Initialize Hartree Fock State | |
x q[0]; | |
x q[1]; | |
rx(pi/2) q[0]; | |
h q[1]; | |
h q[2]; | |
h q[3]; | |
h q[4]; | |
cx q[0],q[1]; | |
cx q[1],q[2]; | |
cx q[2],q[3]; | |
cx q[3],q[4]; | |
//theta parameter | |
rz(0) q[4]; | |
cx q[3],q[4]; | |
cx q[2],q[3]; | |
h q[4]; | |
cx q[1],q[2]; | |
h q[3]; | |
cx q[0],q[1]; | |
h q[2]; | |
measure q[4] -> c[4]; | |
rx(-pi/2) q[0]; | |
h q[1]; | |
measure q[3] -> c[3]; | |
measure q[2] -> c[2]; | |
measure q[1] -> c[1]; | |
measure q[0] -> c[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment