Table Of Contents

Previous topic

7.4. Compute observable timeseries from trajectories — MDAnalysis.core.Timeseries

Next topic

7.6. Homogeneous Transformation Matrices and Quaternions — MDAnalysis.core.transformations

This Page

7.5. Fast distance array computation — MDAnalysis.core.distances

Fast C-routines to calculate distance arrays from coordinate arrays.

7.5.1. Overview

MDAnalysis.core.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. If an orthorhombic box is supplied then a minimum image convention is used before calculating distances.

If a 2D numpy array of dtype numpy.float64 with the shape (len(ref), len(conf)) is provided in result then this preallocated array is filled. This can speed up calculations.

MDAnalysis.core.distances.self_distance_array(ref[, box[, result]])

Calculate all distances d_ij between atoms i and j in the reference coordinates ref for all N coordinates. Other options as in distance_array().

If a 1D numpy array of dtype numpy.float64 with N*(N-1)/2 elements is provided in result then this preallocated array is filled. This can speed up calculations.

MDAnalysis.core.distances.calc_bonds(atom1, atom2[, box[, result]])

Calculate all distances between a pair of atoms. atom1 and atom2 are both arrays of coordinates, where atom1[i] and atom2[i] represent a bond. The optional argument box applies minimum image convention if supplied.

If a 1D numpy array of dtype numpy.float64 with len(atom1) elements is provided in result then this preallocated array is filled. This can speed up calculations.

MDAnalysis.core.distances.calc_angles(atom1, atom2, atom3[, result])

Calculates the angle formed between three atoms, over a list of coordinates. All atom inputs are lists of coordinates of equal length, with atom2 representing the apex of the angle. Returns the angle in radians.

If a 1D numpy array of dtype numpy.float64 with len(atom1) elements is provided in result then this preallocated array is filled. This can speed up calculations.

MDAnalysis.core.distances.calc_torsions(atom1, atom2, atom3, atom4[, result])

Calculate the torsional angle formed by four atoms, over a list of coordinates. Returns the angle in radians.

If a 1D numpy array of dtype numpy.float64 with len(atom1) elements is provided in result then this preallocated array is filled. This can speed up calculations.

7.5.2. Functions