Strangeworks SDK VQE Extension#

PyPI

The service uses the Strangeworks API accessed through the Strangeworks python SDK. For more information on the general python sdk see our docs.

To get started you will need to install the SDK and authenticate using your API key. Your API key can be found on the dashboard page of the Strangeworks platform at https://portal.strangeworks.com.

Installation#

The Peptide design SDK is installed from a private git repo using pip

pip install strangeworks-vqe

Test your installation by running the following

$ python
>>> import strangeworks_vqe
>>> print(strangeworks_vqe.__version__)

Authentication#

Authenticate using the strangeworks.authenticate() method

$ python
>>> import strangeworks
>>> strangeworks.authenticate(api_key="<your-api-key>")

Basic Usage#

The SDK provides a Qiskit extension that can be used to run quantum circuits on the Strangeworks platform.

import strangeworks
from strangeworks_vqe.sdk import StrangeworksVQE
import strangeworks_vqe.utils as utils

strangeworks.authenticate(api_key=" ", store_credentials=False)
sw_vqe = StrangeworksVQE(resource_slug=" ")

nqubits = 4
Jz = 0.5
Jxy = 1
H = utils.get_Heisenberg_PauliSumOp(nqubits, Jz, Jxy)

maxiter = 20
shotsin = 100
optimizer = "NELDER_MEAD"
ansatz = "RealAmplitudes"

problem_params = {
    "maxiter": maxiter,
    "shotsin": shotsin,
    "nqubits": nqubits,
    "optimizer": optimizer, # optional
    "ansatz": ansatz,   # optional
    }

backend = "ibmq_qasm_simulator"
sw_job = sw_vqe.run(backend, H, problem_params)

result = sw_vqe.get_results(sw_job,calculate_exact_sol=True, display_results=True)

Python SDK Module Reference#