Release 0.14.0
28 Feb 2016We have just released MDAnalysis version 0.14.0. This release contains a large number of new features and bug fixes. The highlights are listed below but for more details see the release notes.
Upgrade
You can upgrade with pip install --upgrade MDAnalysis
Noticable Changes
Implicit OR in selections
Many long selection strings used in select_atoms have been simplified through allowing implicit OR in the arguments. For example to select all atoms with one of a few names previous required lots of ORs
# OLD
u.select_atoms('name Ca or name N or name Ch')
# NEW
u.select_atoms('name Ca N Ch')
The new syntax allows multiple arguments after the keyword name
.
The selection will keep eating arguments till it hits a keyword.
The use of wildcards is still possible too, making the selection
of all atoms with a type beginning with ‘C’ or ‘N’ as simple as:
u.select_atoms('type C* N*')
Similarly, for selecting ranges of resids
# OLD
u.select_atoms('resid 1:10 or resid 40:50 or resid 56 or resid 67')
# NEW
u.select_atoms('resid 1:10 40:50 56 67')
This new behaviour works for name, type, resname, segid, altLoc, resid, resnum and bynum selections! The old behaviour will still work, but we feel this should save a lot of typing!
Boolean indexing of trajectories
You can now treat trajectories like numpy arrays in a fully pythonic fashion: You could already do fancy indexing and now you can also do boolean indexing. One application is building simple re-usable trajectory filters with ease, e.g., in order to slice data.
# build a filter array for re-use: only frames where the centroids
# of groups A and B are closer than 3 A
idx = [np.linalg.norm(A.centroid() - B.centroid()) < 3.0 for ts in u.trajectory]
for ts in u.trajectory[idx]:
# analyze the frames where |A - B| distance < 3
for ts in u.trajectory[np.logical_not(idx)]:
# do analysis on the other frames, |A - B| >= 3
New analysis module to calculate linear densities
The
MDAnalysis.analysis.lineardensity
module contains the class LinearDensity
that simplifies calculation of mass
and charge densities profiles along the primary axes of a simulation cell.
Rewrite of TRR and XTC file handling
Our wrapper of the Gromacs library xdrlib has been completely rewritten in cython. This changes brings us one step closer towards supporting Python 3. The only user facing API change is that we don’t save persistent frame offsets with the pickle module anymore but with numpy’s ‘npz’ format. This improves reopening of xtc/trr files.
Experimental Python 3 Support
With this release it is possible to run MDAnalysis under Python 3. We have ported most of our coordinate readers, DCD is still missing, and topology readers to be python2/3 compatible. Most features should already work but expect there to be some minor glitches.
Others
This release contains other performance enhancements and fixes. For a detailed list see the release notes.