Skip to content

Commit

Permalink
Cleanup PR (#69)
Browse files Browse the repository at this point in the history
* new pyLIQTR version

* qchem script cleanup

* cleaned up value_per_t_gate and added analytical use case for gsee

* made change to allow unique file name when performing a sweep

* responded to issue of improper gate synth accuracy. pyLIQTR handles it differently depending on the function?

* allow trotter to use use_analytical

* fix typo

* Updated pylint badge

* doing 1e-10 rther than string

* accidentally scaling num_qubits

* Updated pylint badge

* adding exotic phases script and moving print statement for generating trotterized subprocess gsee to AFTER we create circuit

* changed field from value_per_circuit to value. Additionally, cleaned up some code to make sure we getting right value per t gate

* fixed capitalization on ars

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
JonhasSC and github-actions[bot] authored Jan 21, 2025
1 parent cc16f71 commit 8eacdd7
Show file tree
Hide file tree
Showing 14 changed files with 319 additions and 109 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![pylint](https://img.shields.io/badge/PyLint-9.03-yellow?logo=python&logoColor=white)
![pylint](https://img.shields.io/badge/PyLint-9.01-yellow?logo=python&logoColor=white)

# Quantum Computing Application Specifications

Expand Down
8 changes: 3 additions & 5 deletions notebooks/DickeModelExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@
"print()\n",
"print('Tavis-Cummings Hamiltonian')\n",
"print(H_tavis_cummings)\n",
"#print(g_dicke.nodes)\n",
"#print(g_dicke.edges)\n",
"pos = get_node_attributes(g_dicke, 'pos')\n",
"labels = get_node_attributes(g_dicke, 'label')\n",
"draw(g_dicke, pos=pos, labels=labels, with_labels=True)\n",
Expand Down Expand Up @@ -308,7 +306,7 @@
"print('starting')\n",
"total_value = 0\n",
"repetitions = 1\n",
"value_per_circuit=total_value / repetitions\n",
"value=total_value / repetitions\n",
"\n",
"\n",
"dicke_metadata = GSEEMetaData(\n",
Expand All @@ -317,7 +315,7 @@
" category='scientific',\n",
" size=f'{n_b} + 1 + {n_s}',\n",
" task='Ground State Energy Estimation',\n",
" value_per_circuit=value_per_circuit,\n",
" value=value,\n",
" repetitions_per_application=repetitions,\n",
"\n",
" evolution_time=t_dicke,\n",
Expand Down Expand Up @@ -467,7 +465,7 @@
" category='scientific',\n",
" size=f'{n_b} + 1 + {n_s}',\n",
" task='Ground State Energy Estimation',\n",
" value_per_circuit=value_per_circuit,\n",
" value=value,\n",
" repetitions_per_application=repetitions,\n",
"\n",
" \n",
Expand Down
36 changes: 0 additions & 36 deletions notebooks/QCD/forward_scattering_re.json

This file was deleted.

26 changes: 14 additions & 12 deletions scripts/AP-RE.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,28 @@ def grab_arguments() -> Namespace:
)
parser.add_argument(
'-BR',
'--bits_rot',
type=int,
help='The number of precision bits to use for the rotation angles output by the QROM',
default=7
)
parser.add_argument(
'-DF',
'--df_error',
type=float,
help='The threshold used to throw out factors from the double factorization.',
default=1e-3
)
parser.add_argument(
'-SF',
'--sf_error',
type=float,
help='The threshold used to throw out factors from the first eigendecomposition',
default=1e-8
)
parser.add_argument(
'-EE',
'--energy_error',
type=float,
help='The allowable error in phase estimation energy',
default=1e-3
Expand Down Expand Up @@ -148,7 +152,7 @@ def df_subprocess(
outdir: str,
fname: str,
mol_hams: list[InteractionOperator],
br:int,
bits_rot:int,
df_error_threshold:float,
sf_error_threshold:float,
energy_error:float,
Expand All @@ -157,13 +161,14 @@ def df_subprocess(
gate_precision:float | None,
use_analytical: bool = True
):
for ham in mol_hams:
for idx, ham in enumerate(mol_hams):
new_name = f'{fname.split(".xyz")[0]}_{idx}'
gen_df_qpe(
mol_ham=ham,
use_analytical=use_analytical,
outdir=outdir,
fname=fname,
br=br,
fname=new_name,
bits_rot=bits_rot,
df_error_threshold=df_error_threshold,
sf_error_threshold=sf_error_threshold,
energy_error=energy_error,
Expand Down Expand Up @@ -209,7 +214,6 @@ def trotter_subprocess(
outdir = args.dir
if not os.path.exists(outdir):
os.makedirs(outdir)

fname = args.fname
use_df = args.use_df
bits_precision = args.bits_prec
Expand All @@ -219,14 +223,12 @@ def trotter_subprocess(
trotter_order = args.trotter_order
trotter_steps = args.trotter_steps

br = args.BR
sf_error = args.SF
df_error = args.DF
energy_error = args.EE
bits_rot = args.bits_rot
sf_error = args.sf_error
df_error = args.df_error
energy_error = args.energy_error
gate_synth_accuracy = args.gate_synth
print("going to gen mol hams")
mol_hams = gen_mol_hams(fname, basis, pathway, active_space_reduc)
print('now doing it')
fname = f'/{fname.split('/')[-1]}'
if not use_df:
trotter_subprocess(
Expand All @@ -243,7 +245,7 @@ def trotter_subprocess(
outdir=outdir,
fname=fname,
mol_hams=mol_hams,
br=br,
bits_rot=bits_rot,
df_error_threshold=df_error,
sf_error_threshold=sf_error,
energy_error=energy_error,
Expand Down
9 changes: 5 additions & 4 deletions scripts/DickeModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main(args):
trotter_order_dicke = args.trotter_order
trotter_steps_dicke = args.trotter_steps

name = args.name
name = f'{args.name}_{n_s}_ns_{n_b}_nb'
directory = args.directory
value = args.value
repetitions = args.repetitions
Expand Down Expand Up @@ -50,16 +50,16 @@ def main(args):
init_state_dicke = [0] * (n_b + n_s + 1) #TODO: use Fock state from Hartree-Fock as initial state

print('starting')
value_per_circuit = value/repetitions
value_per_circuit=6
value = value/repetitions
value=6
#TODO: See if I need to refactor the size string to include the variable names
dicke_metadata = GSEEMetaData(
id=time.time_ns(),
name=name,
category='scientific',
size=f'{n_b} + 1 + {n_s}',
task='Ground State Energy Estimation',
value_per_circuit=value_per_circuit,
value=value,
repetitions_per_application=repetitions,


Expand All @@ -76,6 +76,7 @@ def main(args):
nsteps=trotter_steps_dicke,
gsee_args=args_dicke,
init_state=init_state_dicke,
use_analytical=True,
precision_order=1, #actual precision bits accounted as scaling factors in the resource estimate
phase_offset=dicke_phase_offset,
bits_precision=bits_precision_dicke,
Expand Down
Loading

0 comments on commit 8eacdd7

Please sign in to comment.