Home

Awesome

<img src="https://github.com/JuliaMolSim/Molly.jl/blob/master/docs/src/images/logo_molly.png" alt="Molly logo" width="400">

Build status Coverage status Latest release License Documentation stable Documentation dev

Much of science can be explained by the movement and interaction of molecules. Molecular dynamics (MD) is a computational technique used to explore these phenomena, from noble gases to biological macromolecules. Molly.jl is a pure Julia package for MD, and for the simulation of physical systems more broadly.

The package is described in a talk at JuliaCon 2024 and an earlier talk at Enzyme Conference 2023. Slides are also available for a tutorial in September 2023.

Implemented features include:

Features not yet implemented include:

Installation

Julia is required, with Julia v1.10 or later required to get the latest version of Molly. It is recommended to run on the current stable Julia release for the best performance. Install Molly from the Julia REPL. Enter the package mode by pressing ] and run add Molly.

Usage

Some examples are given here, see the documentation for more on how to use the package.

Simulation of a Lennard-Jones fluid:

using Molly

n_atoms = 100
boundary = CubicBoundary(2.0u"nm")
temp = 298.0u"K"
atom_mass = 10.0u"g/mol"

atoms = [Atom(mass=atom_mass, σ=0.3u"nm", ϵ=0.2u"kJ * mol^-1") for i in 1:n_atoms]
coords = place_atoms(n_atoms, boundary; min_dist=0.3u"nm")
velocities = [random_velocity(atom_mass, temp) for i in 1:n_atoms]
pairwise_inters = (LennardJones(),)
simulator = VelocityVerlet(
    dt=0.002u"ps",
    coupling=AndersenThermostat(temp, 1.0u"ps"),
)

sys = System(
    atoms=atoms,
    coords=coords,
    boundary=boundary,
    velocities=velocities,
    pairwise_inters=pairwise_inters,
    loggers=(temp=TemperatureLogger(100),),
)

simulate!(sys, simulator, 10_000)

Simulation of a protein:

using Molly

sys = System(
    joinpath(dirname(pathof(Molly)), "..", "data", "5XER", "gmx_coords.gro"),
    joinpath(dirname(pathof(Molly)), "..", "data", "5XER", "gmx_top_ff.top");
    loggers=(
        temp=TemperatureLogger(10),
        writer=StructureWriter(10, "traj_5XER_1ps.pdb"),
    ),
)

temp = 298.0u"K"
random_velocities!(sys, temp)
simulator = VelocityVerlet(
    dt=0.0002u"ps",
    coupling=AndersenThermostat(temp, 1.0u"ps"),
)

simulate!(sys, simulator, 5_000)

The above 1 ps simulation looks something like this when you view it in VMD: MD simulation

Contributing

Contributions are very welcome including reporting bugs, fixing bugs, adding new features, improving performance, adding tests and improving documentation. Feel free to open an issue or use the channels below to discuss your contribution. New features will generally require tests to be added as well. See the roadmap issue for some discussion of recent progress and future plans.

Join the #juliamolsim channel on the Julia Slack, the #molly channel on the JuliaMolSim Zulip or post on the Julia Discourse to discuss the usage and development of Molly.jl.

Molly.jl follows the Contributor Covenant code of conduct.

Citation

If you use Molly, please cite the following paper (bib entry here):

A paper involving more contributors with further details on the software will be written at some point.

Interested?

There is the possibility of a postdoc position involving the development and use of Molly. Contact Joe Greener with informal enquiries.