Skip to content

Python reference implementation of the Newton propagator for quantum dynamics

License

Notifications You must be signed in to change notification settings

qucontrol/newtonprop

Repository files navigation

The newtonprop Python package

Source code on Github newtonprop on the Python Package Index Travis Continuous Integration AppVeyor Continuous Integration Coveralls Documentation Status BSD License

Pure Python reference implementation of the Newton propagator for quantum dynamics.

The Newton propagator evaluates an expansion of the time evolution operator e^{-i \Op{H} dt} or e^{\Liouville dt} in Newton polynomials, using an implicitly restarted Arnoldi scheme. More generally, it can evaluate the application of any operator-valued function to a state.

Development of the newtonprop package happens on Github. You can read the full documentation at ReadTheDocs.

Warning

This is a reference implementation only. It aims to be easy to understand, so that that it can guide the implementation of the algorithm in a compiled language, and to provide a baseline against which to test such an implementation. Being written in pure Python, it runs several orders of magnitude slower than an implementation in a compiled language. Thus, it cannot compete e.g. with the ODE solvers provided by SciPy (which run at C speed), even though the Newton propagator is usually expected to be superior in runtime, memory usage, and precision.

Prerequisites

The newtonprop only depends on NumPy. You may consider the use of QuTiP for efficient data structures for quantum states, operators, and super-operators (see the Example). As an optional dependency, having Numba installed when you import newtonprop can considerably speed up the propagation, assuming the application of the Hamiltonian/Liouvillian is implemented efficiently. Even then, though, the implementation will not approach C speed.

Installation

To install the latest released version of newtonprop, run this command in your terminal:

$ pip install newtonprop

This is the preferred method to install newtonprop, as it will always install the most recent stable release.

If you don't have pip installed, the Python installation guide can guide you through the process.

To install the latest development version of newtonprop from Github:

$ pip install git+https://github.com/qucontrol/newtonprop.git@master#egg=newtonprop

Usage

The newtonprop package exposes its functionality through a single function, accessible either as newtonprop.newton or newtonprop.propagator.step:

>>> from newtonprop import newton

Especially for propagation under a time-dependent Hamiltonian or Liouvillian, it is recommended that you define a stateful propagator, see :mod:`newtonprop.interface`.