Skip to content

Commit

Permalink
Hamiltonian features work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jp7745 committed Nov 12, 2024
1 parent 1b4ebb3 commit e630381
Show file tree
Hide file tree
Showing 5 changed files with 3,344 additions and 465 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/validate_problem_instance_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name: validate_problem_instance_json
on:
# Triggers the workflow on push or pull request events for main branch
# also runs nightly as a cron job
# push:
# branches: [ main ]
push:
branches: [ main ]
pull_request:
branches: [ main ]
# schedule:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,49 @@ def compute_ham_features_csv(

if verbose_logging: logging.info(f"reading data from {filename}")
data = fcidump.read(filename)

logging.info(f"finished reading FCIDUMP data.")




# Extract data from the dictionary
norb = data['NORB']
h1 = data['H1']
eri_4d = ao2mo.restore(1, data['H2'], norb)


logging.info(f"ao2mo.restore...")
eri_4d = ao2mo.restore(1, data['H2'], norb)
logging.info(f"done.")

logging.info(f"QuarticDirac(eri_4d, h1, norb)...")
quartic_fermion = QuarticDirac(eri_4d, h1, norb)
logging.info(f"done.")


logging.info(f"majorana_operator_from_quartic(quartic_fermion)...")
majorana_op = majorana_operator_from_quartic(quartic_fermion)
logging.info(f"done.")

logging.info(f"fermion_to_qubit_transformation(majorana_op, 'Jordan-Wigner')...")
pauli_op = fermion_to_qubit_transformation(majorana_op, 'Jordan-Wigner')
logging.info(f"done.")


logging.info(f"compute_hypergraph_ham_features(pauli_data)...")
pauli_data = pauli_op.data
vertex_degree_stats, weight_stats, edge_order_stats = \
compute_hypergraph_ham_features(pauli_data)
logging.info(f"done.")


logging.info(f"double_factorization_from_quartic(quartic_fermion)...")
H_DF = double_factorization_from_quartic(quartic_fermion)
logging.info(f"done.")

logging.info(f"truncate_df_eigenvalues(H_DF.eigs)...")
eigs = truncate_df_eigenvalues(H_DF.eigs)
logging.info(f"done.")


nelec = data['NELEC']
spin = data['MS2'] / 2
Expand All @@ -75,7 +100,10 @@ def compute_ham_features_csv(
nbeta = (nelec - spin) // 2

# Compute FCI determinant dimension using binomial coefficients
logging.info(f"Compute FCI determinant dimension using binomial coefficients...")
fci_dim = np.log10(comb(norb, nalpha) * comb(norb, nbeta))
logging.info(f"done.")



ham_features = {}
Expand Down
Loading

0 comments on commit e630381

Please sign in to comment.