Molecular dynamics analysis in MDAnalysis

Any opportunity to use rigorously tested and supported analysis tools rather than in-house code is, in my opinion, an opportunity you owe it to yourself to explore.

My preferred tool for analyzing the output of molecular dynamics (MD) simulations is MDAnalysis, a Python library that provides robust and easy-to-use tools for analyzing most common files output by MD packages (including PDB, DCD, COR, and XTC file formats). But, of course, MDAnalysis can analyze any PDB file, not just one output from an MD simulations. There may be an opportunity in your workflow to incorporate MDAnalysis to save time or to provide more robust error handling than whatever in-house code you currently use.

The fundamental object in MDAnalysis is the Universe. You can create one from a file or files if you have both coordinate and topology information (i.e., you know where each atom is and how all of the atoms in the system are connected to one another).  Your Universe object will contain all information about coordinates and atom types available in your input files. You can see an example in the MDAnalysis documentation here: https://www.mdanalysis.org/pages/basic_example/

One very useful aspect of MDAnalysis is its ability to create Universe objects from a topology file and a DCD file and then iterate over the DCD file. For those who have not had the pleasure, DCDs are binary files that contain many sequential snapshots of the system coordinates at different times from the simulation. MDAnalysis allows you to iterate over these snapshots to, for example, access the coordinates in each snapshot sequentially to compute a time series of fraction of native contacts. You can see how to do this in practice here: https://www.mdanalysis.org/MDAnalysisTutorial/trajectories.html

In summary, MDAnalysis provides many quality of life improvements that have made it a standard part of my analysis pipelines. Take a look through the documentation and see if there may be something MDAnalysis can do for you. 

Author