from qiskit import *
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit import IBMQ, Aer, execute,assemble,QuantumCircuit, aqua
from qiskit.visualization import plot_histogram, plot_bloch_vector, plot_bloch_multivector
from qiskit.quantum_info import Statevector
from qiskit.extensions import *
provider = IBMQ.load_account()

from qiskit.quantum_info import random_unitary

import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import math
from math import pi, sqrt
from qiskit.circuit import Parameter

from random import seed
from random import random
import cmath


#circuit 1

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(8):
    theta.append((Parameter('θ'+str(i))))

for i in range(4):
    qc.rx(theta[i],qr[i])
for i in range(4):
    qc.rz(theta[i+4],qr[i])    
qc.draw('mpl')

#circuit 2

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(8):
    theta.append((Parameter('θ'+str(i))))

for i in range(4):
    qc.rx(theta[i],qr[i])
for i in range(4):
    qc.rz(theta[i+4],qr[i])
qc.cx(qr[3],qr[2])
qc.cx(qr[2],qr[1])
qc.cx(qr[1],qr[0])
    
qc.draw('mpl')

#circuit 3

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(11):
    theta.append((Parameter('θ'+str(i))))

for i in range(4):
    qc.rx(theta[i],qr[i])
for i in range(4):
    qc.rz(theta[i+4],qr[i])
    
qc.crz(theta[8],qr[3],qr[2])
qc.crz(theta[9],qr[2],qr[1])
qc.crz(theta[10],qr[1],qr[0])
    
qc.draw('mpl')

#circuit 4

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(11):
    theta.append((Parameter('θ'+str(i))))

for i in range(4):
    qc.rx(theta[i],qr[i])
for i in range(4):
    qc.rz(theta[i+4],qr[i])
    
qc.crx(theta[8],qr[3],qr[2])
qc.crx(theta[9],qr[2],qr[1])
qc.crx(theta[10],qr[1],qr[0])
    
qc.draw('mpl')

#circuit 5

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1

qc.barrier(qr)    

for j in range(4):
    for i in range(4):
        if i!=j:
            qc.crz(theta[count],qr[3-j],qr[3-i])
            count=count+1

qc.barrier(qr)    

for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
        
        
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1
 
        
qc.draw('mpl')

#circuit 6

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1

qc.barrier(qr)    

for j in range(4):
    for i in range(4):
        if i!=j:
            qc.crx(theta[count],qr[3-j],qr[3-i])
            count=count+1

qc.barrier(qr)    

for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
        
        
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1
 
        
qc.draw('mpl')

#circuit 7

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1

qc.barrier(qr)    

qc.crz(theta[count],qr[1],qr[0])
count=count+1

qc.crz(theta[count],qr[3],qr[2])
count=count+1


qc.barrier(qr)    

for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
        
        
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1

qc.barrier(qr)   

qc.crz(theta[count],qr[2],qr[1])

qc.draw('mpl')

#circuit 8

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1

qc.barrier(qr)    

qc.crx(theta[count],qr[1],qr[0])
count=count+1

qc.crx(theta[count],qr[3],qr[2])
count=count+1


qc.barrier(qr)    

for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
        
        
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1

qc.barrier(qr)   

qc.crx(theta[count],qr[2],qr[1])

qc.draw('mpl')

#circuit 9

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.h(qr[i])

qc.barrier(qr)    

qc.cz(qr[3],qr[2])
qc.cz(qr[2],qr[1])
qc.cz(qr[1],qr[0])



qc.barrier(qr)    

        
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1


qc.draw('mpl')

#circuit 10

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1

qc.barrier(qr)    

qc.cz(qr[3],qr[2])
qc.cz(qr[2],qr[1])
qc.cz(qr[1],qr[0])
qc.cz(qr[3],qr[0])



qc.barrier(qr)    

        
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1


qc.draw('mpl')

#circuit 11

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1
        
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1    
    
qc.barrier(qr)    

qc.cx(qr[1],qr[0])
qc.cx(qr[3],qr[2])

qc.barrier(qr)    

qc.ry(theta[count],qr[1])
count=count+1 
qc.ry(theta[count],qr[2])
count=count+1 
qc.rz(theta[count],qr[1])
count=count+1 
qc.rz(theta[count],qr[2])

qc.cx(qr[2],qr[1])




qc.draw('mpl')

