Guideline for developers that are part of the TEMPO collaboration.
Contents:
- Purpose of the TimeEvolvingMPO package
- General development organisation
- Installation of the public and private repositories
- How the branches are organised
- Maintaining the quality of the package
- General design: API & backend
- How to contribute
- appendix A: Contact information and project roles
- appendix B: Links and bibliography
The purpose of the TimeEvolvingMPO package is to make TEMPO related algorithms publicly accessible and easy to use. It aims at theoretical and experimental physicists that have little or no knowledge on the technical details of TEMPO. It is also designed to be easily extendable with current and future TEMPO related algorithms. It achieves this by distinguishing between physical information and algorithm specific information. The objects that represent the physical information can then be processed by different TEMPO related algorithms, thus also allowing for a playground to compare the performance of the algorithms for specific physical problems.
The package is set up as an open source project (Apache license 2.0) at https://github.com/tempoCollaboration/TimeEvolvingMPO, and as such hopes to attract contributors outside the tempo collaboration. In addition to this there is a non-public copy of this repository at https://bitbucket.org/jkeeling/tempoincubator, which has at least one additional development
branch. This repository can only be accessed by people that are part of the tempo collaboration (see appendix A) and serves as an incubator for new features that are not yet public. Once a new feature is ready for publication (possibly with an accompanying preprint on arXiv.org) the feature can be merged into the public master
branch.
The installation of the public repository should be as easy as possible. This is currently the installation via PyPI with:
$ python3 -m pip install time_evolving_mpo
For the installation of the private repository you will first need to get access to it by contacting a current administrator of the project (see appendix A) and attaching your email address of the bitbucket account you wish to use.
For generating the documentation of the private repository or to set up the general development environment you will need python==3.6
, pip
, git
and tox
installed.
There exists a video tutorial on how to get set up to use the public and private repositories. Email a current project administrator (see appendix A) to grant you access to this video.
The main branch of the public repository is the master
branch, i. e. all the public pull requests are merged into this branch. The master
branch on the private repository is periodically updated by the master
branch from the public repository and should therefore always contain identical commits. Next to the master
branch the private repository has a development
branch that contains the features that will soon be made public. In addition to this there can be several branches with names of the form dev-feature-name
that contain a new features that are not yet on the verge of being published. When a new feature is ready to be published the corresponding dev-feature-name
is merged into the development
branch, which then in turn is merged into the master branch. It is therefore important not to park code in the development branch that can't be published, as this would hinder other features to be published when they are ready.
The development
branch serves as a reference for all the feature branches, to make the interplay between them smooth and to avoid design conflicts as good as possible. This can be achieved by adding module, class, method and function headers with
raise NotImplementedError()
statements into the development
branch before creating a new feature branch and then filling it with actual code. This allows developers of other features to be aware of the structure of other features already before they are actually coded.
Making decisions on the development structure as well as the code structure is the primary responsibility of the maintainers of the project (see appendix A).
All contributors of this project should be well aware of the difference between making a python script publicly available and a proper open source python package. For this project we aim to
- Make the package easily accessible:
- make it available on PyPI
- offer Tutorials (idealy for all features)
- offer a documentation that gives a pedagogic overview of the most important functionality
- offer a detailed documentation of all functionality
- Have a well thought through code structure:
- a well defined API and backend
- carefully choose what objects contain what sort of information and methods.
- carefully choose about how large data (dynamics and process tensors) are stored
- carefully choose about how computation intense parts are organised (checkpointing etc.)
- Guarantee stabil code performance:
- using
pytest
and writing as many test cases as possible (aim at 100% coverage)
- using
- Meet coding style standards:
- using
pylint
to write code that is conform with PEP08.
- using
The contribution guidelines CONTRIBUTING.md
(for the public repository) / incubator-CONTRIBUTING.md
(for the private repository) and PULL_REQUEST_TEMPLATE.md
try to reflect these aims.
BBecause the TimeEvolvingMPO aims at being easily extendable with current and future TEMPO related algorithms it is necessary to carefully choose the design of the code. In the current approach is almost fully object oriented and there are essentially three layers:
- The physical layer
- The TEMPO algorithms layer
- The backend layer
The physical layer: consists of objects that describe physical quantities, like a system (with a specific Hamiltonian) or the spectral density of an environment. To give an example, all spectral density classes need to be a derived from BaseSD
, and therefore need to have a method to compute two-time correlations. A derived class that represents an ohmic spectral density OhmicSD
could then, for example, use analytical expressions (that are specific to the ohmic case) to compute two-time correlation functions. Another derived class that represents a Lorentzian spectral density would encode the position and the width of the Lorentzian.
The TEMPO algorithms layer: Gathers the information from the physical layer and feeds it (with particular simulation parameters) into the backend. It has the opportunity to make use of specific, extra information from the physical layer. To get back to the example of the spectral density: while the original version of TEMPO only needs to know the correlation function of an environment and therefore treats all derived classes of BaseSD
in the same way, a future version (or another feature) could treat the the case of a Lorentzian spectral density by performing a polaron transformation, rather then doing a full TEMPO computation.
The backend layer: Is the part of the code where the task has been reduced to a mathematically well defined computation, such as a specific tensornetwork or an integral. For each algorithm X there should exist a corresponding BaseXBackend that clearly defines the in and output of the backend for this algorithm. This allows to create more than one implementation of the computation intensive bits, which can then be easily chosen at runtime before starting the computation. This not only allows to compare the performance of different implementations, it also allows to write hardware specialised implementations (single CPU, cluster, GPU) while keeping the other two layers untouched.
The design of the API (application programming interface) is currently discussed in the issues section of the private repository: API design
There is a detailed description of how to contribute to the public repository in the file CONTRIBUTING.md
and a checklist for pull requests
PULL_REQUEST_TEMPLATE.md
.
The contribution guideline for the private repository is exactly the same, except that it takes place on bitbucket rather then on github.
Project administrators:
- Gerald E. Fux* (gf52@st-andrews.ac.uk)
- Jonathan Keeling (jmjk@st-andrews.ac.uk)
- Brendon W. Lovett (bwl4@st-andrews.ac.uk)
Project maintainers:
Members of the TEMPO collaboration (alphabetical)
- Kristín Arnardóttir (University of St Andrews) kristinbjorga@gmail.com
- Gerald E. Fux (University of St Andrews) gf52@st-andrews.ac.uk
- Erik Gauger (Heriot-Watt University) e.gauger@hw.ac.uk
- Jonathan Keeling (University of St Andrews) jmjk@st-andrews.ac.uk
- Peter Kirton (University of Strathclyde) peter.kirton@strath.ac.uk
- Thibaut Lacroix (University of St Andrews) tfml1@st-andrews.ac.uk
- Brendon W. Lovett (University of St Andrews) bwl4@st-andrews.ac.uk
* ... primary contact.
[Strathearn2018] Strathearn, A., Kirton, P., Kilda, D., Keeling, J. and Lovett, B.W., 2018. Efficient non-Markovian quantum dynamics using time-evolving matrix product operators. Nature communications, 9(1), 3322.