コード例 #1
0
def generate_XXZ_hamiltonian(num_qubits, delta):
    #epsilon = 0.5
    if num_qubits == 1:
        raise(RuntimeError('Cannot generate Hamiltonian with 1 qubit'))
    else:
        hamiltonian = hcp.heisenberg_xyz_model(num_qubits, jx = 1, jy = 1, jz = delta)
    return hamiltonian
コード例 #2
0
import warnings
# warnings.filterwarnings("ignore", category=DeprecationWarning)

#Parameters
uptowhatK = 3
num_qubits = 3
endtime = 8
num_steps = 1001
optimizer = 'zvode'
p_invcond = 10**(-12)

#create initial state
initial_state = acp.Initialstate(num_qubits, "efficient_SU2", 123, 5)

#define Hamiltonian
hamiltonian = hcp.heisenberg_xyz_model(num_qubits)

#create Initial Ansatz for K = 0
ansatz = acp.initial_ansatz(num_qubits)

#finalresults
finalresults = []
finalresults.append(ansatz)

#Run QAS
for k in range(1, uptowhatK + 1):
    print(k)

    #Generate Ansatz for this round
    ansatz = acp.gen_next_ansatz(ansatz, hamiltonian, num_qubits)