Code Monkey home page Code Monkey logo

molly.jl's Introduction

Molly.jl

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.

At the minute the package is a proof of concept for MD in Julia. It is not production ready. It can simulate a system of atoms with arbitrary interactions as defined by the user. Implemented features include:

  • Interface to allow definition of new forces, simulators, thermostats, neighbor finders, loggers etc.
  • Read in pre-computed Gromacs topology and coordinate files with the OPLS-AA forcefield and run MD on proteins with given parameters. In theory it can do this for any regular protein, but in practice this is untested.
  • Non-bonded interactions - Lennard-Jones Van der Waals/repulsion force, electrostatic Coulomb potential, gravitational potential, soft sphere potential, Mie potential.
  • Bonded interactions - covalent bonds, bond angles, torsion angles.
  • Andersen thermostat.
  • Velocity Verlet and velocity-free Verlet integration.
  • Explicit solvent.
  • Periodic boundary conditions in a cubic box.
  • Neighbor list to speed up calculation of non-bonded forces.
  • Automatic multithreading.
  • Unitful.jl compatibility so numbers have physical meaning.
  • GPU acceleration on CUDA-enabled devices.
  • Run with Float64 or Float32.
  • Some analysis functions, e.g. RDF.
  • Physical agent-based modelling.
  • Visualise simulations as animations.
  • Differentiable molecular simulation on an experimental branch - see the relevant docs.

Features not yet implemented include:

  • Protein force fields other than OPLS-AA.
  • Water models.
  • Energy minimisation.
  • Other temperature or pressure coupling methods.
  • Cell-based neighbor list.
  • Protein preparation - solvent box, add hydrogens etc.
  • Trajectory/topology file format readers/writers.
  • Quantum mechanical modelling.
  • High test coverage.

Installation

Julia is required, with Julia v1.6 or later required to get the latest version of Molly. 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 gas:

using Molly

n_atoms = 100
box_size = 2.0u"nm"
temp = 298u"K"
mass = 10.0u"u"

atoms = [Atom(mass=mass, σ=0.3u"nm", ϵ=0.2u"kJ * mol^-1") for i in 1:n_atoms]
coords = placeatoms(n_atoms, box_size, 0.3u"nm")
velocities = [velocity(mass, temp) for i in 1:n_atoms]
general_inters = (LennardJones(),)

s = Simulation(
    simulator=VelocityVerlet(),
    atoms=atoms,
    general_inters=general_inters,
    coords=coords,
    velocities=velocities,
    temperature=temp,
    box_size=box_size,
    thermostat=AndersenThermostat(1.0u"ps"),
    loggers=Dict("temp" => TemperatureLogger(100)),
    timestep=0.002u"ps",
    n_steps=10_000,
)

simulate!(s)

Simulation of a protein:

using Molly

timestep = 0.0002u"ps"
temp = 298u"K"
n_steps = 5_000

atoms, specific_inter_lists, general_inters, neighbor_finder, coords, box_size = readinputs(
            joinpath(dirname(pathof(Molly)), "..", "data", "5XER", "gmx_top_ff.top"),
            joinpath(dirname(pathof(Molly)), "..", "data", "5XER", "gmx_coords.gro"))

s = Simulation(
    simulator=VelocityVerlet(),
    atoms=atoms,
    specific_inter_lists=specific_inter_lists,
    general_inters=general_inters,
    coords=coords,
    velocities=[velocity(a.mass, temp) for a in atoms],
    temperature=temp,
    box_size=box_size,
    neighbor_finder=neighbor_finder,
    thermostat=AndersenThermostat(1.0u"ps"),
    loggers=Dict("temp" => TemperatureLogger(10),
                    "writer" => StructureWriter(10, "traj_5XER_1ps.pdb")),
    timestep=timestep,
    n_steps=n_steps,
)

simulate!(s)

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

Contributing

Contributions are very welcome - see the roadmap issue for more.

molly.jl's People

Contributors

ederag avatar ehgus avatar ellipse0934 avatar github-actions[bot] avatar jgreener64 avatar longemen3000 avatar maxscheurer avatar sebastianm-c avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.