Collection of summer projects for my internship at PNNL over the summer of 2019. Warning: This work may need to be kept private and/or scrubbed before use, as it contains PNNL sensitive information (network username).
- Clone this repo. If you want to use Microsoft's YAML files, also clone this folder in Microsoft/Quantum
- Install all Python requirements with the
spec.ymlfile provided. - Install Microsoft's QDK
- Add your own optimizations under
3OptimizeCircuit/swapand modify their command line arguments in/TestPipeline/testPipelineV2.sh. - Create or use an existing
.paramsfile. I recommend copy/pasting an existing file and simply making modifications. - Go to
/TestPipeline/testPipelineV2.shand copy the path of the.paramsfile to use. - Run the script with the
.paramspath as a command line argument - you may need to give proper permissions. Use./testPipelineV2.sh /path/to/.params[Additionally, if you are Windows, you may need to run the commands in the shell script manually.] - Find results in
/TestPipeline/_data_{$FOLDER_NAME}_{$DATE}whereFOLDER_NAMEis specified in.paramsandDATEis the date/time of program start.
Input: YAML file
Output: Energy level estimates
This folder has a C#/Q# project which serves as the control estimates for the energy level via Trotterization. There are no additional optimizations applied, and the code is almost entirely taken from the sample provided by Microsoft.
Input: YAML file
Output: JSON file
This folder contains a C#/Q# file to produce the necessary Trotter gates and a Python script to convert the output to JSON (produceJSON.py). See the README.md for requirements.
Input: JSON file
Output: JSON file
This folder applies a variety of optimizations onto the Trotter gate set. These optimizations are described in Khan, et al. Put your own optimizations in a folder named swap and modify their command line arguments in testPipelineV2.sh.
Input: Optimized JSON file
Output: Energy level estimates
This folder contains a C#/Q# file to ingest the optimizations and produce energy level estimates from it.
Input: All aspects of the pipeline
Output: Pytest output
This folder contains a series of validation tests for the pipeline's output and unit tests for the pipeline's components. The following outputs are checked in the validation testing:
- Extracted interaction JSON
- Interaction / swap optimizations
- Optimized JSON
Input: YAML file, parameters
Output:
- Two text files comparing energy level estimates with/wo optimizations (
_sampled_reference_energy.txt,_sampled_optimized_energy.txt) - Two CSVs with resource estimates (
./ReferenceCostEstimates,./OptimizedCostEstimates) - The raw extracted Hamiltonian (
extracted_terms.json) - The optimizations to be applied (
interaction_file.txt) - The optimized JSON (
reconstructed.json) - The logfile describing all key parameters and time it took to execute each component (
logfile.txt)
This folder has a shell script which executes the other folders in the following order:
ProduceSampleEnergy, creating a sample energy level estimateExtractTrotterGates, providing a JSON file describing the Trotter stepsOptimizeCircuit, applying any optimizations selected on the JSON fileConvertFileToGates, reingesting the optimized JSON to provide an energy level estimateValidationTests, checking all outputs and the validity of the pipeline components
Two files, _sampled_optimized_energy.txt and _sampled_reference_energy.txt, contain the outputs with and without the optimizations, respectively.
Sample YAML files from Microsoft / NWChem. Params should point here.
The JSON format used is NOT compatible across components. The JSON format used before 3OptimizeCircuit keeps SWAPs and interactions separate; the JSON format after 3OptimizeCircuit separates SWAPs and interactions, assuming that the interaction round goes first. This is made so that PP terms can be frontloaded (frontloading occurs in outputToJSONV3.py).