Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c0b2196
introduce `Space` and `Dimensions`
ytdHuang Dec 23, 2024
ff0a997
fix some tests
ytdHuang Dec 24, 2024
a5cd9fd
update definition for `AbstractDimensions`
ytdHuang Dec 25, 2024
fc8ca49
fix some tests for `AbstractDimensions`
ytdHuang Dec 25, 2024
d15696c
minor change
ytdHuang Dec 25, 2024
235b4f0
introduce `Field`
ytdHuang Dec 26, 2024
12e22ab
support `*` for `Compoundimensions`
ytdHuang Dec 26, 2024
0999688
fix `*` for `QobjEvo`
ytdHuang Dec 26, 2024
53f71ac
fix some tests
ytdHuang Dec 26, 2024
cc31eeb
fix comments
ytdHuang Dec 26, 2024
d15413b
remove duplicate tests
ytdHuang Dec 26, 2024
4c848c1
comment `steadystate` failed type-inference tests
ytdHuang Dec 26, 2024
e9df9fb
modify some comments
ytdHuang Dec 27, 2024
8fc9248
format files
ytdHuang Dec 27, 2024
2930089
extend generation methods for `CompoundDimensions`
ytdHuang Dec 29, 2024
aa01c99
introduce internal field `_dims`
ytdHuang Jan 1, 2025
d3977c6
first try of `Space` and `Dimensions` (#359)
ytdHuang Jan 1, 2025
d5ff284
fix tests
ytdHuang Jan 1, 2025
dced5d4
minor changes
ytdHuang Jan 1, 2025
f18d546
fix type-instability for `prod`
ytdHuang Jan 2, 2025
1684fc7
Fix type-instability for `prod` (#363)
ytdHuang Jan 2, 2025
6e1fe7b
Merge branch 'dev/dimensions' into dev/dims-patch-1
ytdHuang Jan 2, 2025
977b7d3
modify `show` for `AbstractSpace` and `CompoundDimensions`
ytdHuang Jan 3, 2025
51779f2
address the comments from admins discussions in 2025-01-06
ytdHuang Jan 7, 2025
342768c
introduce field `dimensions`, and property `dims` (#361)
ytdHuang Jan 7, 2025
6d12ffb
fix `CUDA` extension
ytdHuang Jan 7, 2025
52af74b
fix `dims` type
ytdHuang Jan 7, 2025
bd598aa
minor changes
ytdHuang Jan 7, 2025
65d9879
update changelog
ytdHuang Jan 7, 2025
4bda75d
Merge branch 'main' into dev/dimensions
ytdHuang Jan 7, 2025
cb2535f
disable `permute` for arbitrary `GeneralDimensions` and fix it in the…
ytdHuang Jan 7, 2025
2ecd7ef
Merge branch 'dev/dimensions' into dev/dimensions
ytdHuang Jan 7, 2025
309a670
Several updates for `Dimensions` structure (#367)
ytdHuang Jan 7, 2025
507892f
fix typo
ytdHuang Jan 7, 2025
c7383ea
fix `permute`
ytdHuang Jan 8, 2025
c1fbedd
minor changes
ytdHuang Jan 8, 2025
ac6f54c
format files
ytdHuang Jan 8, 2025
df53828
improve error message for generating `Qobj`
ytdHuang Jan 8, 2025
442f0a7
fix runtests
ytdHuang Jan 8, 2025
1f88d74
make `Dimensions`-type contains tuple of `Space`
ytdHuang Jan 11, 2025
c89e5a2
Merge branch 'main' into dev/dimensions
ytdHuang Jan 11, 2025
faacd36
fix docstrings
ytdHuang Jan 11, 2025
e6166b8
improve `getproperty`
ytdHuang Jan 11, 2025
eeac23c
fix definition of `GeneralDimensions` structure
ytdHuang Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ and [Y.-T. Huang](https://github.com/ytdHuang).
- **Quantum State and Operator Manipulation:** Easily handle quantum states and operators with a rich set of tools, with the same functionalities as `QuTiP`.
- **Dynamical Evolution:** Advanced solvers for time evolution of quantum systems, thanks to the powerful [`DifferentialEquations.jl`](https://github.com/SciML/DifferentialEquations.jl) package.
- **GPU Computing:** Leverage GPU resources for high-performance computing. Simulate quantum dynamics directly on the GPU with the same syntax as the CPU case.
- **Distributed Computing:** Distribute the computation over multiple nodes (e.g., a cluster). For example, you can run hundreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case. See [this tutorial](https://qutip.org/QuantumToolbox.jl/stable/tutorials/cluster) for more information.
- **Distributed Computing:** Distribute the computation over multiple nodes (e.g., a cluster). For example, you can run hundreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case. See [here](https://qutip.org/QuantumToolbox.jl/stable/users_guide/cluster) for more information.
- **Easy Extension:** Easily extend the package, taking advantage of the `Julia` language features, like multiple dispatch and metaprogramming.

## Installation
Expand Down
11 changes: 2 additions & 9 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const PAGES = [
"Brief Example" => "getting_started/brief_example.md",
"Key differences from QuTiP" => "getting_started/qutip_differences.md",
"The Importance of Type-Stability" => "getting_started/type_stability.md",
"Example: Create QuantumToolbox.jl Logo" => "getting_started/logo.md",
# "Cite QuantumToolbox.jl" => "getting_started/cite.md",
],
"Users Guide" => [
Expand All @@ -54,6 +55,7 @@ const PAGES = [
"Stochastic Solver" => "users_guide/time_evolution/stochastic.md",
"Solving Problems with Time-dependent Hamiltonians" => "users_guide/time_evolution/time_dependent.md",
],
"Intensive parallelization on a Cluster" => "users_guide/cluster.md",
"Hierarchical Equations of Motion" => "users_guide/HEOM.md",
"Solving for Steady-State Solutions" => "users_guide/steadystate.md",
"Two-time correlation functions" => "users_guide/two_time_corr_func.md",
Expand All @@ -62,15 +64,6 @@ const PAGES = [
"users_guide/extensions/cairomakie.md",
],
],
"Tutorials" => [
"Time Evolution" => [
"Low Rank Master Equation" => "tutorials/lowrank.md",
],
"Miscellaneous Tutorials" => [
"tutorials/logo.md",
"tutorials/cluster.md",
],
],
"Resources" => [
"API" => "resources/api.md",
"Bibliography" => "resources/bibliography.md",
Expand Down
1 change: 1 addition & 0 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const navTemp = {

const nav = [
...navTemp.nav,
{ text: 'Tutorials', link: 'https://qutip.org/qutip-julia-tutorials/' },
{ text: 'Benchmarks', link: 'https://qutip.org/QuantumToolbox.jl/benchmarks/' },
{
component: 'VersionPicker'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# [Create QuantumToolbox.jl logo](@id doc-tutor:Create-QuantumToolbox.jl-logo)
# [Example: Create QuantumToolbox.jl logo](@id doc:Create-QuantumToolbox.jl-logo)

## Introduction

In this tutorial, we will demonstrate how to create the logo for the **QuantumToolbox.jl** package. The logo represents the Wigner function of the triangular cat state, which is a linear superposition of three coherent states. The resulting Wigner function has a triangular shape that resembles the Julia logo. We will also define a custom colormap that varies based on the value of the Wigner function and the spatial coordinates, such that the three blobs corresponding to the coherent states have different colors (matching the colors of the Julia logo).
In this example, we will demonstrate how to create the logo for the **QuantumToolbox.jl** package. The logo represents the Wigner function of the triangular cat state, which is a linear superposition of three coherent states. The resulting Wigner function has a triangular shape that resembles the Julia logo. We will also define a custom colormap that varies based on the value of the Wigner function and the spatial coordinates, such that the three blobs corresponding to the coherent states have different colors (matching the colors of the Julia logo).

### Triangular Cat State

Expand Down Expand Up @@ -196,4 +196,4 @@ fig

## Conclusion

This tutorial demonstrates how to generate the [QuantumToolbox.jl](https://github.com/qutip/QuantumToolbox.jl) logo using the package itself and [Makie.jl](https://github.com/MakieOrg/Makie.jl) for visualization. The logo is a visualization of the Wigner function of a triangular cat state, with a custom colormap that highlights the different coherent states with colors matching the Julia logo.
This example demonstrates how to generate the [QuantumToolbox.jl](https://github.com/qutip/QuantumToolbox.jl) logo using the package itself and [Makie.jl](https://github.com/MakieOrg/Makie.jl) for visualization. The logo is a visualization of the Wigner function of a triangular cat state, with a custom colormap that highlights the different coherent states with colors matching the Julia logo.
9 changes: 6 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ hero:
text: Users Guide
link: /users_guide/QuantumObject/QuantumObject
- theme: alt
text: View on Github
link: https://github.com/qutip/QuantumToolbox.jl
text: Tutorials
link: https://qutip.org/qutip-julia-tutorials/
- theme: alt
text: API
link: /resources/api
- theme: alt
text: View on Github
link: https://github.com/qutip/QuantumToolbox.jl
- theme: alt
text: Visit QuTiP.org
link: https://qutip.org/
Expand All @@ -39,7 +42,7 @@ features:
- icon: <img width="64" height="64" src="https://img.icons8.com/?size=100&id=1W4Bkj363ov0&format=png&color=000000" />
title: Distributed Computing
details: Distribute the computation over multiple nodes (e.g., a cluster). Simulate hundreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case.
link: /tutorials/cluster
link: /users_guide/cluster
---
```

Expand Down
4 changes: 4 additions & 0 deletions docs/src/resources/acknowledgements.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@

`QuantumToolbox.jl` is supported by the [Unitary Fund](https://unitary.fund), a grant program for quantum technology projects.

```@raw html
<div align="center">
<a href="https://unitary.fund">
<img src="https://raw.githubusercontent.com/unitaryfund/unitary.fund/refs/heads/main/src/assets/svg/logo.svg" alt="Unitary Fund logo" width="200">
</a>
</div>
```

## [Other Acknowledgements](@id doc:Other-Acknowledgements)

We are also grateful to the [Zulip](https://zulip.com) team for providing a free chat service for open-source projects.

```@raw html
<div align="center">
<a href="https://zulip.com">
<img src="https://zulip.com/static/images/logo/zulip-org-logo.svg" alt="Zulip logo" width="200">
</a>
</div>
```
177 changes: 0 additions & 177 deletions docs/src/tutorials/lowrank.md

This file was deleted.

62 changes: 35 additions & 27 deletions docs/src/tutorials/cluster.md → docs/src/users_guide/cluster.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
# [Intensive parallelization on a Cluster](@id doc-tutor:Intensive-parallelization-on-a-Cluster)
# [Intensive parallelization on a Cluster](@id doc:Intensive-parallelization-on-a-Cluster)

## Introduction

In this tutorial, we will demonstrate how to seamlessly perform intensive parallelization on a cluster using the **QuantumToolbox.jl** package. Indeed, thanks to the [**Distributed.jl**](https://docs.julialang.org/en/v1/manual/distributed-computing/) and [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) packages, it is possible to parallelize on a cluster with minimal effort. The following examples are applied to a cluster with the [SLURM](https://slurm.schedmd.com/documentation.html) workload manager, but the same principles can be applied to other workload managers, as the [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) package is very versatile.
In this example, we will demonstrate how to seamlessly perform intensive parallelization on a cluster using the **QuantumToolbox.jl** package. Indeed, thanks to the [**Distributed.jl**](https://docs.julialang.org/en/v1/manual/distributed-computing/) and [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) packages, it is possible to parallelize on a cluster with minimal effort. The following examples are applied to a cluster with the [SLURM](https://slurm.schedmd.com/documentation.html) workload manager, but the same principles can be applied to other workload managers, as the [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) package is very versatile.

We will consider two examples:
## SLURM batch script

1. **Parallelization of a Monte Carlo quantum trajectories**
2. **Parallelization of a Master Equation by sweeping over parameters**

### Monte Carlo Quantum Trajectories

Let's consider a 2-dimensional transverse field Ising model with 4x3 spins. The Hamiltonian is given by

```math
\hat{H} = \frac{J_z}{2} \sum_{\langle i,j \rangle} \hat{\sigma}_i^z \hat{\sigma}_j^z + h_x \sum_i \hat{\sigma}_i^x \, ,
```

where the sums are over nearest neighbors, and the collapse operators are given by

```math
\hat{c}_i = \sqrt{\gamma} \hat{\sigma}_i^- \, .
```

We start by creating a file named `run.batch` with the following content:
To submit a batch script to [SLURM](https://slurm.schedmd.com/documentation.html), we start by creating a file named `run.batch` with the following content:

```bash
#!/bin/bash
#SBATCH --job-name=tutorial
#SBATCH --job-name=example
#SBATCH --output=output.out
#SBATCH --account=your_account
#SBATCH --nodes=10
Expand All @@ -44,9 +27,34 @@ export PATH=/home/username/.juliaup/bin:$PATH
julia --project script.jl
```

where we have to replace `your_account` with the name of your account. This script will be used to submit the job to the cluster. Here, we are requesting 10 nodes with 72 threads each (720 parallel jobs). The `--time` flag specifies the maximum time that the job can run. To see all the available options, you can check the [SLURM documentation](https://slurm.schedmd.com/documentation.html). We also export the path to the custom Julia installation, which is necessary to run the script (replace `username` with your username). Finally, we run the script `script.jl` with the command `julia --project script.jl`.
where we have to replace `your_account` with the name of your account. This script will be used to submit the job to the cluster by using the following command in terminal:

```shell
sbatch run.batch
```

Here, we are requesting `10` nodes with `72` threads each (`720` parallel jobs). The `--time` flag specifies the maximum time that the job can run. To see all the available options, you can check the [SLURM documentation](https://slurm.schedmd.com/documentation.html). We also export the path to the custom Julia installation, which is necessary to run the script (replace `username` with your username). Finally, we run the script `script.jl` with the command `julia --project script.jl`.

In the following, we will consider two examples:

1. **Parallelization of a Monte Carlo quantum trajectories**
2. **Parallelization of a Master Equation by sweeping over parameters**

## Monte Carlo Quantum Trajectories

Let's consider a `2`-dimensional transverse field Ising model with `4x3` spins. The Hamiltonian is given by

```math
\hat{H} = \frac{J_z}{2} \sum_{\langle i,j \rangle} \hat{\sigma}_i^z \hat{\sigma}_j^z + h_x \sum_i \hat{\sigma}_i^x \, ,
```

where the sums are over nearest neighbors, and the collapse operators are given by

```math
\hat{c}_i = \sqrt{\gamma} \hat{\sigma}_i^- \, .
```

The `script.jl` contains the following content:
In this case, the `script.jl` contains the following content:

```julia
using Distributed
Expand Down Expand Up @@ -121,7 +129,7 @@ With the
println("Hello! You have $(nworkers()) workers with $(remotecall_fetch(Threads.nthreads, 2)) threads each.")
```

command, we test that the distributed network is correctly initialized. The `remotecall_fetch(Threads.nthreads, 2)` command returns the number of threads of the worker with ID 2.
command, we test that the distributed network is correctly initialized. The `remotecall_fetch(Threads.nthreads, 2)` command returns the number of threads of the worker with ID `2`.

We then write the main part of the script, where we define the lattice through the [`Lattice`](@ref) function. We set the parameters and define the Hamiltonian and collapse operators with the [`DissipativeIsing`](@ref) function. We also define the expectation operators `e_ops` and the initial state `ψ0`. Finally, we perform the Monte Carlo quantum trajectories with the [`mcsolve`](@ref) function. The `ensemble_method=EnsembleSplitThreads()` argument is used to parallelize the Monte Carlo quantum trajectories, by splitting the ensemble of trajectories among the workers. For a more detailed explanation of the different ensemble methods, you can check the [official documentation](https://docs.sciml.ai/DiffEqDocs/stable/features/ensemble/) of the [**DifferentialEquations.jl**](https://github.com/SciML/DifferentialEquations.jl/) package. Finally, the `rmprocs(workers())` command is used to remove the workers after the computation is finished.

Expand All @@ -140,7 +148,7 @@ FINISH!

where we can see that the computation **lasted only 21 seconds**.

### Master Equation by Sweeping Over Parameters
## Master Equation by Sweeping Over Parameters

In this example, we will consider a driven Jaynes-Cummings model, describing a two-level atom interacting with a driven cavity mode. The Hamiltonian is given by

Expand All @@ -154,7 +162,7 @@ and the collapse operators are given by
\hat{c}_1 = \sqrt{\gamma} \hat{a} \, , \quad \hat{c}_2 = \sqrt{\gamma} \hat{\sigma}_- \, .
```

The SLURM file is the same as before, but the `script.jl` file now contains the following content:
The SLURM batch script file is the same as before, but the `script.jl` file now contains the following content:

```julia
using Distributed
Expand Down
Loading
Loading