9.6. Parallel algorithms for MDAnalysis

The MDAnalysis.lib.parallel module contains implementations of standard functions that can make use of parallelization available on modern multi-core processors.

Warning

Using parallel code is under active development in MDAnalysis and it is possible that the parallel code has some bugs or incompatibilities or less features than the serial code.

9.6.1. Fast parallel distance array computation — MDAnalysis.lib.parallel.distances

Author:Jan Domański
Year:2012
Licence:GPL

A fast, parallel distance_array() function as a substitute for MDAnalysis.lib.distances.distance_array(); implemented with Cython Parallelism. For development notes see the comments for Issue 80.

Load the module with

import MDAnalysis.lib.parallel.distances
MDAnalysis.lib.parallel.distances.distance_array(ref, conf[, box[, result]])

Calculate all distances d_ij between the coordinates ref[i] and conf[j] in the numpy arrays ref and conf.

This is a parallelized version that will automatically decide on how many threads to run.

Periodic boundary conditions can be taken into account if the box vectors are provided in the 3x3 matrix box. The default None calculates simple distances.

A pre-allocated array can be supplied as results.

Warning

Only orthorhombic boxes are supported for box, anything else will produce wrong results.

New in version 0.7.7.

MDAnalysis.lib.parallel.distances.distance_array_serial(ref, conf[, box[, result]])

Calculate all distances d_ij between the coordinates ref[i] and conf[j] in the numpy arrays ref and conf.

Periodic boundary conditions can be taken into account if the box vectors are provided in the 3x3 matrix box. The default None calculates simple distances.

A pre-allocated array can be supplied as results.

Serial version (to check the parallel version). This version is slightly slower than the regular serial (pure C) MDAnalysis.lib.distances.distance_array() function.

Warning

Only orthorhombic boxes are supported for box, anything else will produce wrong results.

New in version 0.7.7.