/molecularDynamics

Molecular Dynamics in Haskell

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Molecular Dynamics in Haskell

This is a Haskell implementation of the Verlet-Velocity algorithm in a molecular dynamics framework for my blog post.

Pre-requisite Installations

Use Ghcup to install GHC, cabal-install, Stack and haskell-language-server from here

Additional Installation for Windows:

  • Download the freeglut windows development libraries from here
  • Add freeglut/bin/x64/ to your executable path.

To Install Molecular Dynamics

cd <path-to-MolecularDynamics-folder>
stack install

Nix

nix-build release.nix

Run examples

Change the main function in src/Main.hs according to the following section names and run the example via:

stack run

mainNewton

main :: IO ()
main = mainNewton

A particle moving to the right

mainNewtonBounce

main :: IO ()
main = mainNewtonBounce

A particle moving to the right and bouncing of a wall

mainVerlet

main :: IO ()
main = mainVerlet

Two particles attracting and repulsing each other

mainVerletSquare

main :: IO ()
main = mainVerletSquare

Molecular Dynamics simulation of 64 particles

mainVerletRandom

main :: IO ()
main = mainVerletRandom

Molecular Dynamics simulation of 24 randomly generated particles

Documentation

Have a look at the docs for the API documentation.

Generate the docs

Generate the Haddock documentation with:

stack exec -- haddock --html src/Main.hs --hyperlinked-source --odir=docs