qarray


Nameqarray JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryQarray, a GPU accelerated quantum dot array simulator, leveraging parallelised Rust and JAX XLA acceleration
upload_time2024-05-09 17:32:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords semiconducting quantum dots quantum simulation gpu rust jax quantum computing quantum programming quantum simulation quantum optimization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# QArray

![PyPI](https://img.shields.io/pypi/v/qarray)
![GitHub Workflow Status](https://github.com/b-vanstraaten/qarray/actions/workflows/windows_tests.yaml//badge.svg)
![GitHub Workflow Status](https://github.com/b-vanstraaten/qarray/actions/workflows/macos_tests.yaml//badge.svg)
![GitHub Workflow Status](https://github.com/b-vanstraaten/qarray/actions/workflows/linux_tests.yaml//badge.svg)

**QArray** harnesses the speed of the systems programming language Rust or the compute power of GPUs using JAX XLA
to deliver constant capacitance model charge stability diagrams in seconds or milliseconds. It couples
highly optimised and parallelised code with two new algorithms to compute the ground state charge configuration. These
algorithms scale better than the traditional brute-force approach and do not require the user to specify
the maximum number of charge carriers a priori.

QArray runs on both CPUs and GPUs and is designed to be easy to use and integrate into existing workflows. It was
developed on macOS running on Apple Silicon and is continuously tested on Ubuntu-latest, macOS13, macos14,
Windows-latest.

Finally, QArray captures physical effects, such as measuring the charge stability diagram with a SET and thermal
broadening of charge transitions. The combination of these effects permits the simulation of charge stability diagrams,
which are visually similar to those measured experimentally.

## Installation

We have tried to precompile the binaries for as many platforms as possible if you are running one
of those operating systems, you can install QArray with just pip:
```bash
pip install qarray
```

If you slip through the gaps, then the pip install will try to compile the binaries for you. This might require you to
install some additional dependencies. In particular, you might need to have cmake and Rust installed.

Install rust from:
[https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)

Install CMake from:
[https://cmake.org/download/](https://cmake.org/download/).
However, on macOS and Ubuntu, you can install cmake using homebrew and apt, respectively.

Also, setting up JAX on macOS running on M series chips can be a bit finicky. We outline the steps
that worked for us in the macOS installation section below. Alternatively, just spin up
a [Github Codespace](https://github.com/codespaces), then ```pip install qarray``` and
you are done.

## Getting started - double quantum dot example

```python
import matplotlib.pyplot as plt
import numpy as np

from qarray import DotArray, GateVoltageComposer, charge_state_contrast

# Create a quantum dot with 2 gates, specifying the capacitance matrices in their maxwell form.
model = DotArray(
    cdd=np.array([
        [1.2, -0.1],
        [-0.1, 1.2]
    ]),
    cgd=np.array([
        [1., 0.1],
        [0.1, 1]
    ]),
    algorithm='default', implementation='rust',
    charge_carrier='h', T=0.,
)

# a helper class designed to make it easy to create gate voltage arrays for nd sweeps
voltage_composer = GateVoltageComposer(n_gate=model.n_gate)

# defining the min and max values for the dot voltage sweep
# defining the min and max values for the dot voltage sweep
vx_min, vx_max = -5, 5
vy_min, vy_max = -5, 5
# using the dot voltage composer to create the dot voltage array for the 2d sweep
vg = voltage_composer.do2d(0, vy_min, vx_max, 400, 1, vy_min, vy_max, 400)

# run the simulation with the quantum dot array open such that the number of charge carriers is not fixed
n_open = model.ground_state_open(vg)  # n_open is a (100, 100, 2) array encoding the
# number of charge carriers in each dot for each gate voltage
# run the simulation with the quantum dot array closed such that the number of charge carriers is fixed to 2
n_closed = model.ground_state_closed(vg, n_charges=2)  # n_closed is a (100, 100, 2) array encoding the
# number of charge carriers in each dot for each gate voltage


charge_state_contrast_array = [0.8, 1.2]

# creating arrays that encode when the dot occupation changes
z_open = charge_state_contrast(n_open, charge_state_contrast_array)
z_closed = charge_state_contrast(n_closed, charge_state_contrast_array)

# plot the results
fig, ax = plt.subplots(1, 2, figsize=(10, 5))
ax[0].imshow(z_open.T, extent=(vx_min, vx_max, vy_min, vy_max), origin='lower', cmap='binary')
ax[0].set_title('Open Dot Array')
ax[0].set_xlabel('Vx')
ax[0].set_ylabel('Vy')
ax[1].imshow(z_closed.T, extent=(vx_min, vx_max, vy_min, vy_max), origin='lower', cmap='binary')
ax[1].set_title('Closed Dot Array')
ax[1].set_xlabel('Vx')
ax[1].set_ylabel('Vy')
plt.tight_layout()
plt.show()
```
## Examples

The examples folder contains a number of examples that demonstrate how to use the package to simulate different quantum
dot systems.

1. [Double Quantum Dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/double_dot.py)
2. [Linear Triple Quantum Dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/linear_triple_dot.py)
3. [Linear Quadruple Quantum Dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/linear_quadruple_dot.py)
4. [Charge sensed double quantum dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/charge_sensing.py)

## M Series macOS installation

Getting JAX to work macOS on M Series chips can be rather finicky. Here are the steps we used to get everything working
starting from a fresh OS install.

1. Install homebrew from https://brew.sh and run through the install script.

2. Use homebrew to install miniconda

```zsh
brew install  miniconda
```

3. Use homebrew to install cmake

```zsh
brew install cmake
```

4. Create a new conda environment and install pip

```zsh
conda create -n qarray python=3.11
conda install pip
```

5. Install qarray using pip

```zsh
pip install qarray
```

This installation script has been demonstrated to work on fresh installations of macOS Ventura 13.4 and Sonoma 14.4.
To install directly from the repository, use the command:

```zsh
pip install git+https://github.com/b-vanstraaten/qarray.git@main
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "qarray",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "semiconducting, quantum dots, quantum, simulation, GPU, rust, jax, quantum computing, quantum programming, quantum simulation, quantum optimization",
    "author": null,
    "author_email": "Barnaby van Straaten <barnaby.vanstraaten@kellogg.ox.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/c7/40/6ec4c76449f7a081a768eaf3a6c38f12a3818d9813f9121dc2f51678012e/qarray-1.1.1.tar.gz",
    "platform": null,
    "description": "\n# QArray\n\n![PyPI](https://img.shields.io/pypi/v/qarray)\n![GitHub Workflow Status](https://github.com/b-vanstraaten/qarray/actions/workflows/windows_tests.yaml//badge.svg)\n![GitHub Workflow Status](https://github.com/b-vanstraaten/qarray/actions/workflows/macos_tests.yaml//badge.svg)\n![GitHub Workflow Status](https://github.com/b-vanstraaten/qarray/actions/workflows/linux_tests.yaml//badge.svg)\n\n**QArray** harnesses the speed of the systems programming language Rust or the compute power of GPUs using JAX XLA\nto deliver constant capacitance model charge stability diagrams in seconds or milliseconds. It couples\nhighly optimised and parallelised code with two new algorithms to compute the ground state charge configuration. These\nalgorithms scale better than the traditional brute-force approach and do not require the user to specify\nthe maximum number of charge carriers a priori.\n\nQArray runs on both CPUs and GPUs and is designed to be easy to use and integrate into existing workflows. It was\ndeveloped on macOS running on Apple Silicon and is continuously tested on Ubuntu-latest, macOS13, macos14,\nWindows-latest.\n\nFinally, QArray captures physical effects, such as measuring the charge stability diagram with a SET and thermal\nbroadening of charge transitions. The combination of these effects permits the simulation of charge stability diagrams,\nwhich are visually similar to those measured experimentally.\n\n## Installation\n\nWe have tried to precompile the binaries for as many platforms as possible if you are running one\nof those operating systems, you can install QArray with just pip:\n```bash\npip install qarray\n```\n\nIf you slip through the gaps, then the pip install will try to compile the binaries for you. This might require you to\ninstall some additional dependencies. In particular, you might need to have cmake and Rust installed.\n\nInstall rust from:\n[https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)\n\nInstall CMake from:\n[https://cmake.org/download/](https://cmake.org/download/).\nHowever, on macOS and Ubuntu, you can install cmake using homebrew and apt, respectively.\n\nAlso, setting up JAX on macOS running on M series chips can be a bit finicky. We outline the steps\nthat worked for us in the macOS installation section below. Alternatively, just spin up\na [Github Codespace](https://github.com/codespaces), then ```pip install qarray``` and\nyou are done.\n\n## Getting started - double quantum dot example\n\n```python\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom qarray import DotArray, GateVoltageComposer, charge_state_contrast\n\n# Create a quantum dot with 2 gates, specifying the capacitance matrices in their maxwell form.\nmodel = DotArray(\n    cdd=np.array([\n        [1.2, -0.1],\n        [-0.1, 1.2]\n    ]),\n    cgd=np.array([\n        [1., 0.1],\n        [0.1, 1]\n    ]),\n    algorithm='default', implementation='rust',\n    charge_carrier='h', T=0.,\n)\n\n# a helper class designed to make it easy to create gate voltage arrays for nd sweeps\nvoltage_composer = GateVoltageComposer(n_gate=model.n_gate)\n\n# defining the min and max values for the dot voltage sweep\n# defining the min and max values for the dot voltage sweep\nvx_min, vx_max = -5, 5\nvy_min, vy_max = -5, 5\n# using the dot voltage composer to create the dot voltage array for the 2d sweep\nvg = voltage_composer.do2d(0, vy_min, vx_max, 400, 1, vy_min, vy_max, 400)\n\n# run the simulation with the quantum dot array open such that the number of charge carriers is not fixed\nn_open = model.ground_state_open(vg)  # n_open is a (100, 100, 2) array encoding the\n# number of charge carriers in each dot for each gate voltage\n# run the simulation with the quantum dot array closed such that the number of charge carriers is fixed to 2\nn_closed = model.ground_state_closed(vg, n_charges=2)  # n_closed is a (100, 100, 2) array encoding the\n# number of charge carriers in each dot for each gate voltage\n\n\ncharge_state_contrast_array = [0.8, 1.2]\n\n# creating arrays that encode when the dot occupation changes\nz_open = charge_state_contrast(n_open, charge_state_contrast_array)\nz_closed = charge_state_contrast(n_closed, charge_state_contrast_array)\n\n# plot the results\nfig, ax = plt.subplots(1, 2, figsize=(10, 5))\nax[0].imshow(z_open.T, extent=(vx_min, vx_max, vy_min, vy_max), origin='lower', cmap='binary')\nax[0].set_title('Open Dot Array')\nax[0].set_xlabel('Vx')\nax[0].set_ylabel('Vy')\nax[1].imshow(z_closed.T, extent=(vx_min, vx_max, vy_min, vy_max), origin='lower', cmap='binary')\nax[1].set_title('Closed Dot Array')\nax[1].set_xlabel('Vx')\nax[1].set_ylabel('Vy')\nplt.tight_layout()\nplt.show()\n```\n## Examples\n\nThe examples folder contains a number of examples that demonstrate how to use the package to simulate different quantum\ndot systems.\n\n1. [Double Quantum Dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/double_dot.py)\n2. [Linear Triple Quantum Dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/linear_triple_dot.py)\n3. [Linear Quadruple Quantum Dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/linear_quadruple_dot.py)\n4. [Charge sensed double quantum dot](https://github.com/b-vanstraaten/qarray/blob/main/examples/charge_sensing.py)\n\n## M Series macOS installation\n\nGetting JAX to work macOS on M Series chips can be rather finicky. Here are the steps we used to get everything working\nstarting from a fresh OS install.\n\n1. Install homebrew from https://brew.sh and run through the install script.\n\n2. Use homebrew to install miniconda\n\n```zsh\nbrew install  miniconda\n```\n\n3. Use homebrew to install cmake\n\n```zsh\nbrew install cmake\n```\n\n4. Create a new conda environment and install pip\n\n```zsh\nconda create -n qarray python=3.11\nconda install pip\n```\n\n5. Install qarray using pip\n\n```zsh\npip install qarray\n```\n\nThis installation script has been demonstrated to work on fresh installations of macOS Ventura 13.4 and Sonoma 14.4.\nTo install directly from the repository, use the command:\n\n```zsh\npip install git+https://github.com/b-vanstraaten/qarray.git@main\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Qarray, a GPU accelerated quantum dot array simulator, leveraging parallelised Rust and JAX XLA acceleration",
    "version": "1.1.1",
    "project_urls": {
        "Home": "https://github.com/b-vanstraaten/qarray",
        "Issues": "https://github.com/b-vanstraaten/qarray/issues",
        "Repository": "https://github.com/b-vanstraaten/qarray"
    },
    "split_keywords": [
        "semiconducting",
        " quantum dots",
        " quantum",
        " simulation",
        " gpu",
        " rust",
        " jax",
        " quantum computing",
        " quantum programming",
        " quantum simulation",
        " quantum optimization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b228c0ec5b09a56fc51944e9d44a9cf551716de4980f0ca481d1810bb8da3dbc",
                "md5": "fba5398987ecfe995b666dc92b03b395",
                "sha256": "754e15bdb8a50b9ce6d9aa8aebd14b03acd11de467cd8315f7d74db501b47582"
            },
            "downloads": -1,
            "filename": "qarray-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fba5398987ecfe995b666dc92b03b395",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 37817,
            "upload_time": "2024-05-09T17:32:21",
            "upload_time_iso_8601": "2024-05-09T17:32:21.221707Z",
            "url": "https://files.pythonhosted.org/packages/b2/28/c0ec5b09a56fc51944e9d44a9cf551716de4980f0ca481d1810bb8da3dbc/qarray-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c7406ec4c76449f7a081a768eaf3a6c38f12a3818d9813f9121dc2f51678012e",
                "md5": "cb4b820c193a879ef46aea08c254aaaf",
                "sha256": "00f725e65f1c5515c6c0dd6c4d6d3b49c2871dbeb053bdb040c1fff24783eca7"
            },
            "downloads": -1,
            "filename": "qarray-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "cb4b820c193a879ef46aea08c254aaaf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 846145,
            "upload_time": "2024-05-09T17:32:22",
            "upload_time_iso_8601": "2024-05-09T17:32:22.805507Z",
            "url": "https://files.pythonhosted.org/packages/c7/40/6ec4c76449f7a081a768eaf3a6c38f12a3818d9813f9121dc2f51678012e/qarray-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-09 17:32:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "b-vanstraaten",
    "github_project": "qarray",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "qarray"
}
        
Elapsed time: 0.30331s