Skip to content

Commit 9a80b80

Browse files
committed
file cleanup
1 parent 9de41c1 commit 9a80b80

25 files changed

+97
-168
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.DS_Store
2+
.venv
3+
__pycache__

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# extending_digitaldiscovery_data
22

3-
This repository contains supplimentary data for the publication "Extending Quantum Computing through Subspace, Embedding and Classical Molecular Dynamics Techniques".
3+
This repository contains supplementary data for the publication "*Extending Quantum Computing through Subspace, Embedding and Classical Molecular Dynamics Techniques*", available on Digital Discovery and [arXiv](https://doi.org/10.48550/arXiv.2505.16796).
44

55
The data is structured as follows:
66
- `input/` - contains the input data and scripts required to run the QM/MM simulation presented in Section 5.
77
- `quantum/` - contains the Hamiltonian data from the QM/MM simulation and the the scripts for pre- and post-processing circuit executions.
88
- `plot/` - contains the data and scripts needed to plot Figure 9.
9+
- `requirements.txt` - required python packages to run the scripts in `quantum/` and `plot/`. Set up a new virtual environment and run `pip install -r requirements.txt`. We used python `3.11.9`. For instructions to run the scripts for the QM/MM simulation please see `input/README.md`.
910
- `LICENSE` - this repository is distributed under the GNU General Public License v2 (GPLv2), because it incorporates code adapted from [LAMMPS](https://github.com/lammps/lammps). In particular, the file `input/run.py` is adapted from the LAMMPS source code. The full GPLv2 license for LAMMPS is included here.

input/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
This folder contains the data and scripts required to run the QM/MM simulation presented in Section 5.
44

5-
A prerequisite is the installation of LAMMPS with the `mdi`, `molecule`, and `kspace` flags switched on. Instructions for this can be found in the [LAMMPS documentation](https://github.com/lammps/lammps/blob/0d479cae298abb73ffd8b1460197a8a74c63bc5e/examples/QUANTUM/PySCF/README).
5+
A prerequisite is the installation of LAMMPS with the `mdi`, `molecule`, and `kspace` flags switched on. Instructions for this can be found in the [LAMMPS documentation](https://github.com/lammps/lammps/blob/0d479cae298abb73ffd8b1460197a8a74c63bc5e/examples/QUANTUM/PySCF/README). We recommend that you set this up in a new virtual environment, with the required python version `>=3.8, <3.11`. You will also need to install Nbed version 0.0.7 after completing the LAMMPS installation via `pip install nbed==0.0.7`.
66

77
Then, the script `run.sh` should be executable and can be edited to run simulations for each of the starting geometries. The LAMMPS input geometries are found in the `data.*` files. For example, `data.19_200` corresponds to the geometry for $d_{\mathrm{OO}} = 1.9$ Å and $d_{\mathrm{OH}} = 0.200$, and similarly for the other files. The output from running the script will be the Hamiltonian data in a pickle file.

input/run.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# This file is adapted from LAMMPS (https://github.com/lammps/lammps/blob/develop/examples/QUANTUM/PySCF/pyscf_mdi.py)
77
# Copyright 2003 Sandia Corporation – Licensed under GPLv2
88
# Modified by Tom Bickley, 2024
9-
# The changes are from line 570 onwards, which relate to the PySCF and Nbed settings
9+
# The changes are from line 568 onwards, which relate to the PySCF and Nbed settings
1010

1111
import sys,time
1212

@@ -24,8 +24,6 @@
2424
from nbed.driver import NbedDriver
2525
from nbed.ham_builder import HamiltonianBuilder
2626
from nbed.ham_converter import HamiltonianConverter
27-
28-
import json
2927
import pickle
3028
from numbers import Number
3129

plot/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# plot/
22

3-
This folder contains the data and scripts needed to plot Figure 9.
3+
This folder contains the data and script needed to plot Figure 9.

plot/hardware_results.pdf

11 Bytes
Binary file not shown.

plot/plot.ipynb

Lines changed: 0 additions & 140 deletions
This file was deleted.

plot/plot.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
import json
4+
5+
with open("energies.json", "r") as f:
6+
data = json.load(f)
7+
8+
dOHs = [200, 275, 350, 425, 500]
9+
10+
hams = {
11+
"1.9": [f"19_{dOH}_mean.json" for dOH in dOHs],
12+
"2.6": [f"26_{dOH}_mean.json" for dOH in dOHs],
13+
"3.3": [f"33_{dOH}_mean.json" for dOH in dOHs],
14+
}
15+
16+
energy_keys = ["HF_energy", "DMRG_energy_2", "DMRG_energy_16", "FCI_energy", "QSCI_noisy_energy"]
17+
18+
results = {k: {ek: [] for ek in energy_keys} for k in hams}
19+
20+
for bond_length, hams in hams.items():
21+
for ham in hams:
22+
for ek in energy_keys:
23+
results[bond_length][ek].append(data[ham][ek])
24+
25+
r = np.array(dOHs) / 1000
26+
27+
plotlist = [
28+
[1.9, 'solid'],
29+
[2.6, 'dashed'],
30+
[3.3, 'dotted'],
31+
]
32+
33+
for el in plotlist:
34+
dOO = el[0]
35+
36+
sol_hf = np.array(results[str(dOO)]['HF_energy'])
37+
sol_dmrg2 = np.array(results[str(dOO)]['DMRG_energy_2'])
38+
sol_fci = np.array(results[str(dOO)]['FCI_energy'])
39+
sol_qsci = np.array(results[str(dOO)]['QSCI_noisy_energy'])
40+
41+
if dOO == 1.9:
42+
plt.plot(r, sol_hf - sol_fci, label='HF',
43+
color='#648FFF', linestyle=el[1], marker='o')
44+
plt.plot(r, sol_dmrg2 - sol_fci, label='DMRG',
45+
color='#DC267F', linestyle=el[1], marker='o')
46+
plt.plot(r, sol_qsci - sol_fci, label='QSCI',
47+
color='#FFB000', linestyle=el[1], marker='o')
48+
else:
49+
plt.plot(r, sol_hf - sol_fci, color='#648FFF',
50+
linestyle=el[1], marker='o')
51+
plt.plot(r, sol_dmrg2 - sol_fci, color='#DC267F',
52+
linestyle=el[1], marker='o')
53+
plt.plot(r, sol_qsci - sol_fci, color='#FFB000',
54+
linestyle=el[1], marker='o')
55+
56+
xlim = plt.xlim()
57+
ylim = plt.ylim()
58+
59+
plt.fill([0,1,1,0], [-1,-1,1.6/1000,1.6/1000], color='green', alpha=0.25)
60+
61+
plt.xlim(xlim)
62+
plt.ylim(ylim)
63+
64+
plt.xlabel('proton ratio')
65+
plt.ylabel(r'Δ$E$ / Ha')
66+
67+
plt.plot([], [], label=r'$d_{\mathrm{OO}} = 1.9$ Å',
68+
linestyle='solid', color='grey')
69+
plt.plot([], [], label=r'$d_{\mathrm{OO}} = 2.6$ Å',
70+
linestyle='dashed', color='grey')
71+
plt.plot([], [], label=r'$d_{\mathrm{OO}} = 3.3$ Å',
72+
linestyle='dotted', color='grey')
73+
74+
plt.legend()
75+
plt.tight_layout()
76+
plt.savefig('hardware_results.pdf')
77+
plt.show()

quantum/19_200.pkl

-418 Bytes
Binary file not shown.

quantum/19_275.pkl

-418 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)