jezerjojo commited on
Commit
efe1f1c
·
1 Parent(s): fcea2ca

Added IonQProvider token

Browse files
Files changed (1) hide show
  1. qlbm/qlbm_sample_app.py +14 -36
qlbm/qlbm_sample_app.py CHANGED
@@ -608,7 +608,7 @@ def run_sampling_hw_ibm(
608
 
609
  from qiskit_ionq import IonQProvider
610
 
611
- provider = IonQProvider("qDwgg6JWfESewd6hbrxLL7e6H8OU0yop")
612
 
613
  def run_sampling_hw_ionq(
614
  n,
@@ -624,7 +624,7 @@ def run_sampling_hw_ionq(
624
  flag_qubits=True
625
  ):
626
  """
627
- Run QLBM simulation on IBM quantum hardware.
628
 
629
  Parameters
630
  ----------
@@ -666,14 +666,17 @@ def run_sampling_hw_ionq(
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
- qc_list=get_circuit(n,ux,uy,uz,init_state_prep_circ,T_list,vel_resolution,flag_qubits=flag_qubits,midcircuit_meas=False)
670
-
671
  backend = provider.get_backend("qpu.forte-enterprise-1")
672
 
 
 
673
  # Create Sampler primitive bound to the backend
674
 
675
  job = backend.run(qc_list, shots=shots)
676
 
 
 
677
  # sampler = Sampler(mode=backend)
678
 
679
  # # Submit job: pass a list of PUBs (we send one PUB [qc_compiled])
@@ -1064,20 +1067,13 @@ if __name__=="__main__":
1064
 
1065
  n=3
1066
 
1067
- # # Step 1: Create the initial state circuit ONCE with all parameters
1068
  # init_state_prep_circ = get_named_init_state_circuit(
1069
  # n=n,
1070
  # init_state_name="multi_dirac_delta", # or "gaussian", "dirac_delta"
1071
- # sine_k_x=1.0,
1072
- # sine_k_y=1.0,
1073
- # sine_k_z=1.0
1074
- # # gauss_cx=0.5, # Uncomment for Gaussian
1075
- # # gauss_cy=0.5,
1076
- # # gauss_cz=0.5,
1077
- # # gauss_sigma=0.2,
1078
  # )
1079
-
1080
- # # Alternative: Run on local simulator
1081
  # output, fig = run_sampling_sim(
1082
  # n=n,
1083
  # ux="sin(-2*pi*z)",
@@ -1087,7 +1083,9 @@ if __name__=="__main__":
1087
  # T_list=[1,3,5,7,9],
1088
  # vel_resolution=16
1089
  # )
 
1090
  # print(output)
 
1091
  # fig.show(renderer="browser")
1092
 
1093
  # Step 2: (Optional) Preview the initial distribution
@@ -1101,33 +1099,13 @@ if __name__=="__main__":
1101
  uz="1",
1102
  init_state_prep_circ="multi_dirac_delta", # Pass the circuit directly
1103
  T_list=[1,2],
1104
- shots=2**19,
1105
  vel_resolution=2,
1106
- output_resolution=16,
1107
- flag_qubits=True
1108
  )
1109
 
1110
- # from qiskit_ibm_runtime import QiskitRuntimeService
1111
-
1112
- # service = QiskitRuntimeService(
1113
- # channel='ibm_quantum_platform', token="UMeZUDI5D7fjPJHD5x3MJFwURg4PrGzBnTm142ka9-Hj",
1114
- # instance='crn:v1:bluemix:public:quantum-computing:us-east:a/15157e4350c04a9dab51b8b8a4a93c86:e29afd91-64bf-4a82-8dbf-731e6c213595::'
1115
- # )
1116
- # job = service.job('d4spkn3her1c73bdjelg')
1117
- # job_result = job.result()
1118
-
1119
- # To get counts for a particular pub result, use
1120
- #
1121
- # pub_result = job_result[<idx>].data.<classical register>.get_counts()
1122
- #
1123
- # where <idx> is the index of the pub and <classical register> is the name of the classical register.
1124
- # You can use circuit.cregs to find the name of the classical registers.
1125
-
1126
  output,fig = get_job_result(job)
1127
  fig.show(renderer="browser")
1128
 
1129
- # for xx, yy, zz, dens in output:
1130
- # plot_density_isosurface(xx, yy, zz, dens)
1131
-
1132
 
1133
 
 
608
 
609
  from qiskit_ionq import IonQProvider
610
 
611
+ provider = IonQProvider("slZCfQN3gptIiuswZ3TULhRu37kOhrlW")
612
 
613
  def run_sampling_hw_ionq(
614
  n,
 
624
  flag_qubits=True
625
  ):
626
  """
627
+ Run QLBM simulation on IonQ quantum hardware.
628
 
629
  Parameters
630
  ----------
 
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])
 
1067
 
1068
  n=3
1069
 
1070
+ # Step 1: Create the initial state circuit ONCE with all parameters
1071
  # init_state_prep_circ = get_named_init_state_circuit(
1072
  # n=n,
1073
  # init_state_name="multi_dirac_delta", # or "gaussian", "dirac_delta"
 
 
 
 
 
 
 
1074
  # )
1075
+
1076
+ # # Alternative: Run on local simulator
1077
  # output, fig = run_sampling_sim(
1078
  # n=n,
1079
  # ux="sin(-2*pi*z)",
 
1083
  # T_list=[1,3,5,7,9],
1084
  # vel_resolution=16
1085
  # )
1086
+
1087
  # print(output)
1088
+
1089
  # fig.show(renderer="browser")
1090
 
1091
  # Step 2: (Optional) Preview the initial distribution
 
1099
  uz="1",
1100
  init_state_prep_circ="multi_dirac_delta", # Pass the circuit directly
1101
  T_list=[1,2],
1102
+ shots=2**15,
1103
  vel_resolution=2,
1104
+ output_resolution=16
 
1105
  )
1106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1107
  output,fig = get_job_result(job)
1108
  fig.show(renderer="browser")
1109
 
 
 
 
1110
 
1111