qenvs 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
qenvs-0.0.1/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .mypy_cache/
10
+ site/
11
+ .ipynb_checkpoints/
12
+ *.log
13
+ .DS_Store
14
+ src/qenvs/_version.py
15
+ .python-version
@@ -0,0 +1,17 @@
1
+ cff-version: 1.2.0
2
+ title: "QEnvS: physically validated quantum control environments"
3
+ message: "If you use QEnvS, please cite it using this metadata."
4
+ type: software
5
+ authors:
6
+ - family-names: Park
7
+ given-names: Beomdo
8
+ affiliation: Hanbat National University
9
+ license: Apache-2.0
10
+ repository-code: https://github.com/beomdo-park/QEnvS
11
+ url: https://beomdo-park.github.io/QEnvS
12
+ keywords:
13
+ - quantum control
14
+ - reinforcement learning
15
+ - quantum battery
16
+ - open quantum systems
17
+ - JAX
qenvs-0.0.1/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
qenvs-0.0.1/NOTICE ADDED
@@ -0,0 +1,25 @@
1
+ QEnvS (qenvs)
2
+ Copyright 2026 Beomdo Park
3
+
4
+ This product includes software developed at Hanbat National University.
5
+
6
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
7
+
8
+ -----------------------------------------------------------------------
9
+ Third-party attributions
10
+ -----------------------------------------------------------------------
11
+
12
+ * Project tooling layout (pyproject/ruff/taskipy/mkdocs conventions) is
13
+ adapted from dynamiqs (https://github.com/dynamiqs/dynamiqs),
14
+ Apache License 2.0, Copyright dynamiqs developers.
15
+
16
+ * The functional environment API (reset/step returning (state, timestep))
17
+ follows the design of Jumanji (https://github.com/instadeepai/jumanji),
18
+ Apache License 2.0, Copyright InstaDeep Ltd.
19
+
20
+ * QuTiP (https://qutip.org) is used as a reference implementation in the
21
+ validation test-suite only. QuTiP is distributed under the BSD 3-Clause
22
+ License, Copyright QuTiP developers and contributors.
23
+
24
+ No source code has been copied from projects that do not carry an
25
+ OSI-approved license (e.g. RL4qcWpc, which has no LICENSE file).
qenvs-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.5
2
+ Name: qenvs
3
+ Version: 0.0.1
4
+ Summary: QEnvS: physically validated quantum control environments (quantum batteries, state transfer, open systems) for RL and optimal control, built on JAX + dynamiqs.
5
+ Project-URL: Homepage, https://github.com/beomdo-park/QEnvS
6
+ Project-URL: Documentation, https://beomdo-park.github.io/QEnvS
7
+ Project-URL: Repository, https://github.com/beomdo-park/QEnvS
8
+ Project-URL: Issues, https://github.com/beomdo-park/QEnvS/issues
9
+ Author-email: Beomdo Park <pbeomdo@gmail.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: gymnasium,jax,open quantum systems,quantum battery,quantum control,reinforcement learning
14
+ Classifier: Development Status :: 2 - Pre-Alpha
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Scientific/Engineering :: Physics
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: dynamiqs>=0.3.6
23
+ Requires-Dist: equinox
24
+ Requires-Dist: jax!=0.7.0,!=0.7.1,<0.8,>=0.4.36
25
+ Requires-Dist: numpy
26
+ Provides-Extra: dev
27
+ Requires-Dist: codespell; extra == 'dev'
28
+ Requires-Dist: gymnasium>=1.0; extra == 'dev'
29
+ Requires-Dist: optax; extra == 'dev'
30
+ Requires-Dist: pre-commit; extra == 'dev'
31
+ Requires-Dist: pytest-xdist; extra == 'dev'
32
+ Requires-Dist: pytest>=8; extra == 'dev'
33
+ Requires-Dist: qutip>=5; extra == 'dev'
34
+ Requires-Dist: ruff>=0.8; extra == 'dev'
35
+ Provides-Extra: docs
36
+ Requires-Dist: mkdocs-gen-files; extra == 'docs'
37
+ Requires-Dist: mkdocs-literate-nav; extra == 'docs'
38
+ Requires-Dist: mkdocs-material; extra == 'docs'
39
+ Requires-Dist: mkdocstrings[python]; extra == 'docs'
40
+ Provides-Extra: gym
41
+ Requires-Dist: gymnasium>=1.0; extra == 'gym'
42
+ Description-Content-Type: text/markdown
43
+
44
+ # QEnvS
45
+
46
+ **Physically validated quantum control environments for reinforcement learning and optimal control.**
47
+
48
+ *Reusable physics. Reproducible control.*
49
+
50
+ [![ci](https://github.com/beomdo-park/QEnvS/actions/workflows/ci.yml/badge.svg)](https://github.com/beomdo-park/QEnvS/actions/workflows/ci.yml)
51
+ [![docs](https://github.com/beomdo-park/QEnvS/actions/workflows/docs.yml/badge.svg)](https://beomdo-park.github.io/QEnvS)
52
+ [![PyPI](https://img.shields.io/pypi/v/qenvs)](https://pypi.org/project/qenvs/)
53
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
54
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
55
+
56
+ QEnvS (Quantum Environment Suite) is a model zoo of open-quantum-system control
57
+ problems, quantum batteries, qubit state transfer, thermal machines, packaged so
58
+ that you can plug them into an RL agent or a gradient-based optimiser in a few
59
+ lines, instead of re-deriving the physics for every paper.
60
+
61
+ Every model ships with **analytic reference results that run as tests**
62
+ (pi-pulse inversion, exponential decay, ergotropy bounds, collective-charging
63
+ scaling, ...). If a model is in QEnvS, its physics has been checked against
64
+ closed-form solutions and against an independent simulator (QuTiP).
65
+
66
+ Built on [dynamiqs](https://github.com/dynamiqs/dynamiqs) (JAX): environments are
67
+ `jit`-able, `vmap`-able across thousands of trajectories, and differentiable, so
68
+ the same model serves RL (PPO/SAC), GRAPE-style optimal control and MPC.
69
+
70
+ ## Install
71
+
72
+ ```bash
73
+ pip install qenvs # core: jax + dynamiqs
74
+ pip install 'qenvs[gym]' # + gymnasium adapter (stable-baselines3, CleanRL, ...)
75
+ ```
76
+
77
+ ## Quickstart
78
+
79
+ Functional JAX API (batch 1024 episodes on one GPU):
80
+
81
+ ```python
82
+ import jax, jax.numpy as jnp
83
+ import qenvs
84
+
85
+ env = qenvs.make("qubit/StateTransfer-v0", horizon=10, dt=0.2)
86
+
87
+ keys = jax.random.split(jax.random.PRNGKey(0), 1024)
88
+ states, ts = jax.vmap(env.reset)(keys)
89
+ actions = jnp.ones((1024, env.action_dim))
90
+ states, ts = jax.jit(jax.vmap(env.step))(states, actions)
91
+ print(ts.reward.shape, ts.info["fidelity"].shape) # (1024,) (1024,)
92
+ ```
93
+
94
+ Gradient-based control through the same environment:
95
+
96
+ ```python
97
+ def loss(actions):
98
+ _, rewards = env.rollout(actions)
99
+ return -rewards.sum() # = -(F_final - F_initial)
100
+
101
+
102
+ grad = jax.grad(loss)(jnp.zeros((env.horizon, env.action_dim)))
103
+ ```
104
+
105
+ Gymnasium for classic RL libraries:
106
+
107
+ ```python
108
+ from qenvs.wrappers import GymnasiumEnv
109
+ from stable_baselines3 import PPO
110
+
111
+ gym_env = GymnasiumEnv(env)
112
+ PPO("MlpPolicy", gym_env).learn(20_000)
113
+ ```
114
+
115
+ Command line, for humans and coding agents (every command has `--json`;
116
+ `uvx qenvs ...` works without installing):
117
+
118
+ ```bash
119
+ qenvs list --json
120
+ qenvs info qubit/StateTransfer-v0 --json # physics, kwargs, references, usage
121
+ qenvs run qubit/StateTransfer-v0 --policy pi-pulse --set gamma1=0.1 --json
122
+ qenvs validate # per-check error vs tolerance + versions
123
+ qenvs doctor # install / backend / optional extras check
124
+ ```
125
+
126
+ Repository conventions for coding agents are in [AGENTS.md](AGENTS.md); an LLM
127
+ index of the docs is at [`/llms.txt`](https://beomdo-park.github.io/QEnvS/llms.txt).
128
+
129
+ ## Models and tasks
130
+
131
+ | Task id | Model | Dissipation | Validated against | Status |
132
+ |---|---|---|---|---|
133
+ | `qubit/StateTransfer-v0` | driven qubit | T1, T_phi (Lindblad) | Rabi formula, pi-pulse, T1/T_phi decay, ergotropy, energy conservation, rho constraints, solver convergence | available |
134
+ | `battery/TwoLevel-v0` | open qubit battery | T1, T_phi, thermal | ergotropy/power bounds | planned |
135
+ | `battery/Dicke-v0` | N qubits + cavity (Dicke / Tavis-Cummings) | cavity loss, dephasing | collective charging scaling | planned |
136
+ | `transfer/LambdaSTIRAP-v0` | three-level Lambda | spontaneous emission | adiabatic STIRAP transfer | planned |
137
+
138
+ See the [roadmap](docs/roadmap.md).
139
+
140
+ ## Why not X?
141
+
142
+ * **qutip-qoc / GRAPE / CRAB** optimise a pulse for one fixed model; QEnvS gives
143
+ you the model as a reusable, tested object plus an environment interface.
144
+ * **qiskit-gym, qgym** are circuit-level (synthesis, routing); QEnvS is
145
+ Hamiltonian/pulse-level with open-system dynamics.
146
+ * **Paper repositories** (e.g. ICML 2025 RL-for-quantum-control code) are
147
+ reproductions of one paper; QEnvS is the shared, maintained layer under them.
148
+
149
+ ## Contributing
150
+
151
+ See [CONTRIBUTING.md](CONTRIBUTING.md). New models must come with analytic
152
+ validation tests.
153
+
154
+ ## Citation
155
+
156
+ See [CITATION.cff](CITATION.cff). A Zenodo DOI will be attached to the first release.
157
+
158
+ ## License
159
+
160
+ Apache-2.0. Third-party attributions are listed in [NOTICE](NOTICE).
qenvs-0.0.1/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # QEnvS
2
+
3
+ **Physically validated quantum control environments for reinforcement learning and optimal control.**
4
+
5
+ *Reusable physics. Reproducible control.*
6
+
7
+ [![ci](https://github.com/beomdo-park/QEnvS/actions/workflows/ci.yml/badge.svg)](https://github.com/beomdo-park/QEnvS/actions/workflows/ci.yml)
8
+ [![docs](https://github.com/beomdo-park/QEnvS/actions/workflows/docs.yml/badge.svg)](https://beomdo-park.github.io/QEnvS)
9
+ [![PyPI](https://img.shields.io/pypi/v/qenvs)](https://pypi.org/project/qenvs/)
10
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
11
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
12
+
13
+ QEnvS (Quantum Environment Suite) is a model zoo of open-quantum-system control
14
+ problems, quantum batteries, qubit state transfer, thermal machines, packaged so
15
+ that you can plug them into an RL agent or a gradient-based optimiser in a few
16
+ lines, instead of re-deriving the physics for every paper.
17
+
18
+ Every model ships with **analytic reference results that run as tests**
19
+ (pi-pulse inversion, exponential decay, ergotropy bounds, collective-charging
20
+ scaling, ...). If a model is in QEnvS, its physics has been checked against
21
+ closed-form solutions and against an independent simulator (QuTiP).
22
+
23
+ Built on [dynamiqs](https://github.com/dynamiqs/dynamiqs) (JAX): environments are
24
+ `jit`-able, `vmap`-able across thousands of trajectories, and differentiable, so
25
+ the same model serves RL (PPO/SAC), GRAPE-style optimal control and MPC.
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ pip install qenvs # core: jax + dynamiqs
31
+ pip install 'qenvs[gym]' # + gymnasium adapter (stable-baselines3, CleanRL, ...)
32
+ ```
33
+
34
+ ## Quickstart
35
+
36
+ Functional JAX API (batch 1024 episodes on one GPU):
37
+
38
+ ```python
39
+ import jax, jax.numpy as jnp
40
+ import qenvs
41
+
42
+ env = qenvs.make("qubit/StateTransfer-v0", horizon=10, dt=0.2)
43
+
44
+ keys = jax.random.split(jax.random.PRNGKey(0), 1024)
45
+ states, ts = jax.vmap(env.reset)(keys)
46
+ actions = jnp.ones((1024, env.action_dim))
47
+ states, ts = jax.jit(jax.vmap(env.step))(states, actions)
48
+ print(ts.reward.shape, ts.info["fidelity"].shape) # (1024,) (1024,)
49
+ ```
50
+
51
+ Gradient-based control through the same environment:
52
+
53
+ ```python
54
+ def loss(actions):
55
+ _, rewards = env.rollout(actions)
56
+ return -rewards.sum() # = -(F_final - F_initial)
57
+
58
+
59
+ grad = jax.grad(loss)(jnp.zeros((env.horizon, env.action_dim)))
60
+ ```
61
+
62
+ Gymnasium for classic RL libraries:
63
+
64
+ ```python
65
+ from qenvs.wrappers import GymnasiumEnv
66
+ from stable_baselines3 import PPO
67
+
68
+ gym_env = GymnasiumEnv(env)
69
+ PPO("MlpPolicy", gym_env).learn(20_000)
70
+ ```
71
+
72
+ Command line, for humans and coding agents (every command has `--json`;
73
+ `uvx qenvs ...` works without installing):
74
+
75
+ ```bash
76
+ qenvs list --json
77
+ qenvs info qubit/StateTransfer-v0 --json # physics, kwargs, references, usage
78
+ qenvs run qubit/StateTransfer-v0 --policy pi-pulse --set gamma1=0.1 --json
79
+ qenvs validate # per-check error vs tolerance + versions
80
+ qenvs doctor # install / backend / optional extras check
81
+ ```
82
+
83
+ Repository conventions for coding agents are in [AGENTS.md](AGENTS.md); an LLM
84
+ index of the docs is at [`/llms.txt`](https://beomdo-park.github.io/QEnvS/llms.txt).
85
+
86
+ ## Models and tasks
87
+
88
+ | Task id | Model | Dissipation | Validated against | Status |
89
+ |---|---|---|---|---|
90
+ | `qubit/StateTransfer-v0` | driven qubit | T1, T_phi (Lindblad) | Rabi formula, pi-pulse, T1/T_phi decay, ergotropy, energy conservation, rho constraints, solver convergence | available |
91
+ | `battery/TwoLevel-v0` | open qubit battery | T1, T_phi, thermal | ergotropy/power bounds | planned |
92
+ | `battery/Dicke-v0` | N qubits + cavity (Dicke / Tavis-Cummings) | cavity loss, dephasing | collective charging scaling | planned |
93
+ | `transfer/LambdaSTIRAP-v0` | three-level Lambda | spontaneous emission | adiabatic STIRAP transfer | planned |
94
+
95
+ See the [roadmap](docs/roadmap.md).
96
+
97
+ ## Why not X?
98
+
99
+ * **qutip-qoc / GRAPE / CRAB** optimise a pulse for one fixed model; QEnvS gives
100
+ you the model as a reusable, tested object plus an environment interface.
101
+ * **qiskit-gym, qgym** are circuit-level (synthesis, routing); QEnvS is
102
+ Hamiltonian/pulse-level with open-system dynamics.
103
+ * **Paper repositories** (e.g. ICML 2025 RL-for-quantum-control code) are
104
+ reproductions of one paper; QEnvS is the shared, maintained layer under them.
105
+
106
+ ## Contributing
107
+
108
+ See [CONTRIBUTING.md](CONTRIBUTING.md). New models must come with analytic
109
+ validation tests.
110
+
111
+ ## Citation
112
+
113
+ See [CITATION.cff](CITATION.cff). A Zenodo DOI will be attached to the first release.
114
+
115
+ ## License
116
+
117
+ Apache-2.0. Third-party attributions are listed in [NOTICE](NOTICE).
@@ -0,0 +1,102 @@
1
+ [project]
2
+ name = "qenvs"
3
+ description = "QEnvS: physically validated quantum control environments (quantum batteries, state transfer, open systems) for RL and optimal control, built on JAX + dynamiqs."
4
+ authors = [{ name = "Beomdo Park", email = "pbeomdo@gmail.com" }]
5
+ dynamic = ["version"]
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE", "NOTICE"]
8
+ readme = "README.md"
9
+ requires-python = ">=3.11"
10
+ classifiers = [
11
+ "Development Status :: 2 - Pre-Alpha",
12
+ "Operating System :: OS Independent",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Topic :: Scientific/Engineering :: Physics",
17
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
18
+ ]
19
+ keywords = ["quantum control", "reinforcement learning", "quantum battery", "open quantum systems", "jax", "gymnasium"]
20
+ dependencies = [
21
+ # jax<0.8: dynamiqs 0.3.6 fails to import with jax>=0.8 (UnionType | str in qarray.py).
22
+ # Loosen once dynamiqs ships a fix.
23
+ "jax>=0.4.36,!=0.7.0,!=0.7.1,<0.8",
24
+ "dynamiqs>=0.3.6",
25
+ "equinox",
26
+ "numpy",
27
+ ]
28
+
29
+ [project.scripts]
30
+ qenvs = "qenvs.cli:main"
31
+
32
+ [project.optional-dependencies]
33
+ gym = ["gymnasium>=1.0"]
34
+ dev = [
35
+ "qenvs[gym]",
36
+ "pytest>=8",
37
+ "pytest-xdist",
38
+ "ruff>=0.8",
39
+ "codespell",
40
+ "pre-commit",
41
+ "qutip>=5", # reference implementation for validation tests
42
+ "optax", # gradient baselines in examples/
43
+ ]
44
+ docs = [
45
+ "mkdocs-material",
46
+ "mkdocstrings[python]",
47
+ "mkdocs-gen-files",
48
+ "mkdocs-literate-nav",
49
+ ]
50
+
51
+ [project.urls]
52
+ Homepage = "https://github.com/beomdo-park/QEnvS"
53
+ Documentation = "https://beomdo-park.github.io/QEnvS"
54
+ Repository = "https://github.com/beomdo-park/QEnvS"
55
+ Issues = "https://github.com/beomdo-park/QEnvS/issues"
56
+
57
+ [build-system]
58
+ requires = ["hatchling>=1.27", "hatch-vcs"]
59
+ build-backend = "hatchling.build"
60
+
61
+ [tool.hatch.version]
62
+ source = "vcs"
63
+
64
+ [tool.hatch.build.hooks.vcs]
65
+ version-file = "src/qenvs/_version.py"
66
+
67
+ [tool.hatch.build.targets.wheel]
68
+ packages = ["src/qenvs"]
69
+
70
+ [tool.hatch.build.targets.sdist]
71
+ include = ["src/qenvs", "tests", "README.md", "LICENSE", "NOTICE", "CITATION.cff"]
72
+
73
+ # --- tooling (ruff config adapted from dynamiqs, Apache-2.0) ---
74
+ [tool.ruff]
75
+ line-length = 100
76
+ target-version = "py311"
77
+
78
+ [tool.ruff.format]
79
+ quote-style = "double"
80
+ docstring-code-format = true
81
+
82
+ [tool.ruff.lint]
83
+ select = ["F", "E", "W", "I", "UP", "B", "C4", "SIM", "RET", "ARG", "PTH", "NPY", "RUF", "D"]
84
+ ignore = ["D100", "D102", "D104", "D105", "D107", "D203", "D213", "E741", "RUF012"]
85
+
86
+ [tool.ruff.lint.per-file-ignores]
87
+ "__init__.py" = ["F401"]
88
+ "tests/**" = ["D", "ARG"]
89
+ "docs/**" = ["D"]
90
+ "examples/**" = ["D"]
91
+
92
+ [tool.ruff.lint.pydocstyle]
93
+ convention = "google"
94
+
95
+ [tool.codespell]
96
+ skip = ".git,*.ipynb,uv.lock,site"
97
+ ignore-words-list = "ket,braket,sme"
98
+
99
+ [tool.pytest.ini_options]
100
+ testpaths = ["tests"]
101
+ addopts = "-q"
102
+ filterwarnings = ["ignore::DeprecationWarning"]
@@ -0,0 +1,25 @@
1
+ """QEnvS: physically validated quantum control environments for RL and optimal control."""
2
+
3
+ from qenvs import envs, models, observables, tasks, validation
4
+ from qenvs.envs.base import Environment, EnvState, TimeStep
5
+ from qenvs.registry import make, register, registry
6
+
7
+ try:
8
+ from qenvs._version import __version__
9
+ except ImportError: # pragma: no cover - editable install without build hook
10
+ __version__ = "0.0.0+unknown"
11
+
12
+ __all__ = [
13
+ "EnvState",
14
+ "Environment",
15
+ "TimeStep",
16
+ "__version__",
17
+ "envs",
18
+ "make",
19
+ "models",
20
+ "observables",
21
+ "register",
22
+ "registry",
23
+ "tasks",
24
+ "validation",
25
+ ]