#circuit 12

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1
        
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1    
    
qc.barrier(qr)    

qc.cz(qr[1],qr[0])
qc.cz(qr[3],qr[2])

qc.barrier(qr)    

qc.ry(theta[count],qr[1])
count=count+1 
qc.ry(theta[count],qr[2])
count=count+1 
qc.rz(theta[count],qr[1])
count=count+1 
qc.rz(theta[count],qr[2])

qc.cz(qr[2],qr[1])




qc.draw('mpl')

#circuit 13

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1

    
qc.barrier(qr)    

qc.crz(theta[count],qr[3],qr[0])
count=count+1 
qc.crz(theta[count],qr[2],qr[3])
count=count+1 
qc.crz(theta[count],qr[1],qr[2])
count=count+1 
qc.crz(theta[count],qr[0],qr[1])
count=count+1 

qc.barrier(qr)    

        
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1    

qc.barrier(qr)    

qc.crz(theta[count],qr[3],qr[2])
count=count+1 
qc.crz(theta[count],qr[0],qr[3])
count=count+1 
qc.crz(theta[count],qr[1],qr[0])
count=count+1 
qc.crz(theta[count],qr[2],qr[1])



qc.draw('mpl')

#circuit 14

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1

    
qc.barrier(qr)    

qc.crx(theta[count],qr[3],qr[0])
count=count+1 
qc.crx(theta[count],qr[2],qr[3])
count=count+1 
qc.crx(theta[count],qr[1],qr[2])
count=count+1 
qc.crx(theta[count],qr[0],qr[1])
count=count+1 

qc.barrier(qr)    

        
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1    

qc.barrier(qr)    

qc.crx(theta[count],qr[3],qr[2])
count=count+1 
qc.crx(theta[count],qr[0],qr[3])
count=count+1 
qc.crx(theta[count],qr[1],qr[0])
count=count+1 
qc.crx(theta[count],qr[2],qr[1])


qc.draw('mpl')

#circuit 15

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1

    
qc.barrier(qr)    

qc.cx(qr[3],qr[0])
count=count+1 
qc.cx(qr[2],qr[3])
count=count+1 
qc.cx(qr[1],qr[2])
count=count+1 
qc.cx(qr[0],qr[1])
count=count+1 

qc.barrier(qr)    

        
for i in range(4):
    qc.ry(theta[count],qr[i])
    count=count+1    

qc.barrier(qr)    

qc.cx(qr[3],qr[2])
count=count+1 
qc.cx(qr[0],qr[3])
count=count+1 
qc.cx(qr[1],qr[0])
count=count+1 
qc.cx(qr[2],qr[1])



qc.draw('mpl')

#circuit 16

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
    
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1
    
qc.barrier(qr)    

qc.crz(theta[count],qr[1],qr[0])
count=count+1
qc.crz(theta[count],qr[3],qr[2])
count=count+1
qc.crz(theta[count],qr[2],qr[1])



qc.draw('mpl')

#circuit 17

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
    
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1
    
qc.barrier(qr)    

qc.crx(theta[count],qr[1],qr[0])
count=count+1
qc.crx(theta[count],qr[3],qr[2])
count=count+1
qc.crx(theta[count],qr[2],qr[1])



qc.draw('mpl')

#circuit 18

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
    
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1
    
qc.barrier(qr)    

qc.crz(theta[count],qr[3],qr[0])
count=count+1
qc.crz(theta[count],qr[2],qr[3])
count=count+1
qc.crz(theta[count],qr[1],qr[2])
count=count+1
qc.crz(theta[count],qr[0],qr[1])


qc.draw('mpl')

#circuit 19

qr = QuantumRegister(4)
qc = QuantumCircuit(qr)

theta=[]
for i in range(28):
    theta.append((Parameter('θ'+str(i))))
count=0
    
for i in range(4):
    qc.rx(theta[count],qr[i])
    count=count+1
    
for i in range(4):
    qc.rz(theta[count],qr[i])
    count=count+1
    
qc.barrier(qr)    

qc.crx(theta[count],qr[3],qr[0])
count=count+1
qc.crx(theta[count],qr[2],qr[3])
count=count+1
qc.crx(theta[count],qr[1],qr[2])
count=count+1
qc.crx(theta[count],qr[0],qr[1])


qc.draw('mpl')

