-
Notifications
You must be signed in to change notification settings - Fork 29
/
_README.html
368 lines (251 loc) · 21 KB
/
_README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Krotov Python Package — Krotov a6a2405 documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/version-alert.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"extensions": ["tex2jax.js"], "jax": ["input/TeX", "output/SVG"], "TeX": {"extensions": ["AMSmath.js", "AMSsymbols.js"], "Macros": {"tr": ["{\\operatorname{tr}}", 0], "diag": ["{\\operatorname{diag}}", 0], "abs": ["{\\operatorname{abs}}", 0], "pop": ["{\\operatorname{pop}}", 0], "ee": ["{\\text{e}}", 0], "ii": ["{\\text{i}}", 0], "aux": ["{\\text{aux}}", 0], "opt": ["{\\text{opt}}", 0], "tgt": ["{\\text{tgt}}", 0], "init": ["{\\text{init}}", 0], "lab": ["{\\text{lab}}", 0], "rwa": ["{\\text{rwa}}", 0], "bra": ["{\\langle#1\\vert}", 1], "ket": ["{\\vert#1\\rangle}", 1], "Bra": ["{\\left\\langle#1\\right\\vert}", 1], "Braket": ["{\\left\\langle #1\\vphantom{#2} \\mid #2\\vphantom{#1}\\right\\rangle}", 2], "ketbra": ["{\\vert#1\\rangle\\!\\langle#2\\vert}", 2], "Ket": ["{\\left\\vert#1\\right\\rangle}", 1], "mat": ["{\\mathbf{#1}}", 1], "op": ["{\\hat{#1}}", 1], "Op": ["{\\hat{#1}}", 1], "dd": ["{\\,\\text{d}}", 0], "daggered": ["{^{\\dagger}}", 0], "transposed": ["{^{\\text{T}}}", 0], "Liouville": ["{\\mathcal{L}}", 0], "DynMap": ["{\\mathcal{E}}", 0], "identity": ["{\\mathbf{1}}", 0], "Norm": ["{\\left\\lVert#1\\right\\rVert}", 1], "norm": ["{\\lVert#1\\rVert}", 1], "Abs": ["{\\left\\vert#1\\right\\vert}", 1], "avg": ["{\\langle#1\\rangle}", 1], "Avg": ["{\\left\\langle#1\\right\\rangle}", 1], "AbsSq": ["{\\left\\vert#1\\right\\vert^2}", 1], "Re": ["{\\operatorname{Re}}", 0], "Im": ["{\\operatorname{Im}}", 0], "Real": ["{\\mathbb{R}}", 0], "Complex": ["{\\mathbb{C}}", 0], "Integer": ["{\\mathbb{N}}", 0]}}, "tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
<link rel="stylesheet" href="_static/mycss.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Krotov
</a>
<div class="version">
0.4.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="01_overview.html">Krotov Python Package</a></li>
<li class="toctree-l1"><a class="reference internal" href="02_contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="03_authors.html">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_features.html">Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="05_history.html">History</a></li>
<li class="toctree-l1"><a class="reference internal" href="06_introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="07_krotovs_method.html">Krotov’s Method</a></li>
<li class="toctree-l1"><a class="reference internal" href="08_qutip_usage.html">Using Krotov with QuTiP</a></li>
<li class="toctree-l1"><a class="reference internal" href="09_examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="10_howto.html">How-Tos</a></li>
<li class="toctree-l1"><a class="reference internal" href="11_other_methods.html">Other Optimization Methods</a></li>
<li class="toctree-l1"><a class="reference internal" href="99_bibliography.html">References</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="API/krotov.html">API of the Krotov package</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Krotov</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>Krotov Python Package</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<style>
/* CSS overrides for sphinx_rtd_theme */
/* 24px margin */
.nbinput.nblast.container,
.nboutput.nblast.container {
margin-bottom: 19px; /* padding has already 5px */
}
/* ... except between code cells! */
.nblast.container + .nbinput.container {
margin-top: -19px;
}
.admonition > p:before {
margin-right: 4px; /* make room for the exclamation icon */
}
/* Fix math alignment, see https://github.com/rtfd/sphinx_rtd_theme/pull/686 */
.math {
text-align: unset;
}
</style>
<div class="section" id="krotov-python-package">
<h1>Krotov Python Package<a class="headerlink" href="#krotov-python-package" title="Permalink to this headline">¶</a></h1>
<a class="reference external image-reference" href="https://github.com/qucontrol/krotov"><img alt="Source code on Github" src="https://img.shields.io/badge/github-qucontrol/krotov-blue.svg" /></a>
<a class="reference external image-reference" href="https://pypi.python.org/pypi/krotov"><img alt="Krotov on the Python Package Index" src="https://img.shields.io/pypi/v/krotov.svg" /></a>
<a class="reference external image-reference" href="https://gitter.im/qucontrol_krotov/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img alt="Join the chat at https://gitter.im/qucontrol_krotov/Lobby" src="https://badges.gitter.im/qucontrol_krotov/Lobby.svg" /></a>
<a class="reference external image-reference" href="https://travis-ci.org/qucontrol/krotov"><img alt="Travis Continuous Integration" src="https://img.shields.io/travis/qucontrol/krotov.svg" /></a>
<a class="reference external image-reference" href="https://ci.appveyor.com/project/goerz/krotov"><img alt="AppVeyor Continuous Integration" src="https://ci.appveyor.com/api/projects/status/1cbm24w04jmxjpjh?svg=true" /></a>
<a class="reference external image-reference" href="https://codecov.io/gh/qucontrol/krotov"><img alt="Codecov" src="https://codecov.io/gh/qucontrol/krotov/branch/master/graph/badge.svg" /></a>
<a class="reference external image-reference" href="https://opensource.org/licenses/BSD-3-Clause"><img alt="BSD License" src="https://img.shields.io/badge/License-BSD-green.svg" /></a>
<a class="reference external image-reference" href="https://krotov.readthedocs.io/en/latest/?badge=latest"><img alt="Documentation Status" src="https://readthedocs.org/projects/krotov/badge/?version=latest" /></a>
<a class="reference external image-reference" href="https://mybinder.org/v2/gh/qucontrol/krotov/v0.4.0?filepath=docs%2Fnotebooks"><img alt="Launch Binder" src="https://mybinder.org/badge_logo.svg" /></a>
<a class="reference external image-reference" href="https://arxiv.org/abs/1902.11284"><img alt="arXiv" src="https://img.shields.io/badge/arXiv-1902.11284-red.svg" /></a>
<p>Python implementation of Krotov’s method for quantum optimal control.</p>
<p>This implementation follows the original implementation in the <a class="reference external" href="https://www.qdyn-library.net">QDYN Fortran library</a>.
The method is described in detail in <a class="reference external" href="https://doi.org/10.1063/1.3691827">D. M. Reich, M. Ndong, and C. P. Koch, J. Chem. Phys. 136, 104103 (2012)</a> (<a class="reference external" href="http://arxiv.org/abs/1008.5126">arXiv:1008.5126</a>).</p>
<p>The <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> package is built on top of <a class="reference external" href="http://qutip.org">QuTiP</a>.</p>
<p>Development happens on <a class="reference external" href="https://github.com/qucontrol/krotov">Github</a>. You can read the full documentation at <a class="reference external" href="https://krotov.readthedocs.io/en/stable/">ReadTheDocs</a>.</p>
<p>If you use the <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> package in your research, please <a class="reference internal" href="01_overview.html#citingkrotov"><span class="std std-ref">cite it</span></a>.</p>
<div class="section" id="purpose">
<h2>Purpose<a class="headerlink" href="#purpose" title="Permalink to this headline">¶</a></h2>
<p>Optimal control is a cornerstones of quantum technology: relying not
just on a passive understanding of quantum mechanics, but on the <em>active</em>
utilization of the quantum properties of matter. Quantum optimal control asks
how to manipulate the dynamics of a quantum system to behave in some desired
way. This is essential for the realization of quantum computers, and
related technologies such as quantum sensing. See e.g. <a class="reference external" href="https://link.springer.com/article/10.1140%2Fepjd%2Fe2015-60464-1">Glaser et al. Eur.
Phys. J. D 69, 279 (2015)</a> for an overview of methods, applications, and
current research directions. Quantum technology and thus quantum control are
the focus of several large-scale national and super-national research
endeavors, such as the U.S. $1 billion <a class="reference external" href="https://www.forbes.com/sites/alexknapp/2018/12/20/congress-just-passed-a-bill-to-accelerate-quantum-computing-heres-what-it-does/#20b5d2c22ef8">National Quantum Initiative Act</a> and
the €1 billion <a class="reference external" href="https://qt.eu/about/">European Quantum Flagship program</a>.</p>
<p>Krotov’s method is one of the two leading gradient-based optimization
algorithms used in numerical quantum optimal control. It simulates the dynamics
of a quantum system under a set of initial controls, and evaluates the
result with respect to an optimization functional to be minimized. It then
iteratively modifies the controls to guarantee a monotonically decreasing value
in the optimization functional. To date, there has not been an open source
implementation of the method. This package provides that missing
implementation.</p>
<p>The choice of Python as an implementation language is due to Python’s easy to learn
syntax, expressiveness, and immense popularity in the scientific community.
Moreover, the <a class="reference external" href="http://qutip.org">QuTiP</a> library exists to provide the foundations of
numerically describing quantum systems, and already includes basic versions of
some of the other popular algorithms in quantum control, the gradient-based
GRAPE and the gradient-free CRAB. The availability of the <a class="reference external" href="http://jupyter.org">Jupyter notebook</a>
framework provides an ideal platform for showing the use of the method.</p>
<p>The Krotov package targets both students wishing to enter
the field of quantum control, and researchers in the field. By providing a
comprehensive set of examples, we enable users of our package to
explore the formulation of typical control problems, and to understand how
Krotov’s method can solve them. These examples are inspired by
recent publications, and thus show the use of the method at the cutting edge of
research. Optimal control is also increasingly important in the design of
experiments, and we hope that the availability of an easy to use implementation
of Krotov’s will facilitate this further.</p>
<p>The use of Python implies that for large-scale control problems, performance
may become a significant issue. In this case, it may be necessary to implement
Krotov’s method in a more efficient (compiled) language. While the method as
such is relatively straightforward, there are some subtleties involved. Our
implementation puts an emphasis on clarity, and the documentation provides
detailed explanations of all necessary concepts. Thus, the Krotov package can
serve as a reference implementation, leveraging Python’s reputation as
“executable pseudocode”, and as a foundation against which to test other
implementations.</p>
</div>
<div class="section" id="prerequisites">
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline">¶</a></h2>
<p>The Krotov package is available for Python versions >= 3.5. Its main dependency is <a class="reference external" href="http://qutip.org">QuTiP</a>
(apart from the <a class="reference external" href="https://www.scipy.org">core packages of the Python scientific ecosystem</a>).
Thus, you should consider <a class="reference external" href="http://qutip.org/docs/latest/installation.html">QuTiP’s installation instructions</a>.</p>
<p>In any case, using some sort of <a class="reference external" href="https://docs.python.org/3/glossary.html#term-virtual-environment">virtual environment</a> is strongly encouraged.
Most packages in the Python scientific ecosystem are now available as
<a class="reference external" href="https://packaging.python.org/tutorials/installing-packages/#source-distributions-vs-wheels">wheels</a>, making installation via <a class="reference external" href="https://pip.pypa.io">pip</a> easy. However, <a class="reference external" href="https://github.com/qutip/qutip/issues/933">QuTiP currently does
not provide wheels</a>. Thus, on systems that do not have the necessary compilers
installed (Windows, macOS), the <a class="reference external" href="https://conda.io/docs/index.html">conda</a> package manager provides a good solution.</p>
<p>Assuming <code class="docutils literal notranslate"><span class="pre">conda</span></code> is installed (e.g. through <a class="reference external" href="https://conda.io/miniconda.html">Miniconda</a>), the following
commands set up a virtual (conda) environment into which the Krotov package can
then be installed:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> conda create -n qucontrolenv <span class="nv">python</span><span class="o">=</span><span class="m">3</span>.6
<span class="gp">$</span> conda activate qucontrolenv
<span class="gp">$</span> conda config --append channels conda-forge
<span class="gp">$</span> conda install qutip
</pre></div>
</div>
</div>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h2>
<p>To install the latest released version of <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> into your current (conda)
environment, run this command in your terminal:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> pip install krotov
</pre></div>
</div>
<p>This is the preferred method to install the <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> package, as it will always install the most recent stable release.</p>
<p>You may also do</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> pip install krotov<span class="o">[</span>dev,extras<span class="o">]</span>
</pre></div>
</div>
<p>to install additional development dependencies, including packages required to run the example notebooks.</p>
<p>If you don’t have <a class="reference external" href="https://pip.pypa.io">pip</a> installed, the <a class="reference external" href="http://docs.python-guide.org/en/latest/starting/installation/">Python installation guide</a>, respectively the <a class="reference external" href="https://packaging.python.org/tutorials/installing-packages/">Python Packaging User Guide</a> can guide
you through the process.</p>
<p>To install the latest development version of <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> from <a class="reference external" href="https://github.com/qucontrol/krotov">Github</a>:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> pip install git+https://github.com/qucontrol/krotov.git@master#egg<span class="o">=</span>krotov
</pre></div>
</div>
</div>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>To use Krotov’s method for quantum optimal control in a Python script or
<a class="reference external" href="http://jupyter.org">Jupyter notebook</a>, start with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">krotov</span>
</pre></div>
</div>
<p>Then,</p>
<ul class="simple">
<li><p>define the necessary quantum operators and states using <a class="reference external" href="http://qutip.org">QuTiP</a>.</p></li>
<li><p>create a list of objectives, as instances of
<a class="reference internal" href="API/krotov.objectives.html#krotov.objectives.Objective" title="krotov.objectives.Objective"><code class="xref py py-class docutils literal notranslate"><span class="pre">krotov.Objective</span></code></a></p></li>
<li><p>call <a class="reference internal" href="API/krotov.optimize.html#krotov.optimize.optimize_pulses" title="krotov.optimize.optimize_pulses"><code class="xref py py-func docutils literal notranslate"><span class="pre">krotov.optimize_pulses</span></code></a> to
perform an optimization of an arbitrary number of control fields over all the
objectives.</p></li>
</ul>
<p>See <a class="reference internal" href="08_qutip_usage.html#using-krotov-with-qutip"><span class="std std-ref">Using Krotov with QuTiP</span></a> and <a class="reference internal" href="09_examples.html#krotov-example-notebooks"><span class="std std-ref">Examples</span></a> for details.</p>
</div>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2019, Michael Goerz et al.
<span class="lastupdated">
Last updated on Dec 14, 2019.
</span>
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>