Getting Started

Installation

You have two options to install the Quandary binary:

If you have Spack installed:

spack install quandary

This automatically handles all dependencies including PETSc and MPI.

Option 2: Build from Source

Prerequisites for building from source:

  • PETSc (Portable, Extensible Toolkit for Scientific Computation)
  • MPI implementation for parallel execution
  • CMake 3.23 or later
  • C++ compiler with C++14 support

Steps:

  • Clone the repository:
git clone https://github.com/LLNL/quandary.git
cd quandary
  • Follow the detailed build instructions in the README.md

Running

C++ Interface

Test your installation with the provided template:

./quandary config_template.cfg  # Serial execution
mpirun -np 4 ./quandary config_template.cfg  # Parallel execution

Results are written as column-based text files in the output directory data_out/. The config_template.cfg is currently set to run a CNOT optimization test case. It lists all available options and configurations, and is filled with comments that should help users to set up new simulation and optimization runs, and match the input options to the equations found in this document.

You can silence Quandary by adding the --quiet command line argument.

Python Interface

For Python interface, after cloning quandary:

pip install -e .

Test the Python interface with a working example:

cd examples
python example_cnot.py

This example demonstrates:

  • Setting up a 2-qubit system
  • Defining a CNOT gate target
  • Running optimization
  • Plotting results

The output will show optimization progress and generate control pulse plots.

Next Steps