Skip to main content

Massively Parallel Trotter-Suzuki Solver

Project description

The module is a massively parallel implementation of the Trotter-Suzuki approximation to simulate the evolution of quantum systems classically. It relies on interfacing with C++ code with OpenMP for multicore execution.

Key features of the Python interface:

  • Fast execution by parallelization: OpenMP.

  • NumPy arrays are supported for efficient data exchange.

  • Multi-platform: Linux, OS X, and Windows are supported.

  • Arbitrary single-body initial state with closed and periodic boundary conditions.

  • Many-body simulations with non-interacting particles.

  • Gross-Pitaevskii equation.

  • Imaginary time evolution to calculate the ground state.

Usage

Documentation is available on Read the Docs. The following code block gives a simple example of initializing a state and calculating the expectation values of the Hamiltonian and kinetic operators and the norm of the state after the evolution.

from __future__ import print_function
import numpy as np
import trottersuzuki as ts

# lattice parameters
dim = 200
delta_x = 1.
delta_y = 1.
periods = [1, 1]

# Hamiltonian parameter
particle_mass = 1
external_potential = np.zeros((dim, dim))

# initial state
p_real = np.ones((dim, dim))
p_imag = np.zeros((dim, dim))
for y in range(0, dim):
    for x in range(0, dim):
        p_real[y, x] = np.sin(2*np.pi*x / dim) * np.sin(2*np.pi*y / dim)

# evolution parameters
delta_t = 0.001
iterations = 200

# launch evolution
ts.evolve(p_real, p_imag, particle_mass, external_potential, delta_x, delta_y,
          delta_t, iterations, periods=periods)

# expectation values
Energy = ts.calculate_total_energy(p_real, p_imag, particle_mass,
                                   external_potential, delta_x, delta_y)
print(Energy)

Kinetic_Energy = ts.calculate_kinetic_energy(p_real, p_imag, particle_mass,
                                             delta_x, delta_y)
print(Kinetic_Energy)

Norm2 = ts.calculate_norm2(p_real, p_imag, delta_x, delta_y)
print(Norm2)

Installation

The code is available on PyPI, hence it can be installed by

$ sudo pip install trottersuzuki

If you want the latest git version, follow the standard procedure for installing Python modules:

$ sudo python setup.py install

Build on Mac OS X

Before installing using pip, gcc should be installed first. As of OS X 10.9, gcc is just symlink to clang. To build trottersuzuki and this extension correctly, it is recommended to install gcc using something like:

$ brew install gcc48

and set environment using:

export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++
export CPP=/usr/local/bin/cpp
export LD=/usr/local/bin/gcc
alias c++=/usr/local/bin/c++
alias g++=/usr/local/bin/g++
alias gcc=/usr/local/bin/gcc
alias cpp=/usr/local/bin/cpp
alias ld=/usr/local/bin/gcc
alias cc=/usr/local/bin/gcc

Then you can issue

$ sudo pip install trottersuzuki

Citations

  1. Bederián, C. and Dente, A. Boosting quantum evolutions using Trotter-Suzuki algorithms on GPUs. Proceedings of HPCLatAm-11, 4th High-Performance Computing Symposium, 2011.

  2. Wittek, P. and Cucchietti, F.M. (2013). A Second-Order Distributed Trotter-Suzuki Solver with a Hybrid CPU-GPU Kernel. Computer Physics Communications, 184, pp. 1165-1171. PDF

  3. Wittek, P. and Calderaro, L. (2015). Extended computational kernels in a massively parallel implementation of the Trotter-Suzuki approximation. Computer Physics Communications, 197, pp. 339-340.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trottersuzuki-1.4.0.tar.gz (422.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page