Spaces:
Runtime error
Runtime error
harishaseebat92
commited on
Commit
·
0b9c171
1
Parent(s):
a1277c9
update qlbm_sample_app.py to include the T=0 snapshot in the hardware results (saving QPU costs by computing the initial state locally) and modify qlbm_embedded.py to integrate the IonQ backend
Browse files- qlbm/qlbm_sample_app.py +57 -27
- qlbm_embedded.py +81 -2
qlbm/qlbm_sample_app.py
CHANGED
|
@@ -130,15 +130,15 @@ def get_coeffs(n,ux,uy,uz,resolution=32):
|
|
| 130 |
y_coeffs,y_coeff_var_indices=get_circuit_inputs(lambda x,y,z: ((1+uy(x/current_N,y/current_N,z/current_N))/2)**0.5,n,min(current_N,resolution))
|
| 131 |
z_coeffs,z_coeff_var_indices=get_circuit_inputs(lambda x,y,z: ((1+uz(x/current_N,y/current_N,z/current_N))/2)**0.5,n,min(current_N,resolution))
|
| 132 |
x_coeffs_,x_coeff_var_indices_=get_circuit_inputs(lambda x,y,z: 0 if (1+ux((x-1)/current_N,y/current_N,z/current_N))==0 else \
|
| 133 |
-
((1+ux((x-1)/current_N,y/current_N,z/current_N))/(2+ux((x-1)/current_N,y
|
| 134 |
y_coeffs_,y_coeff_var_indices_=get_circuit_inputs(lambda x,y,z: 0 if (1+uy(x/current_N,(y-1)/current_N,z/current_N))==0 else \
|
| 135 |
-
((1+uy(x/current_N,(y-1)/current_N,z/current_N))/(2+uy(x/current_N,(y-1)/current_N,z
|
| 136 |
z_coeffs_,z_coeff_var_indices_=get_circuit_inputs(lambda x,y,z: 0 if (1+uz(x/current_N,y/current_N,(z-1)/current_N))==0 else \
|
| 137 |
-
((1+uz(x/current_N,y/current_N,(z-1)/current_N))/(2+uz(x/current_N,y
|
| 138 |
unprep1_coeffs,unprep1_coeff_var_indices=get_circuit_inputs(lambda x,y,z:\
|
| 139 |
-
(1/3**0.5)*(1+(ux((x-1)/current_N,y/current_N,z/current_N)-ux((x+1)/current_N,y
|
| 140 |
unprep2_coeffs,unprep2_coeff_var_indices=get_circuit_inputs(lambda x,y,z:\
|
| 141 |
-
((1+(uy(x/current_N,(y-1)/current_N,z/current_N)-uy(x/current_N,(y+1)/current_N,z
|
| 142 |
|
| 143 |
return x_coeffs,x_coeff_var_indices, y_coeffs,y_coeff_var_indices, z_coeffs,z_coeff_var_indices,\
|
| 144 |
x_coeffs_,x_coeff_var_indices_, y_coeffs_,y_coeff_var_indices_, z_coeffs_,z_coeff_var_indices_,\
|
|
@@ -577,17 +577,29 @@ def run_sampling_hw_ibm(
|
|
| 577 |
sampler = Sampler(mode=backend)
|
| 578 |
|
| 579 |
# # Submit job: pass a list of PUBs (we send one PUB [qc_compiled])
|
| 580 |
-
job = sampler.run(qc_compiled_list, shots=shots)
|
| 581 |
-
log("Job submitted; waiting for result...")
|
| 582 |
|
| 583 |
def get_job_result(j):
|
| 584 |
result = j.result() # PrimitiveResult (a container of PubResults)
|
| 585 |
log("Waiting for job results (this may take time)...")
|
| 586 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 587 |
output=[]
|
| 588 |
|
| 589 |
for T_total,pub in zip(T_list,result):
|
| 590 |
-
|
| 591 |
# Try join_data() to combine multiple regs and get_counts() on it
|
| 592 |
try:
|
| 593 |
joined = pub.join_data() # join_data concatenates registers along bits axis
|
|
@@ -601,7 +613,18 @@ def run_sampling_hw_ibm(
|
|
| 601 |
output+=[estimate_density(pts, counts, bandwidth=0.05, grid_size=output_resolution)]
|
| 602 |
|
| 603 |
log(f"Processing complete: {len(output)} timestep(s)")
|
| 604 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 605 |
return output, fig
|
| 606 |
|
| 607 |
return job,get_job_result
|
|
@@ -659,34 +682,31 @@ def run_sampling_hw_ionq(
|
|
| 659 |
else:
|
| 660 |
print(msg)
|
| 661 |
|
| 662 |
-
# if type(ux)==str:
|
| 663 |
-
# ux,uy,uz=str_to_lambda(ux,uy,uz)
|
| 664 |
-
|
| 665 |
-
# # Convert string init_state_prep_circ to circuit if needed (matches original logic)
|
| 666 |
-
# if type(init_state_prep_circ)==str:
|
| 667 |
-
# init_state_prep_circ=get_named_init_state_circuit(n,init_state_prep_circ)
|
| 668 |
-
|
| 669 |
# backend = provider.get_backend("simulator")
|
| 670 |
backend = provider.get_backend("qpu.forte-enterprise-1")
|
| 671 |
|
| 672 |
qc_list=get_circuit(n,ux,uy,uz,init_state_prep_circ,T_list,vel_resolution,flag_qubits=flag_qubits,midcircuit_meas=False)
|
| 673 |
|
| 674 |
-
# Create Sampler primitive bound to the backend
|
| 675 |
-
|
| 676 |
job = backend.run(qc_list, shots=shots)
|
| 677 |
-
|
| 678 |
-
# job = backend.retrieve_job("019b0aec-36d7-749a-89f2-c36382b3aa1c")
|
| 679 |
-
|
| 680 |
-
# sampler = Sampler(mode=backend)
|
| 681 |
-
|
| 682 |
-
# # Submit job: pass a list of PUBs (we send one PUB [qc_compiled])
|
| 683 |
-
# job = sampler.run(qc_compiled_list, shots=shots)
|
| 684 |
log("Job submitted; waiting for result...")
|
| 685 |
|
| 686 |
def get_job_result(j):
|
| 687 |
|
| 688 |
log("Waiting for job results (this may take time)...")
|
| 689 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 690 |
output=[]
|
| 691 |
|
| 692 |
for i,T_total in enumerate(T_list):
|
|
@@ -698,7 +718,17 @@ def run_sampling_hw_ionq(
|
|
| 698 |
output+=[estimate_density(pts, counts, bandwidth=0.05, grid_size=output_resolution)]
|
| 699 |
|
| 700 |
log(f"Processing complete: {len(output)} timestep(s)")
|
| 701 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 702 |
return output, fig
|
| 703 |
|
| 704 |
return job,get_job_result
|
|
@@ -778,7 +808,7 @@ def run_sampling_sim(
|
|
| 778 |
result = job.result()
|
| 779 |
data_all = result.data()
|
| 780 |
|
| 781 |
-
statevector_keys = list(dict(data_all['statevector']).keys())
|
| 782 |
|
| 783 |
# Look for the zero branch (0x0)
|
| 784 |
zero_key = None
|
|
|
|
| 130 |
y_coeffs,y_coeff_var_indices=get_circuit_inputs(lambda x,y,z: ((1+uy(x/current_N,y/current_N,z/current_N))/2)**0.5,n,min(current_N,resolution))
|
| 131 |
z_coeffs,z_coeff_var_indices=get_circuit_inputs(lambda x,y,z: ((1+uz(x/current_N,y/current_N,z/current_N))/2)**0.5,n,min(current_N,resolution))
|
| 132 |
x_coeffs_,x_coeff_var_indices_=get_circuit_inputs(lambda x,y,z: 0 if (1+ux((x-1)/current_N,y/current_N,z/current_N))==0 else \
|
| 133 |
+
((1+ux((x-1)/current_N,y/current_N,z/current_N))/(2+ux((x-1)/current_N,y,current_N,z,current_N)-ux((x+1)/current_N,y,current_N,z,current_N)))**0.5,n,min(current_N,resolution))
|
| 134 |
y_coeffs_,y_coeff_var_indices_=get_circuit_inputs(lambda x,y,z: 0 if (1+uy(x/current_N,(y-1)/current_N,z/current_N))==0 else \
|
| 135 |
+
((1+uy(x/current_N,(y-1)/current_N,z/current_N))/(2+uy(x/current_N,(y-1)/current_N,z,current_N)-uy(x/current_N,(y+1)/current_N,z,current_N)))**0.5,n,min(current_N,resolution))
|
| 136 |
z_coeffs_,z_coeff_var_indices_=get_circuit_inputs(lambda x,y,z: 0 if (1+uz(x/current_N,y/current_N,(z-1)/current_N))==0 else \
|
| 137 |
+
((1+uz(x/current_N,y/current_N,(z-1)/current_N))/(2+uz(x/current_N,y,current_N,(z-1)/current_N)-uz(x/current_N,y,current_N,(z+1)/current_N)))**0.5,n,min(current_N,resolution))
|
| 138 |
unprep1_coeffs,unprep1_coeff_var_indices=get_circuit_inputs(lambda x,y,z:\
|
| 139 |
+
(1/3**0.5)*(1+(ux((x-1)/current_N,y/current_N,z/current_N)-ux((x+1)/current_N,y,current_N,z,current_N))/2)**0.5,n,min(current_N,resolution))
|
| 140 |
unprep2_coeffs,unprep2_coeff_var_indices=get_circuit_inputs(lambda x,y,z:\
|
| 141 |
+
((1+(uy(x/current_N,(y-1)/current_N,z/current_N)-uy(x/current_N,(y+1)/current_N,z,current_N))/2)/(2-(ux((x-1)/current_N,y,current_N,z,current_N)-ux((x+1)/current_N,y,current_N,z,current_N))/2))**0.5,n,min(current_N,resolution))
|
| 142 |
|
| 143 |
return x_coeffs,x_coeff_var_indices, y_coeffs,y_coeff_var_indices, z_coeffs,z_coeff_var_indices,\
|
| 144 |
x_coeffs_,x_coeff_var_indices_, y_coeffs_,y_coeff_var_indices_, z_coeffs_,z_coeff_var_indices_,\
|
|
|
|
| 577 |
sampler = Sampler(mode=backend)
|
| 578 |
|
| 579 |
# # Submit job: pass a list of PUBs (we send one PUB [qc_compiled])
|
| 580 |
+
# job = sampler.run(qc_compiled_list, shots=shots)
|
| 581 |
+
# log("Job submitted; waiting for result...")
|
| 582 |
|
| 583 |
def get_job_result(j):
|
| 584 |
result = j.result() # PrimitiveResult (a container of PubResults)
|
| 585 |
log("Waiting for job results (this may take time)...")
|
| 586 |
|
| 587 |
+
# --- NEW: Calculate T=0 snapshot locally ---
|
| 588 |
+
initial_snapshot = None
|
| 589 |
+
try:
|
| 590 |
+
initial_snapshot = show_initial_distribution(
|
| 591 |
+
n=n,
|
| 592 |
+
init_state_circuit=init_state_prep_circ,
|
| 593 |
+
plot=False,
|
| 594 |
+
return_data=True
|
| 595 |
+
)
|
| 596 |
+
except Exception as e:
|
| 597 |
+
log(f"Warning: Could not compute T=0 snapshot: {e}")
|
| 598 |
+
# -------------------------------------------
|
| 599 |
+
|
| 600 |
output=[]
|
| 601 |
|
| 602 |
for T_total,pub in zip(T_list,result):
|
|
|
|
| 603 |
# Try join_data() to combine multiple regs and get_counts() on it
|
| 604 |
try:
|
| 605 |
joined = pub.join_data() # join_data concatenates registers along bits axis
|
|
|
|
| 613 |
output+=[estimate_density(pts, counts, bandwidth=0.05, grid_size=output_resolution)]
|
| 614 |
|
| 615 |
log(f"Processing complete: {len(output)} timestep(s)")
|
| 616 |
+
|
| 617 |
+
# --- NEW: Prepend T=0 to output ---
|
| 618 |
+
plot_T_list = list(T_list)
|
| 619 |
+
if initial_snapshot is not None:
|
| 620 |
+
initial_density, _ = initial_snapshot
|
| 621 |
+
# Only prepend if T=0 isn't already in the list
|
| 622 |
+
if not (plot_T_list and plot_T_list[0] == 0):
|
| 623 |
+
output.insert(0, initial_density)
|
| 624 |
+
plot_T_list.insert(0, 0)
|
| 625 |
+
# ----------------------------------
|
| 626 |
+
|
| 627 |
+
fig = plot_density_isosurface_slider(output, plot_T_list)
|
| 628 |
return output, fig
|
| 629 |
|
| 630 |
return job,get_job_result
|
|
|
|
| 682 |
else:
|
| 683 |
print(msg)
|
| 684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 685 |
# backend = provider.get_backend("simulator")
|
| 686 |
backend = provider.get_backend("qpu.forte-enterprise-1")
|
| 687 |
|
| 688 |
qc_list=get_circuit(n,ux,uy,uz,init_state_prep_circ,T_list,vel_resolution,flag_qubits=flag_qubits,midcircuit_meas=False)
|
| 689 |
|
|
|
|
|
|
|
| 690 |
job = backend.run(qc_list, shots=shots)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 691 |
log("Job submitted; waiting for result...")
|
| 692 |
|
| 693 |
def get_job_result(j):
|
| 694 |
|
| 695 |
log("Waiting for job results (this may take time)...")
|
| 696 |
|
| 697 |
+
# --- NEW: Calculate T=0 snapshot locally ---
|
| 698 |
+
initial_snapshot = None
|
| 699 |
+
try:
|
| 700 |
+
initial_snapshot = show_initial_distribution(
|
| 701 |
+
n=n,
|
| 702 |
+
init_state_circuit=init_state_prep_circ,
|
| 703 |
+
plot=False,
|
| 704 |
+
return_data=True
|
| 705 |
+
)
|
| 706 |
+
except Exception as e:
|
| 707 |
+
log(f"Warning: Could not compute T=0 snapshot: {e}")
|
| 708 |
+
# -------------------------------------------
|
| 709 |
+
|
| 710 |
output=[]
|
| 711 |
|
| 712 |
for i,T_total in enumerate(T_list):
|
|
|
|
| 718 |
output+=[estimate_density(pts, counts, bandwidth=0.05, grid_size=output_resolution)]
|
| 719 |
|
| 720 |
log(f"Processing complete: {len(output)} timestep(s)")
|
| 721 |
+
|
| 722 |
+
# --- NEW: Prepend T=0 to output ---
|
| 723 |
+
plot_T_list = list(T_list)
|
| 724 |
+
if initial_snapshot is not None:
|
| 725 |
+
initial_density, _ = initial_snapshot
|
| 726 |
+
if not (plot_T_list and plot_T_list[0] == 0):
|
| 727 |
+
output.insert(0, initial_density)
|
| 728 |
+
plot_T_list.insert(0, 0)
|
| 729 |
+
# ----------------------------------
|
| 730 |
+
|
| 731 |
+
fig = plot_density_isosurface_slider(output, plot_T_list)
|
| 732 |
return output, fig
|
| 733 |
|
| 734 |
return job,get_job_result
|
|
|
|
| 808 |
result = job.result()
|
| 809 |
data_all = result.data()
|
| 810 |
|
| 811 |
+
statevector_keys = list(dict(data_all['statevector']).keys());
|
| 812 |
|
| 813 |
# Look for the zero branch (0x0)
|
| 814 |
zero_key = None
|
qlbm_embedded.py
CHANGED
|
@@ -30,6 +30,7 @@ try:
|
|
| 30 |
from qlbm.qlbm_sample_app import (
|
| 31 |
run_sampling_sim,
|
| 32 |
run_sampling_hw_ibm,
|
|
|
|
| 33 |
get_named_init_state_circuit,
|
| 34 |
str_to_lambda,
|
| 35 |
_create_slider_figure,
|
|
@@ -1105,6 +1106,13 @@ def run_simulation():
|
|
| 1105 |
_state.qlbm_selected_qpu == "IBM QPU" and
|
| 1106 |
_QISKIT_BACKEND_AVAILABLE
|
| 1107 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1108 |
|
| 1109 |
# Log initial configuration
|
| 1110 |
backend_info = f"{_state.qlbm_backend_type}"
|
|
@@ -1200,9 +1208,12 @@ def run_simulation():
|
|
| 1200 |
if hasattr(_ctrl, "qlbm_qiskit_result_update"):
|
| 1201 |
_ctrl.qlbm_qiskit_result_update(plotly_fig)
|
| 1202 |
|
|
|
|
|
|
|
|
|
|
| 1203 |
_state.qlbm_max_time_step = len(output) - 1
|
| 1204 |
_state.qlbm_time_val = 0
|
| 1205 |
-
_state.qlbm_time_slider_labels = [f"T={t}" for t in
|
| 1206 |
_state.qlbm_simulation_has_run = True
|
| 1207 |
_state.qlbm_qiskit_mode = True
|
| 1208 |
|
|
@@ -1211,6 +1222,68 @@ def run_simulation():
|
|
| 1211 |
_state.qlbm_status_message = "Simulation completed successfully."
|
| 1212 |
_state.qlbm_status_type = "success"
|
| 1213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1214 |
# === CUDA-Q Backend ===
|
| 1215 |
elif _state.qlbm_backend_type == "Simulator" and _state.qlbm_selected_simulator == "CUDA-Q simulator":
|
| 1216 |
_state.qlbm_qiskit_mode = False # Use PyVista display
|
|
@@ -1725,7 +1798,13 @@ def _build_control_panels(plotter):
|
|
| 1725 |
)
|
| 1726 |
with vuetify3.VMenu(open_on_hover=True, close_on_content_click=True, location="end"):
|
| 1727 |
with vuetify3.Template(v_slot_activator="{ props }"):
|
| 1728 |
-
vuetify3.VBtn(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1729 |
with vuetify3.VList(density="compact"):
|
| 1730 |
with vuetify3.VMenu(open_on_hover=True, close_on_content_click=True, location="end", offset=8):
|
| 1731 |
with vuetify3.Template(v_slot_activator="{ props }"):
|
|
|
|
| 30 |
from qlbm.qlbm_sample_app import (
|
| 31 |
run_sampling_sim,
|
| 32 |
run_sampling_hw_ibm,
|
| 33 |
+
run_sampling_hw_ionq, # <--- Added import
|
| 34 |
get_named_init_state_circuit,
|
| 35 |
str_to_lambda,
|
| 36 |
_create_slider_figure,
|
|
|
|
| 1106 |
_state.qlbm_selected_qpu == "IBM QPU" and
|
| 1107 |
_QISKIT_BACKEND_AVAILABLE
|
| 1108 |
)
|
| 1109 |
+
# --- NEW: IonQ Detection ---
|
| 1110 |
+
use_ionq_qpu = (
|
| 1111 |
+
_state.qlbm_backend_type == "QPU" and
|
| 1112 |
+
_state.qlbm_selected_qpu == "IonQ QPU" and
|
| 1113 |
+
_QISKIT_BACKEND_AVAILABLE
|
| 1114 |
+
)
|
| 1115 |
+
# ---------------------------
|
| 1116 |
|
| 1117 |
# Log initial configuration
|
| 1118 |
backend_info = f"{_state.qlbm_backend_type}"
|
|
|
|
| 1208 |
if hasattr(_ctrl, "qlbm_qiskit_result_update"):
|
| 1209 |
_ctrl.qlbm_qiskit_result_update(plotly_fig)
|
| 1210 |
|
| 1211 |
+
# Update slider labels (include T=0 if present)
|
| 1212 |
+
final_T_list = [0] + params["T_list"] if len(output) > len(params["T_list"]) else params["T_list"]
|
| 1213 |
+
|
| 1214 |
_state.qlbm_max_time_step = len(output) - 1
|
| 1215 |
_state.qlbm_time_val = 0
|
| 1216 |
+
_state.qlbm_time_slider_labels = [f"T={t}" for t in final_T_list]
|
| 1217 |
_state.qlbm_simulation_has_run = True
|
| 1218 |
_state.qlbm_qiskit_mode = True
|
| 1219 |
|
|
|
|
| 1222 |
_state.qlbm_status_message = "Simulation completed successfully."
|
| 1223 |
_state.qlbm_status_type = "success"
|
| 1224 |
|
| 1225 |
+
# === NEW: IonQ QPU Backend ===
|
| 1226 |
+
elif use_ionq_qpu:
|
| 1227 |
+
log_to_console("Using IonQ QPU backend...")
|
| 1228 |
+
|
| 1229 |
+
params = _map_state_to_qiskit_params()
|
| 1230 |
+
if params is None:
|
| 1231 |
+
raise RuntimeError("Failed to map state parameters")
|
| 1232 |
+
|
| 1233 |
+
# Create initial state circuit
|
| 1234 |
+
log_to_console("Creating initial state circuit...")
|
| 1235 |
+
init_state_prep_circ = get_named_init_state_circuit(
|
| 1236 |
+
n=params["n"],
|
| 1237 |
+
init_state_name=params["init_state_name"],
|
| 1238 |
+
sine_k_x=params["sine_k_x"],
|
| 1239 |
+
sine_k_y=params["sine_k_y"],
|
| 1240 |
+
sine_k_z=params["sine_k_z"],
|
| 1241 |
+
gauss_cx=params["gauss_cx"],
|
| 1242 |
+
gauss_cy=params["gauss_cy"],
|
| 1243 |
+
gauss_cz=params["gauss_cz"],
|
| 1244 |
+
gauss_sigma=params["gauss_sigma"],
|
| 1245 |
+
mdd_kx_log2=params["mdd_kx_log2"],
|
| 1246 |
+
mdd_ky_log2=params["mdd_ky_log2"],
|
| 1247 |
+
mdd_kz_log2=params["mdd_kz_log2"],
|
| 1248 |
+
)
|
| 1249 |
+
|
| 1250 |
+
log_to_console("Submitting job to IonQ...")
|
| 1251 |
+
|
| 1252 |
+
# Run HW simulation
|
| 1253 |
+
job, get_result = run_sampling_hw_ionq(
|
| 1254 |
+
n=params["n"],
|
| 1255 |
+
ux=params["vx_expr"],
|
| 1256 |
+
uy=params["vy_expr"],
|
| 1257 |
+
uz=params["vz_expr"],
|
| 1258 |
+
init_state_prep_circ=init_state_prep_circ,
|
| 1259 |
+
T_list=params["T_list"],
|
| 1260 |
+
shots=2**18,
|
| 1261 |
+
vel_resolution=min(params['grid_size'], 32),
|
| 1262 |
+
output_resolution=min(2*params['grid_size'], 40),
|
| 1263 |
+
logger=log_to_console
|
| 1264 |
+
)
|
| 1265 |
+
|
| 1266 |
+
log_to_console("Waiting for job results (this may take time)...")
|
| 1267 |
+
output, plotly_fig = get_result(job)
|
| 1268 |
+
|
| 1269 |
+
# Update UI
|
| 1270 |
+
if hasattr(_ctrl, "qlbm_qiskit_result_update"):
|
| 1271 |
+
_ctrl.qlbm_qiskit_result_update(plotly_fig)
|
| 1272 |
+
|
| 1273 |
+
# Update slider labels (include T=0 if present)
|
| 1274 |
+
final_T_list = [0] + params["T_list"] if len(output) > len(params["T_list"]) else params["T_list"]
|
| 1275 |
+
|
| 1276 |
+
_state.qlbm_max_time_step = len(output) - 1
|
| 1277 |
+
_state.qlbm_time_val = 0
|
| 1278 |
+
_state.qlbm_time_slider_labels = [f"T={t}" for t in final_T_list]
|
| 1279 |
+
_state.qlbm_simulation_has_run = True
|
| 1280 |
+
_state.qlbm_qiskit_mode = True
|
| 1281 |
+
|
| 1282 |
+
_progress_callback(100)
|
| 1283 |
+
log_to_console("IonQ QPU simulation completed successfully.")
|
| 1284 |
+
_state.qlbm_status_message = "Simulation completed successfully."
|
| 1285 |
+
_state.qlbm_status_type = "success"
|
| 1286 |
+
|
| 1287 |
# === CUDA-Q Backend ===
|
| 1288 |
elif _state.qlbm_backend_type == "Simulator" and _state.qlbm_selected_simulator == "CUDA-Q simulator":
|
| 1289 |
_state.qlbm_qiskit_mode = False # Use PyVista display
|
|
|
|
| 1798 |
)
|
| 1799 |
with vuetify3.VMenu(open_on_hover=True, close_on_content_click=True, location="end"):
|
| 1800 |
with vuetify3.Template(v_slot_activator="{ props }"):
|
| 1801 |
+
vuetify3.VBtn(
|
| 1802 |
+
v_bind="props",
|
| 1803 |
+
text="Choose Backend",
|
| 1804 |
+
color="primary",
|
| 1805 |
+
variant="tonal",
|
| 1806 |
+
block=True
|
| 1807 |
+
)
|
| 1808 |
with vuetify3.VList(density="compact"):
|
| 1809 |
with vuetify3.VMenu(open_on_hover=True, close_on_content_click=True, location="end", offset=8):
|
| 1810 |
with vuetify3.Template(v_slot_activator="{ props }"):
|