Utilities (pele.utils)

Helper functions


Functions related to rotations

Most of these were adapted from victor’s rotations.f90. Not all functions from the file have been implemented. Warning, they have not all been tested in this format.

q_multiply(q0, q1) multiply 2 quaternions q1, q2
aa2q convert angle axis to quaternion
q2aa(qin) quaternion to angle axis
q2mx(qin) quaternion to rotation matrix
mx2q(mi) convert a rotation matrix to a quaternion
aa2mx convert an angle axis rotation to a rotation matrix
random_q() uniform random rotation in angle axis formulation
random_aa() return a uniformly distributed random angle axis vector
takestep_aa(p, maxtheta) change an angle axis vector by a small rotation
rotate_aa change a given angle axis rotation p1 by the rotation p2
small_random_aa(maxtheta) generate a small random rotation
vec_random() uniform random unit vector
vec_random_ndim(n) n-dimensional uniform random unit vector
vector_random_uniform_hypersphere(k) return a vector sampled uniformly in a hypersphere of dimension k
q_slerp(a, b, t)
pele.utils.vec3.invert3x3(A) return the inverse of a 3x3 matrix

benchmarking tool

pele.utils.benchmark.QuenchBenchmark(potential) classdocs

Coords Adapter

pele.utils.rbtools.CoordsAdapter([nrigid, ...]) Wrapper to access coordinate array for rigid body systems

Hessian eigenvalues and eigenvectors

Tools for manipulating the Hessian. In particular, for finding eigenvalues and eigenvectors

get_eig(hess, **kwargs) return the eigenvalue and eigenvectors of a Hessian (symmetric)
get_eigvals(hess, **kwargs) return the eigenvalues of a Hessian (symmetric)
get_sorted_eig(hess, **kwargs) return the sorted eigenvalues and eigenvectors of a Hessian sorted
get_smallest_eig(hess, **kwargs) return the smallest eigenvalue and associated eigenvector of a Hessian
make_sparse(hess, **kwargs) return a sparse form of the hessian using scipy.sparse


classes to build and maintain neighborlists .. currentmodule:: pele.utils.neighbor_list

MultiComponentSystem(potentials) a potential wrapper for multiple potentials
NeighborListSubsetBuild(natoms, rcut, Alist) The same as NeighborListSubset except only do the building.
NeighborListPotentialBuild(neighborList, pot) a potential wrapper for a neighbor list, but only rebuild when told to
NeighborListPotentialMulti(potentials, ...) A wrapper for multiple NeighborListPotentialBuild

tools for dealing with frozen atoms. Especially in relation to neighbor lists

FreezePot(pot, frozen, natoms) potential wrapper for frozen particles
makeBLJNeighborListPotFreeze(natoms, frozenlist) create the potential object for the kob andersen binary lennard jones with frozeen particles


Create and print histograms. Especially energy histograms.

EnergyHistogram(emin, emax[, nbins]) this class will build 1 dimensional histogram.
PrintHistogram(fname, hist, interval)

.xyz files

tools for reading from and writing to .xyz files

read_xyz(fin) read a xyz file from file handle
write_xyz(fout, coords[, title, atomtypes]) write a xyz file from file handle

Disconnectivity Graph

see disconnectivity graph

Wrapper / helper functions for external programs

pele.utils.pymolwrapper.draw_box(boxvec, model, frame)[source]

Draw a box around the system to easily visualise periodic boundaries

Parameters :

boxvec: np.array

The dimensions of the periodic box

pele.utils.pymolwrapper.draw_rigid(coords, model, frame, colour, bondslist=[], radius=0.5)[source]

Use pymol to draw a system of rigid body fragments

Parameters :

colour: 3-tuple

RBG colour for the spheres being drawn.

bondslist: list of 2-tuples, optional

List of atom pairs between which bonds should be drawn.

pele.utils.pymolwrapper.draw_spheres(coords, model, frame, radius=0.5)[source]
class pele.utils.amber.readAmberParam[source]

Extract info from coords.prmtop

string with the full coords.prmtop file
list of 2-ples such that bondConn[i][0] and bondConn[i][1] are the atom numbers of the i-th bond; atom numbers start at 1

TODO: deprecate – use OpenMM parser instead (11 Jan 13)