Skip to content

Commit

Permalink
Merge pull request #534 from Avimita-amc8313/hamlib-changes
Browse files Browse the repository at this point in the history
fixed tiny error and fixed depth-width issue for hamlib
  • Loading branch information
rtvuser1 authored Jun 28, 2024
2 parents c139f03 + 6f86c05 commit 15d6c2b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 50 deletions.
70 changes: 35 additions & 35 deletions hamlib/qiskit/benchmarks-qiskit.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions hamlib/qiskit/hamlib_simulation_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def HamiltonianSimulation(n_spins: int, K: int, t: float,
EVO_ = evo

# Collapse the sub-circuits used in this benchmark (for Qiskit)
qc2 = qc.decompose()
qc2 = qc.decompose().decompose()

return qc2

Expand Down Expand Up @@ -634,7 +634,7 @@ def kernel_draw(hamiltonian: str = "heisenberg", use_XX_YY_ZZ_gates: bool = Fals
print(transpile(qctt, optimization_level=3))

if QCI_ is not None:
print(" Initial State {QCI_.name}:")
print(f" Initial State {QCI_.name}:")
print(QCI_)

else:
Expand Down
16 changes: 3 additions & 13 deletions hamlib/qiskit/hamlib_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def process_hamiltonian_file(filename, dataset_name):
"""
url_mapping = {
'tfim.hdf5': 'https://portal.nersc.gov/cfs/m888/dcamps/hamlib/condensedmatter/tfim/tfim.zip',
'FH_D-1.hdf5': 'https://portal.nersc.gov/cfs/m888/dcamps/hamlib/condensedmatter/fermihubbard/FH_D-1.zip'
'FH_D-1.hdf5': 'https://portal.nersc.gov/cfs/m888/dcamps/hamlib/condensedmatter/fermihubbard/FH_D-1.zip',
'all-vib-h2o.hdf5': 'https://portal.nersc.gov/cfs/m888/dcamps/hamlib/chemistry/vibrational/'
# Add more mappings as needed
}

Expand Down Expand Up @@ -284,6 +285,7 @@ def view_hdf5_structure():
"tfim1:downloaded_hamlib_files/tfim.hdf5:graph=1D-grid-pbc-qubitnodes",
"tfim2:downloaded_hamlib_files/tfim.hdf5",
"fermi-hubbard:downloaded_hamlib_files/FH_D-1.hdf5:fh=graph-1D-grid-nonpbc-qubitnodes",
"MVS-H2O:downloaded_hamlib_files/all-vib-h2o.hdf5",
# Add more entries as needed
]
extract_variable_ranges(file_input)
Expand Down Expand Up @@ -327,18 +329,6 @@ def get_args():

if args.num_qubits > 0: args.min_qubits = args.max_qubits = args.num_qubits

# dataset_name = 'graph-1D-grid-nonpbc-qubitnodes_Lx-4_h-0.1'
# filename = 'tfim.hdf5'
dataset_name = 'fh-graph-1D-grid-nonpbc-qubitnodes_Lx-3_U-0_enc-jw'
filename = 'FH_D-1.hdf5'

data = process_hamiltonian_file(filename, dataset_name)
# if data is not None:
# # print("Raw Hamiltonian Data: ",data)
# print("Data extracted")
# else:
# print("No data extracted.")

print("\n\n\n\nPrinting the structure of the hdf5 file")
view_hdf5_structure()
'''
Expand Down

0 comments on commit 15d6c2b

Please sign in to comment.