Version 1
02 May 2021We are happy to release version 1 of MDAnalysis!
MDAnalysis 1.x is a stable legacy platform that supports
- Python 2.7 (on Linux and MacOS only),
- Python 3.5, 3.6, 3.7 and 3.8 (on Windows (32- and 64-bit), MacOS, and Linux).
The API will not change for any upcoming 1.x versions. This release completes the first phase of our roadmap. From here on, we will focus on developing version 2 of MDAnalysis, which will support Python 3.6+ only, and will include major API changes and improvements.
The 1.0.0, 1.0.1 and 1.1.1 versions of MDAnalysis are the product of more than 18 months effort. They contain a multitude of fixes, deprecations, and new features. We highlight important changes below, but users are strongly encouraged to read the CHANGELOG for full details. All users are recommended to upgrade to 1.1.1, as it includes important fixes.
Upgrading to MDAnalysis version 1.1.1
In Dependencies we list the required dependencies of MDAnaysis version 1; when installing with pip
or conda
, the correct dependencies should be automatically pulled in by the package manager:
To install with conda
from the conda-forge channel run
conda update -c conda-forge mdanalysis
(Note that for Python 2.7 and 3.5, no conda packages are currently available due to the difficulty of building packages for legacy Python versions. Please install with pip
.)
To install from PyPi with pip
run
pip install --upgrade MDAnalysis
(This will likely build the package from source so you need the appropriate compilers. )
For more help with installation see the Installation instructions in the User Guide.
Notable new additions
We now support several new formats:
We have also added converters to and from other popular analysis packages. We plan to expand in this exciting direction in future versions, as laid out in our interoperability roadmap. For now, we support:
New additions to analysis include:
-
frames
andtimes
attributes to AnalysisBase to capture the frames and times that the analysis wasrun()
on. This is accessible to all analyses that subclass AnalysisBase. - a correlations module for computing the discrete autocorrelation function
- a new HydrogenBondAnalysis class for improved and more efficient analysis of hydrogen bonds, which replaces the now deprecated hbond_analysis code
- an AverageStructure class for computing the average structure of a trajectory out of memory
- a hole2 module for improved interfacing with the HOLE2 program, which replaces the now deprecated hole module
- a DensityAnalysis class for improved density analysis, replacing the now deprecated density_from_Universe() code
- a method to compute the root-mean-square-inner-product of subspaces
- a method to calculate the cumulative overlap of a vector in a subspace
Other additions to core functionality include:
- wrap and unwrap on-the-fly transformations
- methods to add bonds, angles, dihedrals, and impropers to a Universe
- methods to delete bonds, angles, dihedrals, and impropers from a Universe
- the get_connections method to get bonds, angles, dihedrals and impropers in an AtomGroup, with the ability to specify whether all atoms involved are within the AtomGroup (
outside=False
), or whether at least one atom involved is within the AtomGroup (outside=True
)
Miscellaneous performance improvements include:
- Dihedral selection in the Ramachandran class has been sped up ~700x.
- TPR parsing has been sped up 2–30x.
Notable improvements
We have improved the flexibility to our atom selection language, allowing for advanced pattern matching operators.
For example, we now support ?
for single character matching, so using resname T?R
in a selection string for a protein would yield both residues THR
and TYR
. More information can be found in our selection documentation.
Notable changes to analysis include:
- The argument order to AnalysisFromFunction are now as specified in the documentation
- The
select
keyword has been standardized by removingselection
,atomselection
, andref_select
in thecontact
,gnm
,helanal
,hole
,encore
, andhydrogenbonds
modules - The
save()
functions have been removed fromcontacts
,diffusionmap
,hole
,lineardensity
, andrms
modules - Progress bars have been replaced with an improved version from tqdm
- The
radius_cut_q
method has been added to contacts.Contacts
Other notable improvements to the core functionality include:
- AtomGroup.guess_bonds now uses periodic boundary information when available
- The TPRParser now supports GROMACS 2020
- When reading PDB and XYZ files, MDAnalysis now adds an
elements
attribute if the provided elements are valid
Important fixes
For the full list of fixed please see the CHANGELOG. The following are selection of fixes that could have either lead to wrong results or were often reported by users as problematic:
Core
- Neighbor searching, which is a fundamental component of many analyses in MDAnalysis (such as hydrogenbonds and RDF calculation) had a number of bugs in 1.0.0 that could lead to wrong results, in particular with triclinic unit cells. The buggy code was disabled in 1.0.1 and fixed in 1.1.1. See issues #2229, #2345, #2919, #2670, #2930 for details.
- Fixed a SegmentationFault for the selection “around 0.0 SELECTION” (Issue #2656)
-
AtomGroup.center()
now works correctly for compounds and unwrapping (Issue #2984) - When bonds are guessed from distances (
AtomGroup.guess_bonds
), periodic boundary information is properly taken into account. Bonds that were split across the periodic boundary would have not beend correctly guessed previously. (Issue #2350) - The testsuite does not fail anymore with newer version of matplotlib (Issue #2191)
File formats
-
PDB files
- Better handling of cryo-electron microscopy box dimensions in PDB files:
- When a PDB file is read, a cryo-em 1 Å3 default CRYST1 record will be interpreted as “no dimensions” and the box dimension in MDAnalysis is set to
None
(Issue #2599) - When box dimensions are missing (
u.dimensions
isNone
ornp.zeros(6)
) then a unitaryCRYST1
record (cubic box with sides of 1 Å) is written (Issue #2679)
- When a PDB file is read, a cryo-em 1 Å3 default CRYST1 record will be interpreted as “no dimensions” and the box dimension in MDAnalysis is set to
- PDB files no longer lose chainIDs when reading files without segIDs (Issue #2389)
- PDBWriter now uses last character of segid as ChainID (Issue #2224)
- Better handling of cryo-electron microscopy box dimensions in PDB files:
- In GRO files, unit cells with box vectors larger than 1000 nm are now correctly handled (Issue #2371)
- Reading of XTC and TRR files will not anymore fail with an
IOError
when the hidden offset files cannot be read; instead, the offsets are recalculated from the trajectory (Issue #1893) - Masses and charges in HooMD XML files are now correctly read (#2888)
Analysis
- PCA analysis:
- Contact Analysis class respects PBC (Issue #2368)
Deprecations
This release brings several deprecations as the package heads towards version 2.0.0.
The following parts of the analysis code will be removed/changed in version 2.0.0:
- analysis.hole is deprecated in favor of analysis.hole2.
- analysis.hbonds.HydrogenBondsAnalysis is deprecated in favor of analysis.hydrogenbonds.hbond_analysis.
- analysis.density.density_from_Universe() is deprecated in favor of analysis.density.DensityAnalysis.
- The notwithin_coordinates_factory() and density_from_PDB() methods of analysis.density are deprecated.
- analysis.waterdynamics.HydrogenBondLifetimes is deprecated in favor of analysis.hydrogenbonds.hbond_analysis.HydrogenBondAnalysis.lifetime() (to be implemented in version 2.0.0)
- analysis.leaflets.LeafletFinder() will no longer accept a filename, in 2.0.0 only Universes will be supported as inputs.
- analysis.helanal is deprecated and will be replaced by analysis.helix_analysis in 2.0.0.
- analysis.hbonds.WaterBridgeAnalysis will be moved to analysis.hydrogenbonds.WaterBridgeAnalysis.
The following parts of the readers/writers will be removed/changed in version 2.0.0:
- Writer.write_next_timestep() is deprecated in favor of Writer.write().
- Passing Timestep objects to Writer.write() is deprecated. In 2.0.0 only Universe or AtomGroup objects will be accepted.
- The way in which the NCDFWriter handles scale factors will change in version 2.x (see Issue #2327 for more details).
- When writing PDB files, MDAnalysis will no longer be using the last letter of the SegID to set the chainID in version 2.0.0.
- The
bfactors
andtempfactors
attributes (set by the PDB and MMTF parsers respectively), will be aliased in version 2.0.0. - When parsing TPR files, resids will be indexed from 1 rather than the current default of 0.
The following part of the core and library components will be removed/changed in version 2.0.0:
- lib.log.echo() is deprecated in favor of the new lib.log.ProgressBar.
- core.universe.as_Universe() is deprecated.
Dependencies
We list below the core dependencies and versions that MDAnalysis has been tested on. They are provided as a string for easy use with conda or pip:
- Python 2.7: biopython==1.76 cython==0.29.15 griddataformats==0.5.0 gsd==1.7.0 matplotlib==2.2.5 mmtf-python==1.1.2 netcdf4==1.3.1 numpy==1.16.5 scipy==1.2.1 tqdm==4.60.0
- Python 3.5: biopython==1.72 cython==0.28.5 griddataformats==0.5.0 gsd==1.5.3 matplotlib==3.0.0 mmtf-python==1.1.2 netcdf4==1.3.1 numpy==1.15.2 scipy==1.1.0 tqdm==4.60.0
- Python 3.6: biopython==1.78 cython==0.29.23 griddataformats==0.5.0 gsd==2.1.2 matplotlib==3.3.2 mmtf-python==1.1.2 netcdf4==1.5.4 numpy==1.16.0 scipy==1.5.1 tqdm==4.60.0
- Python 3.7: biopython==1.78 cython==0.29.23 griddataformats==0.5.0 gsd==2.4.2 matplotlib==3.4.1 mmtf-python==1.1.2 netcdf4==1.5.6 numpy==1.20.2 scipy==1.6.3 tqdm==4.60.0
- Python 3.8: biopython==1.78 cython==0.29.23 griddataformats==0.5.0 gsd==2.4.2 matplotlib==3.4.1 mmtf-python==1.1.2 netcdf4==1.5.6 numpy==1.20.2 scipy==1.6.3 tqdm==4.60.0
Author statistics
Altogether this represents the work of 42 contributors from around the world, and featured the work of 25 new contributors:
- @bdice
- @joaomcteixeira
- @CCook96
- @Yuan-Yu
- @HTian1997
- @Iv-Hristov
- @hmacdope
- @AnshulAngaria
- @ss62171
- @Luthaf
- @yuxuanzhuang
- @abhishandy
- @mlnance
- @shfrz
- @wvandertoorn
- @cbouy
- @AmeyaHarmalkar
- @Oscuro-Phoenix
- @andrrizzi
- @WG150
- @Marcello-Sega
- @calcraven
- @ianmkenney
- @rcrehuet
- @hanatok
The MDAnalysis Project gratefully acknowledges a Small Development Grant provided by NumFOCUS.
— The MDAnalysis Team