Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • kwant/website
  • jbweston/website
  • basnijholt/website
  • r-j-skolasinski/website
  • marwahaha/website
5 results
Show changes
Commits on Source (184)
Showing
with 1871 additions and 860 deletions
*~
*.pyc
/catalog.yaml
.doit.db
cache/
output/
image: kwant/website-deploy
before_script:
- nikola build
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- eval $(ssh-agent -s)
test_deploy:
script:
- echo "$TEST_WEBSITE_KEY" | tr -d '\r' | ssh-add -
- nikola deploy
except:
- master
master_deploy:
script:
- echo "$MASTER_WEBSITE_KEY" | tr -d '\r' | ssh-add -
- nikola deploy master
only:
- master
This diff is collapsed.
*.html
Kwant user survey
=================
The kwant user survey is finished, please use the `mailing list
</community.html>`_ if you would like to leave feedback.
Quantum transport simulations made easy
=======================================
Kwant is a Python package for numerical calculations on tight-binding models
with a strong focus on quantum transport. It is designed to be flexible and
easy to use. Thanks to the use of innovative algorithms, Kwant is often faster
than other available codes, even those entirely written in the low level
FORTRAN and C/C++ languages.
Kwant is a `free (open source) <https://gitlab.kwant-project.org/kwant/kwant>`_ Python
package for numerical calculations on tight-binding models with a strong focus
on quantum transport. It is designed to be flexible and easy to use. Thanks to
the use of innovative algorithms, Kwant is often faster than other available
codes, even those entirely written in the low level FORTRAN and C/C++ languages.
Tight-binding models can describe a vast variety of systems and phenomena in
quantum physics. Therefore, Kwant can be used to simulate metals, graphene,
......@@ -20,9 +20,7 @@ summarized as follows:
.. raw:: html
<img src="kwant-workflow1.svgz" style="width:71%;
float:left; margin-right:2%">
<img src="kwant-workflow2.jpg" style="width:27%;">
<object type="image/svg+xml" data="kwant-workflow.svgz" class="img-responsive">kwant-workflow.svgz</object>
Kwant was designed to be easy to use: Section 2 of the `Kwant paper
<http://downloads.kwant-project.org/doc/kwant-paper.pdf>`_ contains a
......@@ -35,31 +33,30 @@ Examples of Kwant usage
-----------------------
The following examples are meant to give an overview of what is possible with
Kwant. The tutorial section of `Kwant documentation <doc/1.0/>`_ and the
Kwant. The tutorial section of `Kwant documentation <doc/1/>`_ and the
`Kwant paper`_ each contain several pedagogical examples with line-by-line
explanations (`zipfile of all examples
<http://downloads.kwant-project.org/examples/kwant-examples-1.0.0.zip>`_).
Graphene flake
..............
.. container:: rightside
.. raw:: html
<object type="image/svg+xml" class="col-md-4 pull-left img-responsive" data="graphene-edgestate.svgz">graphene-edgestate.svgz</object>
.. image:: graphene-edgestate.svgz
:width: 15em
The complete code that constructs the graphene flake shown on the right side is
The complete code that constructs the graphene flake shown on the right side
is::
.. code:: python
def disk(pos):
x, y = pos
return x**2 + y**2 < 8**2
def disk(pos):
x, y = pos
return x**2 + y**2 < 8**2
lat = kwant.lattice.honeycomb()
sys = kwant.Builder()
sys[lat.shape(disk, (0, 0))] = 0
sys[lat.neighbors()] = -1
lat = kwant.lattice.honeycomb()
syst = kwant.Builder()
syst[lat.shape(disk, (0, 0))] = 0
syst[lat.neighbors()] = -1
In addition to the flake itself, the image also shows the wave function of a
low energy eigenstate. The size of each circle is proportional to the wave
......@@ -67,15 +64,40 @@ function probability amplitude on that site. It can be clearly seen that the
wave function is peaked near the zigzag segments of the boundary, as `expected
<http://arxiv.org/abs/1003.4602>`_ for graphene quantum dots.
Taken from the Kwant `plotting tutorial <doc/1.0/tutorial/tutorial6.html>`_.
Taken from the Kwant `plotting tutorial <doc/1/tutorial/tutorial6.html>`_.
.. class:: row nomargin
Quantum Hall effect
...................
.. raw:: html
<object type="image/svg+xml" class="col-md-4 img-responsive pull-left" data="qhe-edgestate.svgz">qhe-edgestate.svgz</object>
<object type="image/svg+xml" class="col-md-4 img-responsive pull-right" data="qhe-plateaus.svgz">qhe-plateaus.svgz</object>
One of the most common applications of Kwant is to calculate the conductance of
a nanoelectronic system. The plot on the left shows the conductance through a
2-d electron gas as a function of magnetic flux. The quantization of
conductance that is visible (plateaus) is the hallmark of the quantum Hall
effect. The third plateau does not develop due to a constriction in the system
that leads to backscattering. The scattering wave function from the left lead
at magnetic field strength corresponding to the middle of the third QHE plateau
is shown on the right.
Taken from example 6 of the `Kwant paper
<http://downloads.kwant-project.org/doc/kwant-paper.pdf>`_.
.. class:: row
3-d system: Majorana states
...........................
.. container:: rightside
.. class:: col-md-4 img-responsive pull-left
.. image:: quantum-wire.png
.. image:: quantum-wire.png
Kwant allows systems of any dimensionality, for example three-dimensional ones.
This image shows a 3-d model of a semiconducting quantum wire (gray cylinder).
......@@ -85,13 +107,14 @@ Majorana bound state appears close to the superconducting-normal interface.
Taken from an unpublished work by S. Mi, A. R. Akhmerov, and M. Wimmer.
.. class:: row
Numerical experiment: flying qubit
..................................
.. container:: rightside
.. class:: col-md-4 col-sm-12 img-responsive pull-right
.. image:: flying-qubit.png
.. image:: flying-qubit.png
Numerical simulations and experimental results for a flying qubit sample made in
a GaAs/GaAlAs heterostrucutre. The Kwant simulations were performed with
......@@ -105,19 +128,18 @@ Taken from an unpublished work by T. Bautze et al. See Yamamoto et al., `Nature
Nanotechnology 7, 247 (2012) <http://dx.doi.org/doi:10.1038/nnano.2012.28>`_ for
details about the experiment.
.. class:: row
conductance of a Corbino disk in a quantum Hall regime
Conductance of a Corbino disk in a quantum Hall regime
......................................................
.. container:: leftside
.. image:: corbino-layout.svgz
:width: 15em
.. raw:: html
<object type="image/svg+xml" class="col-md-4 col-sm-6 img-responsive pull-left" data="corbino-layout.svgz">corbino-layout.svgz</object>
.. container:: rightside
.. class:: col-md-4 col-sm-6 img-responsive pull-right
.. image:: corbino-conductance.png
.. image:: corbino-conductance.png
Transport properties of a Corbino disk across a quantum Hall transition. Left:
geometry of the sample consisting of a ring-shaped two-dimensional electron gas
......
......@@ -6,9 +6,8 @@ The principal developers of kwant are:
* `Christoph W. Groth <mailto:christoph.groth@cea.fr>`_ (SPSMS-INAC-CEA
Grenoble)
* `Michael Wimmer <http://www.lorentz.leidenuniv.nl/~wimmer/>`_ (Leiden
University)
* `Anton R. Akhmerov <http://antonakhmerov.org>`_ (Delft University)
* `Michael Wimmer <http://www.lorentz.leidenuniv.nl/~wimmer/>`_ (TU Delft)
* `Anton R. Akhmerov <http://antonakhmerov.org>`_ (TU Delft)
* `Xavier Waintal <http://inac.cea.fr/Pisp/xavier.waintal/>`_ (SPSMS-INAC-CEA
Grenoble)
......
......@@ -4,15 +4,17 @@ Citing Kwant
We provide Kwant as free software under a `BSD license </license.html>`_ as a
service to the physics community. If you have used Kwant for work that has
lead to a scientific publication, please mention the fact that you used it
explicitly in the text body. For example, you may add:
explicitly in the text body. For example, you may add
*The numerical calculations were performed using the Kwant code.*
*the numerical calculations were performed using the Kwant code*
to the description of your numerical calculations. In addition, we ask you to
cite the main paper that introduces Kwant:
C. W. Groth, M. Wimmer, A. R. Akhmerov, X. Waintal, *Kwant: a software package
for quantum transport*, `arXiv:1309.2926 <http://arxiv.org/abs/1309.2926>`_.
C. W. Groth, M. Wimmer, A. R. Akhmerov, X. Waintal,
*Kwant: a software package for quantum transport*,
`New J. Phys. 16, 063065 (2014)
<http://iopscience.iop.org/1367-2630/16/6/063065/article>`_.
Other references we ask you to consider
......@@ -27,9 +29,9 @@ Kwant owes much of its current performance to the use of the `MUMPS
equations. If you have done high-performance calculations, we suggest citing
P. R. Amestoy, I. S. Duff, J. S. Koster, J. Y. L’Excellent, SIAM. J. Matrix
Anal. & Appl. **23** (1), 15 (2001).
Anal. & Appl. 23 (1), 15 (2001).
Finally, if you use the routine for generation of circular ensembles of random
matrices, please cite
\F. Mezzadri, Notices Am. Math. Soc. **54**, 592 (2007).
\F. Mezzadri, Notices Am. Math. Soc. 54, 592 (2007).
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7056 2011-06-17 10:50:48Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math {
margin-left: 2em ;
margin-right: 2em }
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
@import url(html4css1.css);
/* Keeping a scrollbar always there to make centering work properly. */
html {
overflow-y: scroll;
}
body {
min-width: 20em;
max-width: 55em;
margin: 0 auto;
font-family: "Bitstream Vera Serif", Georgia, serif;
}
div.padding {
margin: 1em;
}
/* Enable hyphenation. */
body {
text-align:justify;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
-o-hyphens: auto;
hyphens: auto;
}
tt, pre {
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
-o-hyphens: none;
hyphens: none;
}
/* The link color is the average color of the Kwant logo. */
a {
color: #045e94;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
ul.navigation{
display: block;
text-align: center;
padding: 0.4em;
border-radius: 5px;
background-color: #eeeeee;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
-o-hyphens: none;
hyphens: none;
}
ul.navigation li{
display: inline;
margin: 0 1em;
}
.hidden_structure {
display: none;
}
#header { margin-top: 0.5em; }
#footer { margin: 2em 0; }
#header, #header a, #footer {
color: black;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Bitstream Vera Sans", Verdana, sans-serif;
font-weight: normal;
}
li {
margin: 0.3em 0
}
img {
display: block;
margin-left: auto;
margin-right: auto;
}
pre, code { background-color: #eee; border: 1px solid #ccc; }
pre.literal-block { overflow: hidden }
pre { padding: 0.3em; }
code { padding: 0 0.1em; }
pre > code { border: none; padding: 0; }
div.leftside {
float: left;
margin: 0 2em 0 0;
}
div.rightside {
float: right;
margin: 0 0 0 2em;
}
div.section{
height: auto;
overflow: auto;
}
The Kwant community
===================
The Kwant project is an international collaboration.
Everybody is welcome to participate in the community
by asking and replying to questions, reporting bugs, providing suggestions,
and `contributing to the code and documentation </contribute.html>`_.
The Kwant community uses three public communication channels:
the mailing list for generic discussions, questions, and announcements;
the gitlab instance for development discussions and reporting bugs;
and the chat for real-time discussions related to development.
A list of `Kwant authors </authors>`_ is included in the documentation.
Please contact the authors directly only for matters that cannot be discussed on the public channels.
Mailing list
------------
The kwant-discuss mailing list is the main public communication platform for anything related to Kwant:
questions, discussions, development, and announcements.
It may be used both as a web forum and as a classical mailing list.
The `kwant-discuss web interface <https://mail.python.org/archives/list/kwant-discuss@python.org/>`_
allows to follow discussions and search the archives.
To start a new discussion thread, you may either use the web interface
(sign-in required)
or write directly to
kwant-discuss@python.org.
In order to avoid spam,
messages of unsubscribed participants are held for moderation.
Similarly, replying is possible either by mail
(if you received the post to which you want reply by mail),
or using the web interface:
the “reply” button under each message allows to compose directly
(for signed-in users),
or triggers a reply by mail (otherwise).
You may subscribe to receive posts to the list by mail.
Subscription is done either through the
`kwant-discuss info page
<https://mail.python.org/mailman3/lists/kwant-discuss.python.org/>`_
or by sending any message to
kwant-discuss-join@python.org.
(The subject and content are ignored and may be empty.)
To unsubscribe, either use the info page,
or send any message to kwant-discuss-leave@python.org.
List etiquette :
- When asking questions,
`help others to help you <https://stackoverflow.com/help/how-to-ask>`_.
In particular, use the search function before posting.
- When replying, please avoid quoting the complete original message.
Instead, consider
`bottom-posting <https://en.wikipedia.org/wiki/Posting_style#Bottom-posting>`_.
Announcements mailing list
--------------------------
This read-only list is used for important announcements like new releases of Kwant.
Only a few messages are sent per year.
These announcements are also posted on the main mailing list,
so there is no need to subscribe to both lists.
We recommend every user of Kwant to subscribe at least to this list in order to stay informed about new developments.
The `kwant-announce archives <https://mail.python.org/archives/list/kwant-announce@python.org/>`_
are available on the web.
To subscribe, either use the form on the `kwant-announce info page <https://mail.python.org/mailman3/lists/kwant-announce.python.org/>`_
or simply send any message to kwant-announce-join@python.org.
(The subject and content are ignored and may be empty.)
To unsubscribe, either use the info page, or send any message to kwant-announce-leave@python.org.
Development chat
----------------
The Kwant developer chat is accessible to the community via `Gitter <https://gitter.im/kwant-project/Lobby>`_.
Come say hi if you would like to get involved with developing Kwant!
Gitlab instance
---------------
The Kwant project runs a `gitlab instance <https://gitlab.kwant-project.org/>`_
that hosts the `main Kwant code repository <https://gitlab.kwant-project.org/kwant/kwant>`_
as well as the `repositories of related projects <https://gitlab.kwant-project.org/kwant>`_.
The gitlab instance is used for reporting bugs (see next section) and `development </contribute.html>`_
Reporting bugs
--------------
If you encounter a problem with Kwant,
first try to reproduce it with as simple a system as possible.
Double-check with the documentation that what you observe is actually a bug in Kwant.
If you think it is, please check `the list of known bugs in Kwant <https://gitlab.kwant-project.org/kwant/kwant/issues?label_name=bug>`_.
It may be also a good idea to search or ask on the general mailing list.
(You can use the search box at the top of this page.)
If after checking you still think that you have found a bug, please add it to
the above-mentioned list of bugs by creating an issue with the “bug” label. A
useful bug report should contain:
- The versions of software you are using: Kwant, Python, operating system, etc.
- A description of the problem, i.e. what exactly goes wrong. This should
include any relevant error messages.
- Enough information to reproduce the bug, preferably in the form of a simple
script.
Getting help, contributing and reporting problems
=================================================
Mailing list
------------
The mailing list is (meant to become) the main communication platform for
anything related to Kwant: asking questions, reporting bugs, and discussing
further development. You can use it in various ways:
- .. raw:: html
<form method=post action="https://mailman-mail5.webfaction.com/subscribe/kwant-discuss">
<input type="text" name="email" size=25 value="Your email address" onblur="if (this.value == '') {this.value='Your email address'}" onfocus="if (this.value == 'Your email address') {this.value=''}" />
<input type="submit" name="email-button" value="Subscribe to the mailing list" />
</form>
… and read it together with your regular email. (To unsubscribe, follow the
link in the footer of a message.)
- Read the list via the `Gmane web interface
<http://news.gmane.org/gmane.comp.science.kwant.user>`_. The web interface
allows to write new messages (action: post) and to reply (action: followup).
- .. raw:: html
<p><form id="searchgmane" method="get" action="http://search.gmane.org/">
<input type="text" size=25 name="query" />
<input type="hidden" name="group" value="gmane.comp.science.kwant.user" />
<input type="submit" value="Search the mailing list" />
</form></p>
- Send a message directly to kwant-discuss@kwant-project.org. (If you are not
subscribed, it is not guaranteed that any followups will reach you by email,
so you should ask to be CCed.)
Announcements of new releases
-----------------------------
This read-only list is reserved for important announcements like new releases of
Kwant. Only a few messages will be sent per year. We recommend every user of
Kwant to subscribe to it in order to stay informed about new developments.
.. raw:: html
<form method=post action="https://mailman-mail5.webfaction.com/subscribe/kwant-announce">
<input type="text" name="email" size=25 value="Your email address" onblur="if (this.value == '') {this.value='Your email address'}" onfocus="if (this.value == 'Your email address') {this.value=''}" />
<input type="submit" name="email-button" value="Subscribe to announcements" />
</form>
Reporting bugs
--------------
If you encounter a problem with Kwant, first try to reproduce it with as simple
a system as possible. Double-check with the documentation that what you
observe is actually a bug in Kwant. If you think it is, please check whether
the problem is already known by searching the mailing list.
If the problem is not known yet, please send a bug report to the mailing list.
A report should contain:
* The versions of software you are using (Kwant, Python, operating system, etc.)
* A description of the problem, i.e. what exactly goes wrong.
* Enough information to reproduce the bug, preferably in the form of a simple
script.
Contributing
------------
We see Kwant not just as a package with fixed functionality, but rather as a
framework for implementing different physics-related algorithms using a common
set of concepts and, if possible, a shared interface. We have designed it
leaving room for growth, and plan to keep extending it.
External contributions to Kwant are highly welcome. You can help to advance
the project not only by writing code, but also by reporting bugs, and
fixing/improving the documentation. A `mailing list
</community.html>`_ is available for discussions.
If you have some code that works well with Kwant, or extends it in some useful
way, please consider sharing it. Any external contribution will be clearly
marked as such, and relevant papers will be added to the list of `suggested
acknowledgements </citing.html>`_. The complete development history is also
made available through a `web interface <http://git.kwant-project.org/kwant>`_.
If you plan to contribute, it is best to coordinate with us in advance either
through the mailing list, or directly at authors@kwant-project.org for matters
that you prefer to not discuss publicly.
How to contribute
.................
We use the version control system `Git <http://git-scm.com/>`_ to coordinate the
development of Kwant. If you are new to Git, we invite you to learn its basics.
(There's a plethora of information available on the Web.) Kwant's Git
repository contains not only the source code, but also all of the reference
documentation and the tutorial.
It is best to base your work on the latest version of Kwant::
git clone http://git.kwant-project.org/kwant
Then you can modify the code, and build Kwant and the documentation as
described in the `build instructions
</doc/1.0/pre/install.html#building-and-installing-from-source>`_.
Some things to keep in mind:
* Please keep the code consistent by adhering to the prevailing naming and
formatting conventions. We generally follow the `"Style Guide for Python
Code" <http://www.python.org/dev/peps/pep-0008/>`_ For docstrings, we follow
`NumPy's "Docstring Standard"
<http://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_ and
`Python's "Docstring Conventions"
<http://www.python.org/dev/peps/pep-0257/>`_.
* Write tests for all the important functionality you add. Be sure not to
break existing tests.
A useful trick for working on the source code is to build in-place so that there
is no need to re-install after each change. This can be done with the following
command ::
python setup.py build_ext -i
The ``kwant`` subdirectory of the source distribution will be thus turned into
a proper Python package that can be imported. To be able to import Kwant from
within Python, one can either work in the root directory of the distribution
(where the subdirectory ``kwant`` is located), or make a (symbolic) link from
somewhere in the Python search path to the the package subdirectory.
Contributing to Kwant
=====================
We see Kwant not just as a package with fixed functionality, but rather as a
framework for implementing different physics-related algorithms using a common
set of concepts. Contributions to Kwant are highly welcome. You can help the
project not only by writing code, but also by reporting bugs, and
fixing/improving the website and the documentation.
Where help is needed
--------------------
The `Kwant issue tracker
<https://gitlab.kwant-project.org/kwant/kwant/issues>`_ serves to track bugs
in Kwant, but most issues are in fact ideas for enhancements. The issues are
categorized with labels, so that it is possible to view `all the “easy” issues
<https://gitlab.kwant-project.org/kwant/kwant/issues?label_name=difficulty%3A+easy>`_
for example.
Please do feel free to enter new issues yourself. If you are unsure about some aspect It may be a good idea to discuss your idea on the mailing list kwant-discuss@kwant-project.org before filing an issue.
If you already have some code that extends Kwant in a useful way, please
consider sharing it. If your extension fits well with Kwant and is of wide
enough interest, we will be happy to include it into Kwant proper. For more
specialized cases, we will find a solution as well. (We could, for example,
add a list of Kwant-related modules to this website.) In any case, external
contributions will be clearly marked as such, and relevant papers will be
added to the list of `suggested acknowledgements </cite.html>`_.
Getting the source code
-----------------------
The source code of released versions of Kwant is available for `download
<http://downloads.kwant-project.org/kwant/>`_. You can follow the development
through the `Kwant page of our GitLab instance
<https://gitlab.kwant-project.org/kwant/kwant>`_. The `Git
<http://git-scm.com/>`_ repository of Kwant can be cloned directly with the
command ::
git clone https://gitlab.kwant-project.org/kwant/kwant.git
The Kwant git repository has two main branches: The branch *master*
contains the development towards the next release. The branch *stable* contains
the most recent release that is considered stable, and only bugfixes are applied
to it.
Setting up for development
--------------------------
When working with the Kwant source, regular `build instructions
</doc/1/pre/install.html#building-and-installing-from-source>`_ apply. It
would be tiresome, however, to have to reinstall the modified Kwant after each
modification.
One easy way to avoid this is to build in-place so that there is no need to
reinstall after each change. This can be done with the following command ::
python3 setup.py build_ext -i
No further installation is necessary. The “inner” ``kwant`` subdirectory has
been turned into a proper Python package that can be imported from the “outer”
directory, i.e. the directory where ``setup.py`` is located. Any script
inside that directory that imports Kwant will get the modified version. (To
be able to import the modified Kwant from another directory one can create a
symbolic link to the package.)
The above ``build_ext`` command does not have to be rerun when a Python file
is modified. Recompilation is only necessary whenever a Cython file
(``.pyx``) has been changed.
Modifying the source code
-------------------------
We recommend that you keep each of your changes to Kwant on a separate “topic
branch” that starts at *master*. Try to not mix up unrelated changes in a
single branch. To create a topic branch, use the command::
git checkout -b my_topic master
Now you can begin to implement your idea. As you go, register your changes
with Git as explained, for example, in the `Pro Git book
<https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository>`_
that is freely available online.
Once you feel that you would like to show your work to other interested people
(because you would like to receive feedback, or because you consider it
ready), it's time to inspect your branch. Run ``git status`` to make sure
that you have committed all of your changes, then use a tool like ``gitk`` to
view your branch.
In the following, two methods to share your commits are described. The first
will be familiar if you have experience with the popular GitHub service. If
you do not, you might prefer the second method, since it is simpler.
Method 1: Using the Kwant GitLab instance
.........................................
Go the `GitLab page of the official Kwant repository
<https://gitlab.kwant-project.org/kwant/kwant>`_. Since you do not have write
access to this repository, you have to create an own “fork” of it by clicking
on the button just right of the “star” button.
You created a public copy of the Kwant repository that is controlled by you.
Add it as a remote repository to the clone of Kwant on your computer::
git remote add own https://gitlab.kwant-project.org/<USERNAME>/kwant.git
You can copy-and-paste your own version of the above URL from the main page of
your repository. (If you know about SSH, you may also prefer to upload your
public ssh key to GitLab and to use SSH as transport.) The string ``own`` is
the local name you give to the remote, it can be anything.
Now you can push your topic branch to your repository::
git push own my_branch
This will make your branch appear in GitLab. Now you can let us know about
your branch by `creating a merge request in GitLab
<https://gitlab.kwant-project.org/help/workflow/forking_workflow.md>`_ or by
sending a message to kwant-discuss@kwant-project.org.
Method 2: Sending patches to the mailing list
.............................................
Run the command ::
git format-patch origin/master
This will create a “patch” file for each commit on your branch. Now simply
send these patches as email attachments to kwant-discuss@kwant-project.org,
together with an explanation of your idea. You do not have to be subscribed
to the mailing list.
(Or, even better, use ``git send-email`` as shown in this `example of usage
<https://kernel.org/pub/software/scm/git/docs/git-send-email.html#_example>`_
and this `git send-email howto
<http://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/>`_.)
Coding style
------------
* Please keep the code consistent by adhering to the prevailing naming and
formatting conventions. We generally respect the `"Style Guide for Python
Code" <http://www.python.org/dev/peps/pep-0008/>`_. For docstrings, we
follow `NumPy's "Docstring Standard"
<http://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_ and
`Python's "Docstring Conventions"
<http://www.python.org/dev/peps/pep-0257/>`_.
* Write tests for all the important functionality you add. Be sure not to
break existing tests.
* Create a logical sequence of commits with clear commit messages. Each
commit message consists of a summary line, and, whenever necessary, a
more detailed explanation. Both parts are separated by a blank line
and wrapped to 72 characters (unless quoting error messages and such).
The summary line should be as clear as possible. The detailed
explanation should be included whenever it helps to motivate or
understand the commit. Bear in mind that the merge request text and
discussions are not part of a commit.
Documentation
=============
Tutorial and reference manual
-----------------------------
.. class:: docs-list, button-links
* **Online**:
+ `stable version </doc/1/>`_
+ `development version </doc/dev/>`_
* **Downloads**:
+ `PDF <http://downloads.kwant-project.org/doc/latest.pdf>`_
+ `zipped HTML <http://downloads.kwant-project.org/doc/latest.zip>`_
Interactive online course
-------------------------
The APS March meeting 2016 tutorial “Introduction to Computational Quantum Nanoelectronics” focuses on the physics, but also serves as a crash course on Kwant. `All the materials are available online </mm16.html>`_ and can be run directly in a web browser, without installing Kwant locally.
Screencast
----------
.. raw:: html
A brief video introduction of Kwant:
<ul class="button-links inline-list">
<li> <a href="kwant-screencast-2014.html">watch</a> </li>
<li> <a href="http://downloads.kwant-project.org/doc/kwant-screencast-2014.mp4" download>download</a> </li>
</ul>
Article
-------
This paper (`download PDF <http://downloads.kwant-project.org/doc/kwant-paper.pdf>`__) introduces Kwant in a systematic way and discusses its design and performance (`New J. Phys. 16, 063065 (2014) <http://iopscience.iop.org/1367-2630/16/6/063065/article>`_).
Kwant documentation
===================
Kwant is accompanied by extensive documentation that contains a hands-on
tutorial and a complete reference. In addition, a scientific article exists
that introduces Kwant in a more structured way and discusses its design and
performance.
Kwant documentation (including tutorial):
* `browse online </doc/1.0>`_
* `download PDF <http://downloads.kwant-project.org/doc/kwant-doc-1.0.0.pdf>`_
* `download zipped HTML
<http://downloads.kwant-project.org/doc/kwant-doc-1.0.0.zip>`_ (for reading
without web access)
Kwant paper:
* `download PDF <http://downloads.kwant-project.org/doc/kwant-paper.pdf>`__
================
Kwant extensions
================
Going beyond the core package, there are several tools that extend Kwant in useful ways.
You can check these out below.
If you have some re-usable code that you think would be useful to the wider Kwant community,
post to the `Kwant development mailing list <mailto:kwant-discuss@kwant-project.org>`_ with a
link to the code and a couple of sentences describing it, and we'll add it to this page.
Semicon: k·p simulations made easy
----------------------------------
**Get the code**: https://gitlab.kwant-project.org/semicon/semicon
A package of tools for doing k·p simulations. Contains: model definitions, material parameters,
and helper functions for generating template Kwant systems.
Generating quasicrystals
------------------------
**Get the code**: https://arxiv.org/src/1510.06035v2/anc/quasicrystal.py
Code for reproducing numerics from the paper "`Aperiodic Weak Topological Superconductors <https://arxiv.org/abs/1510.06035>`_"
by Fulga et al.
Contains functionality for building 2D Ammann-Beenker tilings, an example of a quasicrystal, and
Kwant systems constructed from such tilings.
Time-dependent transport
------------------------
**Get the code**: https://gitlab.kwant-project.org/kwant/tkwant
A package for defining time-dependent systems with Kwant, and calculating
time-dependent quantities. Details of the algorithm can be found in the
following two papers:
+ `Towards realistic time-resolved simulations of quantum devices <https://dx.doi.org/10.1007/s10825-016-0855-9>`_
+ `Numerical simulations of time resolved quantum electronics <https://dx.doi.org/10.1016/j.physrep.2013.09.001>`_
Qsymm: Symmetry finder and symmetric Hamiltonian generator
----------------------------------------------------------
**Get the code**: https://gitlab.kwant-project.org/qt/qsymm
A package that makes symmetry analysis simple. It automatically generates model Hamiltonians from symmetry constraints and finds the full symmetry group of your Hamiltonian. Works with tight-binging and k dot p Hamiltonians and supports all kinds of symmetries, including conserved quantities, space group symmetries, time reversal, particle-hole and all combinations of these.
+ `Qsymm: algorithmic symmetry finding and symmetric Hamiltonian generation <http://dx.doi.org/10.1088/1367-2630/aadf67>`_
......@@ -2,5 +2,5 @@ Trial pre-release of Kwant
==========================
With the release of Kwant the instructions that were here were rendered
obsolete. Please go to the `installation instructions </install>`_ for the
obsolete. Please go to the `installation instructions </install.html>`_ for the
latest Kwant release.
Quantum transport simulations made easy
=======================================
.. raw:: html
<div class="workflow-image">
<object type="image/svg+xml" data="kwant-workflow.svgz" class="img-responsive">kwant-workflow.svgz</object>
</div>
Kwant is a `free (open source) <https://gitlab.kwant-project.org/kwant/kwant>`_,
powerful, and easy to use Python package for numerical calculations on tight-binding
models with a strong focus on quantum transport.
.. raw:: html
<div id="recent-posts" class="section col-sm-6">
<h2> Recent blog posts </h2>
.. post-list::
:stop: 4
.. raw:: html
</div>
.. raw:: html
<div id="kwant-uses" class="section col-sm-5">
<h2> Use Kwant to... </h2>
<ul id="kwant-uses-list">
<li>
<a href="/about#quantum-hall-effect"> Compute differential conductance </a>
</li>
<li>
<a href="/about#graphene-flake"> Visualize edge states </a>
</li>
<li>
<a href="/about#numerical-experiment-flying-qubit"> Conduct numerical experiments </a>
</li>
<li>
<a href="/doc/1/tutorial/spectrum#band-structure-calculations"> Explore band structure </a>
</li>
<li>
<a href="https://tkwant.kwant-project.org/"> Simulate time-dependent problems </a>
</li>
</div>
================================
Installing Kwant
================================
License and citation request
============================
Kwant is free software covered by the `2-clause BSD license </license>`_.
If you have used Kwant for work that has lead to a scientific publication,
please `cite the Kwant paper and possibly other relevant publications
</cite>`_.
Prerequisites
=============
In order to use Kwant you will need to install a distribution of the Python
language. If you are using a GNU/Linux operating system this should already be
installed on your computer.
If you are using Mac OS X or Microsoft Windows you will need to install a
Python distribution yourself. Details of how to do this are in the
installation instructions of the corresponding platform.
**Kwant version 1.2 and newer requires at least Python 3.4**.
Those who must use Python 2 can still use Kwant up to version 1.1,
which will receive bug fixes for several years
after 2015 (but no new features).
The instructions below assume Python 3. They should be also valid for Python
2 if all occurrences of ``python3``, ``pip3``, etc. are replaced by
``python``, ``pip``.
Platforms
=========
Installation instructions are available for the major operating systems:
+ `GNU/Linux`_
+ `Mac OS X`_
+ `Microsoft Windows`_
+ `Building from source`_
GNU/Linux
=========
Pre-built packages exist for the following distributions:
+ `Debian <#debian-and-derivatives>`_
+ `Ubuntu <#ubuntu-and-derivatives>`_
+ `Arch Linux`_
We also provide `Conda packages <#conda>`_ for users of the `Anaconda
<https://www.continuum.io/downloads>`_ Python distribution. This is a useful
option if you do not have root privileges on the machine where you would like
to install Kwant (e.g. on a computing cluster).
If your distribution is not listed above, and you do not want to use the
Conda packages, you can always install Kwant using `pip`_. Or by directly
building `from source <#building-from-source>`_.
Debian and derivatives
----------------------
The easiest way to install Kwant on a Debian system is using the pre-built
packages we provide. We target Debian "stable", but our packages may also work
on many other recent Debian-derived distributions as well.
The following instructions will install Kwant on Debian stable "buster".
They need to be executed as root.
1. Add the following lines to ``/etc/apt/sources.list``::
deb http://ftp.debian.org/debian buster main
deb http://downloads.kwant-project.org/debian/ buster main
deb-src http://downloads.kwant-project.org/debian/ buster main
2. (Optional) Add the OpenPGP key used to sign the repositories by executing::
apt-key adv --keyserver keyserver.ubuntu.com --recv-key C3F147F5980F3535
The fingerprint of the key is 5229 9057 FAD7 9965 3C4F 088A C3F1 47F5 980F
3535.
3. Update the package data, and install Kwant::
apt-get update
apt-get install python3-kwant
Ubuntu and derivatives
----------------------
The easiest way to install Kwant on an Ubuntu system is using the pre-built
packages we provide. Execute the following commands in a terminal::
sudo apt-add-repository -s ppa:kwant-project/ppa
sudo apt-get update
sudo apt-get install python3-kwant
This should provide up-to-date Kwant for all recent versions of Ubuntu,
up to at least the last LTS version.
Debian or Ubuntu: building packages from source
-----------------------------------------------
It is straightforward to build Debian/Ubuntu packages from source. This can be
useful when the installation from pre-built packages has failed for some
reason (e.g. for non-x86 CPUs).
As a prerequisite, a ``deb-src`` entry for Kwant is needed in
``/etc/apt/sources.list``. (It will be present if either of the above
instructions for Debian or for Ubuntu have been followed.)
FIrst, install the build dependencies (as root)::
apt-get build-dep tinyarray kwant
Then, compile Tinyarray and Kwant. This may be done as a normal user. ::
cd /tmp
apt-get source --compile tinyarray
apt-get source --compile kwant
Finally, install the built packages (again as root)::
dpkg --install python3-tinyarray_*.deb
dpkg --install python3-kwant_*.deb
Arch Linux
----------
`Arch install scripts for Kwant
<https://aur.archlinux.org/packages/python-kwant/>`_ are kindly provided by
Jörg Behrmann (formerly by Max Schlemmer). To install, follow the `Arch User
Repository installation instructions
<https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages>`_.
Note that for checking the validity of the package you need to add the key
used for signing to your user's keyring via::
gpg --keyserver pool.sks-keyservers.net --recv-key C3F147F5980F3535
The fingerprint of the key is 5229 9057 FAD7 9965 3C4F 088A C3F1 47F5 980F
3535.
Mac OS X
========
`Pre-built packages <#conda>`_ for Max OS X exist for the Conda package
manager, which is a part of the ``Anaconda`` Python distribution.
Using Conda is the recommended way to install Kwant on Mac OS X.
If you do not want to use the Conda packages, you can always install Kwant
using `pip`_. Or by directly `building from source`_.
We previously maintained Homebrew and Macports packages for Kwant, but due to
effort required to keep them up to date we have dropped support for these
installation methods. We recommend that people use the Conda packages
whenever possible.
Microsoft Windows
=================
`Pre-built packages <#conda>`_ for Microsoft Windows exist for the Conda
package manager, which is a part of the ``Anaconda`` Python distribution.
Using Conda is the recommended way to install Kwant on Microsoft Windows.
We previously recommended using that Kwant packages built by
Christoph Gohlke, however due to the complexity of the installation
instructions the Conda packages are preferred. Installation of the
package provided by Christoph Gohlke is only needed if the integration
with MUMPS is required (as this is still not available for the Conda packages).
The instructions for installing the alternative package are included below
Alternative Package
-------------------
The following instructions explain how to install the official version
of Python 3, Kwant, and its dependencies.
1. Determine whether you have a 32-bit or 64-bit Windows installation by
following these `instructions <http://support.microsoft.com/kb/827218>`_.
2. Download and install Python 3 for the appropriate architecture (32-bit: “x86” or
64-bit: “x86-64”) from the official `Python download site for Windows
<http://www.python.org/download/windows>`_. The current stable version
at the time of writing is Python 3.6.
3. Open a command prompt, as described in "How do I get a command prompt" at
the `Microsoft Windows website <http://windows.microsoft.com/en-us/windows/command-prompt-faq>`_.
4. In the command prompt window, execute::
C:\Python36\python.exe C:\Python36\Tools\Scripts\win_add2path.py
(Instead of typing this command, you can also just copy it from here and
paste it into the command prompt window). If you did not use the default
location to install Python in step 2, then replace ``C:\Python36`` by the
actual location where Python is installed. You may also need to adjust the
version (“36” signifies Python 3.6).
5. Reboot your computer.
6. Download the necessary packages (with the ending ``.whl``) for your
operating system (32 or 64 bit) and Python version (e.g. ``cp35`` for
Python 3.5) from the website of `Christoph Gohlke
<http://www.lfd.uci.edu/~gohlke/pythonlibs/>`_. For Kwant, we recommend to
download at least `NumPy
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy>`_, `SciPy
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy>`_, `Matplotlib
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib>`_, `Sympy
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#sympy>`_, `MPMath
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#mpmath>`_, `Pytest
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#pytest>`_, `Six
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#six>`_, `Tinyarray
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#tinyarray>`_, and `Kwant
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#kwant>`_ itself. Make sure to
put the downloaded files into a directory without any other ``.whl`` files.
7. Open a command prompt with administrator rights, as described in “How do I
run a command with elevated permissions” at the `Microsoft Windows website
<http://windows.microsoft.com/en-us/windows/command-prompt-faq>`_.
Go to the directory with the ``.whl`` files, e.g.::
cd c:\Users\YOUR_USERNAME\Downloads
To install all the ``.whl``-files in the current directory, execute ::
python -c "import pip, glob; pip.main(['install', '--no-deps'] + glob.glob('*.whl'))"
The above cryptic command is equivalent to ``pip install --no-deps
*.whl``, i.e. it installs all the wheel files in the current directory
using pip. Because the Windows command interpreter does not support globs,
we have to rely on the globbing as provided by Python itself.
Now you are done, you can ``import kwant`` from within Python scripts.
(Note that many other useful scientific packages are available in Gohlke’s
repository. For example, you might want to install `IPython
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#ipython>`_ and its various
dependencies so that you can use the `IPython notebook <http://ipython.org/notebook.html>`_.)
If you do not want to use the Conda packages, you can always install Kwant
using `pip`_. Or by directly `building from source`_.
Conda
=====
Conda is the package manager for the Anaconda Python distribution.
Kwant currently has Conda packages for GNU/Linux, Mac OS X, and Microsoft Windows.
1. Download the Python 3.6 version of `Anaconda <https://www.continuum.io/downloads>`_ for
your platform and install it.
2. Execute the following command in a terminal::
conda install -c conda-forge kwant
The above command installs Kwant and all of its dependencies from the
``conda-forge`` channel.
``pip``
=======
.. caution::
Installing Kwant with ``pip`` is not easy because Kwant has several
non-Python dependencies and requires a C compiler. These instructions
are provided for advanced users only.
``pip`` is the standard Python package manager that downloads and installs
packages from the `Python package index <https://pypi.python.org/>`_.
1. Install the non-Python dependencies of Kwant: a C compiler, BLAS, Lapack,
and (optionally) MUMPS (see `Installing non-Python dependencies`_).
2. Execute the following command in a terminal::
sudo pip3 install kwant
The above command installs Kwant and all of its Python dependencies from the
Python package index.
The latest development build of Kwant can be installed directly from Kwant's
Git repository::
sudo pip3 install git+https://gitlab.kwant-project.org/kwant/kwant.git
Each of the above commands will perform a system-wide install (to
``/usr/local`` on Unix). Type ``pip3 help install`` for installation options
and see `pip documentation <https://pip.readthedocs.org/>`_ for a detailed
description of ``pip``.
Installing non-Python dependencies
----------------------------------
As mentioned above, ``pip`` will not install any non-Python dependencies
required by Kwant. Kwant has several non-Python dependencies:
+ a C compiler (e.g. ``gcc``)
+ BLAS
+ Lapack
+ `MUMPS <http://graal.ens-lyon.fr/MUMPS/>`_.
If you using a GNU/Linux system then your distribution probably has packages
for these libraries; you will need to install the `-dev` or `-devel` versions
of the packages.
As an example, on a Debian or Ubuntu system, the following
command will install the non-Python dependencies of Kwant::
sudo apt-get install build-essential gfortran libopenblas-dev liblapack-dev libmumps-scotch-dev
On Debian or Ubuntu systems the Kwant build scripts should find libraries that
have been installed in the above way automatically. This will be signaled at
the end of the build process as follows::
******************************** Build summary ********************************
Default LAPACK and BLAS
Auto-configured MUMPS
*******************************************************************************
On other platforms it is possible that MUMPS is not linked against Kwant during
installation. If this is the case the build process must be `configured
manually <doc/1/pre/install.html#build-configuration>`_ by writing a
``build.conf`` file. You can then tell ``pip`` to use this ``build.conf`` when
installing kwant::
sudo pip install --global-option="--configfile=/path/to/build.conf" kwant
Building from source
====================
If no packages are available for the system you use, or if you would like to
build Kwant from source for another reason (expert users may want to customize
Kwant to use certain optimized versions of libraries), you can `download
the source code <https://downloads.kwant-project.org/kwant>`_ and consult the
documentation on `how to install Kwant from source <doc/1/pre/install.html>`_.
================================
Downloading and installing Kwant
================================
The quickest and easiest way to install Kwant is using the prepared packages
that are available for `Windows`_, GNU/Linux (`Debian
<#debian-and-derivatives>`_ or `Ubuntu <#ubuntu-and-derivatives>`_, and their
variants), and `Mac OS X`_. It is possible to be notified about new releases
of Kwant through an `announcement mailing list
<community.html#announcements-of-new-releases>`_.
If no packages are available for the system you use, or if you would like to
build Kwant from source for another reason (expert users may want to customize
Kwant to use certain optimized versions of libraries), please consult the `full
installation instructions
<doc/1.0/pre/install.html#building-and-installing-from-source>`_ in the
documentation.
The source code of released versions of Kwant is available for `download
<http://downloads.kwant-project.org/kwant/>`_. You can follow the development
by cloning the `Git repository of Kwant <http://git.kwant-project.org/kwant>`_
(browsable online).
Windows
=======
There are multiple distributions of scientific Python software for Windows that
provide the prerequisites for Kwant. We recommend to use the packages kindly
provided by Christoph Gohlke. To install Kwant on Windows
1. Determine whether you have a 32-bit or 64-bit Windows installation by
following these `instructions <http://support.microsoft.com/kb/827218>`_.
2. Download and install Python 2.7 for the appropriate architecture (32-bit or
64-bit) from the official `Python download site
<http://www.python.org/download/>`_.
3. Download and install ``scipy-stack``, ``tinyarray``, and ``kwant`` for Python
2.7 from `Christoph Gohlke's page
<http://www.lfd.uci.edu/~gohlke/pythonlibs/>`_. Once again you should choose
the architecture that is appropriate for your system. ("win32" means 32-bit,
"amd64" means 64-bit -- even if you have a processor from Intel.) If the
download from Gohlke's site is slow, try to download from `our mirror
<http://downloads.kwant-project.org/gohlke-mirror/>`_.
You may see a warning that says "The publisher could not be verified. Do you
want to run this software?". Select "Run".
Ubuntu and derivatives
======================
Execute the following commands::
sudo apt-add-repository ppa:kwant-project/ppa
sudo apt-get update
sudo apt-get install python-kwant python-kwant-doc
This should provide Kwant for all versions of Ubuntu >= 12.04. The HTML
documentation will be installed locally in the directory
``/usr/share/doc/python-kwant-doc``.
Debian and derivatives
======================
The easiest way to install Kwant on a Debian system is using the pre-built
packages we provide. Our packages are known to work with Debian "wheezy" and
Debian "jessie", but they may also work on many other recent Debian-derived
systems as well. (For example, the following works with recent Ubuntu versions.)
The lines prefixed with ``sudo`` have to be run as root.
1. Add the following lines to ``/etc/apt/sources.list``::
deb http://downloads.kwant-project.org/debian/ stable main
deb-src http://downloads.kwant-project.org/debian/ stable main
2. (Optional) Add the OpenPGP key used to sign the repositories by executing::
sudo apt-key adv --keyserver pgp.mit.edu --recv-key C3F147F5980F3535
3. Update the package data, and install Kwant::
sudo apt-get update
sudo apt-get install python-kwant python-kwant-doc
The ``python-kwant-doc`` package is optional and installs the HTML
documentation of Kwant in the directory ``/usr/share/doc/python-kwant-doc``.
Should the last command (``apt-get install``) fail due to unresolved
dependencies, you can try to build and install your own packages, which is
surprisingly easy::
cd /tmp
sudo apt-get build-dep tinyarray
apt-get source --compile tinyarray
sudo dpkg -i python-tinyarray_*.deb
sudo apt-get build-dep kwant
apt-get source --compile kwant
sudo dpkg -i python-kwant_*.deb python-kwant-doc_*.deb
This method should work for virtually all Debian-derived systems, even on exotic
architectures.
Mac OS X
========
There is a number of different package managers to bring software
from the Unix/Linux world to Mac OS X. Since the community is quite
split, we provide Kwant and its dependencies both via the `MacPorts
<http://www.macports.org>`_ and `Homebrew <http://brew.sh>`_ systems.
If you are unsure, go for MacPorts, this is the simpler option.
Mac OS X: MacPorts
==================
MacPorts is a full-fledged package manager that recreates a whole Linux-like
environment on your Mac. Beside Kwant, MacPorts gives you access to a wealth of free software which you can install on your computer
easily (using simple command line instructions). It requires few choices to be made by the user,
and provides the simplest way to install Kwant.
In order to install Kwant,
1. Install a recent version of MacPorts. In order to do that, you first have to install
the prerequisites described below. When this is done, you can proceed with the installation of
MacPorts itself, as explained in the `installation instructions of MacPorts
<http://www.macports.org/install.php>`_. The prerequisites are,
* the Xcode developer tools (compiler suite for Mac OS X) from
`<http://developer.apple.com/downloads>`_. You will need an Apple ID to
download. Note that if you have one already from using the App store
on the Mac/Ipad/Iphone/... you can use that one. You will also need the
command line tools: Within Xcode 4, you have to download them by going to
`Xcode->Preferences`, click on `Download`, go to `Components`,
select `Command Line Tools` and click on `Install`. Alternatively, you can
also directly download the command line tools from the
Apple developer website.
* if you have Mac OS X 10.8 or higher, the X11 server from the
`XQuartz project <http://xquartz.macosforge.org>`_.
2. After the installation, open a terminal and execute ::
echo http://downloads.kwant-project.org/macports/ports.tar |\
sudo tee -a /opt/local/etc/macports/sources.conf >/dev/null
(this adds the Kwant MacPorts download link
`<http://downloads.kwant-project.org/macports/ports.tar>`_ at the end of the
``sources.conf`` file.)
3. Execute ::
sudo port selfupdate
4. Now, install Kwant and its prerequisites ::
sudo port install py27-kwant
5. Finally, we choose Python 2.7 to be the default Python ::
sudo port select --set python python27
After that, you will need to close and reopen the terminal to
have all changes in effect.
Notes:
* If you have problems because your institution's firewall blocks MacPorts (more
precisely, the `rsync` port), resulting in errors from ``sudo port
selfupdate``, follow `these instructions
<https://trac.macports.org/wiki/howto/PortTreeTarball>`_.
* Of course, if you already have MacPorts installed, you can skip step 1
and continue with step 2.
Mac OS X: Homebrew
==================
Homebrew is a recent addition to the package managers on Mac OS X. It is
more lightweight, tries to be as minimalistic as possible and give the user
more freedom. Because of that, it requires a little more experience on
the user side compared to MacPorts. The requirements are moderate though,
if you know how to add directories to the ``$PATH`` variable for your shell,
you are safe.
1. Open a terminal and install Homebrew as described on the `Homebrew
homepage <http://brew.sh>`_ (instructions are towards the end of
the page)
2. Run ::
brew doctor
and follow its directions. It will ask for a few prerequisites to be
installed, in particular
* the Xcode developer tools (compiler suite for Mac OS X) from
`<http://developer.apple.com/downloads>`_. You will need an Apple ID to
download. Note that if you have one already from using the App store on the
Mac/Ipad/Iphone/... you can use that one. Downloading the command line
tools (not the full Xcode suite) is sufficient. If you have the full Xcode
suite installed, you might need to download the command line tools manually
if you have version 4 or higher. In this case go to `Xcode->Preferences`,
click on `Download`, go to `Components`, select `Command Line Tools` and
click on `Install`.
* although `brew doctor` might not complain about it right away, while we're
at it, you should also install the X11 server from the `XQuartz project
<http://xquartz.macosforge.org>`_ if you have Mac OS X 10.8 or higher.
3. Add permanently ``/usr/local/bin`` before ``/usr/bin/`` in the ``$PATH$``
environment variable of your shell, for example by adding ::
export PATH=/usr/local/bin:$PATH
at the end of your ``.bash_profile`` or ``.profile``. Then close
the terminal Terminal and reopen it again.
4. Install a few prerequisites ::
brew install gfortran python
5. Add additional repositories ::
brew tap homebrew/science
brew tap samueljohn/python
brew tap michaelwimmer/kwant
6. Install Kwant and its prerequisites ::
pip install nose
brew install numpy scipy matplotlib
brew install kwant
Notes:
- If something does not work as expected, use ``brew doctor`` for
instructions (it will find conflicts and things like that).
- As mentioned, Homebrew allows for quite some freedom. In particular,
if you are an expert, you don't need necessarily to install
numpy/scipy/matplotlib from Homebrew, but can use your own installation.
The only prerequisite is that they are importable from Python. (the
Kwant installation will in any case complain if they are not)
- In principle, you need not install the Homebrew Python, but could use
Apple's already installed Python. Homebrew's Python is more up-to-date,
though.