# What is the best molecular dynamics analysis library in Julia?

**URL:** https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865
**Category:** Modelling & Simulations
**Created:** [April 1, 2020, 6:23pm UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865 "2020-04-01T18:23:34Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dkonstan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkonstan/32/13004_2.png) [@dkonstan](https://discourse.julialang.org/u/dkonstan)
#### Post date: [April 1, 2020, 6:23pm UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865/1 "2020-04-01T18:23:34Z")

</div>

So far, I have only seen Chemfiles, which has Julia bindings but is missing important features like a powerful atom selection language. For example, Chemfiles cannot easily select the set of atoms X far away from another selection. It would be great to have that feature and more included and not to have to reimplement them in Julia. Libraries like MDAnalysis do this for Python. What is your favorite Julia tool? I know about PyCall but there is a significant performance penalty which is an issue for me. I want to switch some code to Julia, but this gap keeps me in Python land.

---

<div class="post-metadata">

### Author: ![jgreener64](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jgreener64/32/2483_2.png) [@jgreener64](https://discourse.julialang.org/u/jgreener64)
#### Post date: [April 1, 2020, 8:25pm UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865/2 "2020-04-01T20:25:00Z")

</div>

I may be biased, but I think the best right now is [BioStructures.jl](https://github.com/BioJulia/BioStructures.jl).

It has spatial calculations such as distances, angles, torsions, superimpositions, contact graphs and RMSD. It has an atom selection interface.

It can’t currently read trajectory and topology files of the MD variety, but if you use Chemfiles.jl to convert these to PDB it can read those in quickly. I would of course be interested to receive contributions in this area if you want to make the library more suitable for MD analysis.

Other tools you might find useful include:

- [MDToolbox.jl](https://github.com/matsunagalab/MDToolbox.jl) - a Julia toolbox for statistical analysis of molecular dynamics trajectories.
- [Molly.jl](https://github.com/jgreener64/Molly.jl) - proof-of-concept MD in Julia with some plotting/animation examples in the docs.
- [NBodySimulator.jl](https://github.com/SciML/NBodySimulator.jl) - a simulator for N-body problems, including astrophysical and molecular dynamics.
- [ProteinEnsembles.jl](https://github.com/jgreener64/ProteinEnsembles.jl) - has some ensemble analysis code, e.g. PCA.

- [Bio3DView.jl](https://github.com/jgreener64/Bio3DView.jl) - view molecular structures in Julia.

---

<div class="post-metadata">

### Author: ![dkonstan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkonstan/32/13004_2.png) [@dkonstan](https://discourse.julialang.org/u/dkonstan)
#### Post date: [April 2, 2020, 2:17pm UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865/3 "2020-04-02T14:17:31Z")

</div>

Thanks! One more question: do any of these libraries facilitate frame-by-frame reading of trajectory files, like MDAnalysis’s  
"  
for ts in universe.trajectory:  
# code, code, code  
"

This is required for processing trajectory size \> memory. Splitting up trajectories before a calculation is time-consuming and inconvenient. Can frame-by-frame reading be done easily in one of the above libraries?

---

<div class="post-metadata">

### Author: ![jgreener64](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jgreener64/32/2483_2.png) [@jgreener64](https://discourse.julialang.org/u/jgreener64)
#### Post date: [April 2, 2020, 3:49pm UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865/4 "2020-04-02T15:49:33Z")

</div>

If it was in one of them it would be in Chemfiles, see for instance [Chemfiles.jl/Trajectory.jl at master · chemfiles/Chemfiles.jl · GitHub](https://github.com/chemfiles/Chemfiles.jl/blob/master/src/Trajectory.jl#L35-L45).

---

<div class="post-metadata">

### Author: ![luthaf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luthaf/32/13923_2.png) [@luthaf](https://discourse.julialang.org/u/luthaf)
#### Post date: [April 7, 2020, 2:38pm UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865/5 "2020-04-07T14:38:12Z")

</div>

Hey, chemfiles author here. Happy to see my code is being considered for your use case!

> For example, Chemfiles cannot easily select the set of atoms X far away from another selection.

Not sure what you want to do, something like “I want all atoms at least 10A from any atom in `name O`”? This is something that we could add to chemfiles pretty easily if there is a demand for it =). Anyway, do not hesitate opening issues or coming to the gitter channel to discuss!

---

<div class="post-metadata">

### Author: ![dkonstan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkonstan/32/13004_2.png) [@dkonstan](https://discourse.julialang.org/u/dkonstan)
#### Post date: [April 7, 2020, 5:45pm UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865/6 "2020-04-07T17:45:45Z")

</div>

Yes, I meant something like what you said, something to select, for example, all residues named “HOH” within X angstroms of ANY residues of names Y Z etc. MDAnalysis has this and several similar options ([3. Selection commands — MDAnalysis 2.3.0 documentation](https://www.mdanalysis.org/docs/documentation_pages/selections.html)). It would be great if chemfiles could do this.

---

<div class="post-metadata">

### Author: ![luthaf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luthaf/32/13923_2.png) [@luthaf](https://discourse.julialang.org/u/luthaf)
#### Post date: [April 8, 2020, 8:18am UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865/7 "2020-04-08T08:18:55Z")

</div>

I agree this would be very nice to have. I’ve opened an [issue](https://github.com/chemfiles/chemfiles/issues/327) to track this 😃
