Skip to content

vlvovch/lennard-jones-cuda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lennard-Jones Molecular Dynamics

An implementation of molecular dynamics simulation of the Lennard-Jones system in a box with real-time visualization. The code solves the N-body problem numerically and utilizes CUDA-enabled NVIDIA GPU's to significantly accelerate the calculations, allowing real-time simulation (~60 frames per second) of large systems containing thousands of particles. The code uses reduced variables and allows to study the thermodynamic properties of the Lennard-Jones system.

This implementation was inspired by the nbody example from NVIDIA CUDA SDK.

The code is separated into three parts:

  • the core library
  • a graphical user interface (GUI) program to run the box simulation and visualization
  • an example of running the simulation from command line

Features

  • Adjust the number of particles, temperature and density, and the time step
  • Switch between CPU or GPU (CUDA) based calculation
  • Velocity Verlet integrator
  • Microcanonical (EVN) or canonical-like (TVN, constant kinetic temperature dynamics) ensemble
  • Periodic or hard-wall boundary conditions
  • Real-time visualization of the system motion (in OpenGL)
  • Calculation and visualization of the radial distribution function and the velocity distribution

QtLennardJones

Prerequisites

For using CUDA-enabled GPUs

  • NVIDIA CUDA Toolkit, tested on v10.2+
  • CUDA-enabled GPU (otherwise only the CPU simulation can be used) with compute capability 3.0+

For the graphical user interface

  • Qt5 framework and OpenGL support to run the GUI

The code is cross-platform and based on CMake. It has been tested on Microsoft Windows 10 (using Visual Studio or CLion IDE), Ubuntu 20.04 (via the command line), Mac OS 13.2 Ventura (both CLion IDE or command line)

Usage

Use the CMake to generate the project and build it. Make sure that CMake can find the CUDA toolkit and Qt5. An example on Unix:

mkdir build
cd build
cmake ../
make

# Run the GUI program
./src/gui/QtLennardJones

Examples

gas liquid
gaseous phase (T* = 1, ρ* = 0.01) liquid phase (T* = 1, ρ* = 0.85)
gas liquid
mixed phase (T* = 1, ρ* = 0.3) solid phase (T* = 1, ρ* = 1.1)

Third-party code

Copyright (C) 2013-2023 Volodymyr Vovchenko

About

Molecular dynamics simulation and visualization of the Lennard-Jones system utilizing CUDA-enabled GPU's

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published