A Julia package for reading molecular dynamics simulation trajectories.
Author tom--lee
2 Stars
Updated Last
3 Years Ago
Started In
August 2018


Build Status Coverage Status

A Julia package for reading and writing molecular dynamics simulation trajectories.

Currently supports iteration over a series of GROMACS-format .gro files and writing of a single trajectory frame as a .gro file.

GROMACS-format .xtc files will be supported in a future release.


julia> using MolecularTrajectories

julia> using StaticArrays

julia> const Vec = SVector{3, Float64}

julia> gro_path = joinpath(dirname(pathof(MolecularTrajectories)), "../test/test.gro")

julia> gro_paths = [gro_path, gro_path]

julia> trajectory = GroTrajectory{Vec}(gro_paths, dt=1.0)

julia> for frame in trajectory
    @show frame.time
    @show frame.positions[1:10]
    @show frame.velocities[1:10]

julia> using MolecularTopologies

julia> topology = open(gro_topology, gro_path)

julia> frame = first(GroTrajectory{Vec}(gro_paths, dt=1.0))

julia> open("output.gro", "w") do g
    write_frame(g, GroTrajectory, frame, topology, "Some gro file")

Note that trajectory objects are iterable but not indexable; they do not support the AbstractArray interface.

Used By Packages

No packages found.