Skip to content

Instantly share code, notes, and snippets.

@brianlechthaler
Last active March 4, 2021 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianlechthaler/d26ab5f37f99808876da4681e859e123 to your computer and use it in GitHub Desktop.
Save brianlechthaler/d26ab5f37f99808876da4681e859e123 to your computer and use it in GitHub Desktop.
VQE UCCSD Ansatz in QASM 2.0
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