Skip to content

LJ Fusion is a high-performance Lennard-Jones molecular dynamics simulator with CUDA acceleration, real-time Qt5/OpenGL visualization, and CLI thermodynamic tools. Supports Velocity Verlet, NVE/NVT ensembles, and multiple boundary conditions for studying interactions, phase transitions, and statistical mechanics.

License

Notifications You must be signed in to change notification settings

ellay21/LJFusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

47 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧬 LJ Fusion: Lennard-Jones Molecular Dynamics Simulator

Build & Test License: GPL v3 GitHub stars

A high-performance, GPU-accelerated molecular dynamics simulator for studying the Lennard-Jones system with real-time 3D visualization and comprehensive thermodynamic analysis.


πŸ“– Overview

LJ Fusion is a sophisticated computational chemistry application that simulates the behavior of particles interacting via the Lennard-Jones potential. The simulator leverages NVIDIA CUDA for GPU acceleration, enabling real-time simulation of systems with thousands of particles at ~60 fps.

The project demonstrates:

  • CUDA GPU Computing: High-performance force calculations on NVIDIA GPUs
  • Molecular Dynamics: Velocity Verlet integration with multiple ensemble supports
  • Real-time Visualization: OpenGL 3D rendering with interactive controls
  • Thermodynamic Analysis: Computation of thermodynamic properties and statistical distributions
  • Multi-platform Support: Cross-platform deployment via CMake

🎯 Core Capabilities

Feature Description
Ensembles Microcanonical (NVE), Canonical (TVN) with thermostat
Boundary Conditions Periodic, Hard-wall, and Open expansion modes
GPU Acceleration CUDA-optimized force calculations for 10-100x speedup
Visualization Real-time 3D particle rendering with OpenGL
Analysis Tools RDF, velocity distributions, thermodynamic properties
CLI Tasks Batch simulations for phase diagrams and fluctuation analysis

🎬 Visual Results

GUI Application Demo

The main Qt5-based GUI provides interactive control and real-time visualization:

QtLennardJones GUI

Phase Diagram Visualization

The simulator can explore all major phases of the Lennard-Jones system:

Gaseous Phase (T* = 1.5, ρ* = 0.02)

Gas Phase Low density, high temperature regime showing diffuse particle distribution.

Mixed Phase (T* = 1, ρ* = 0.3)

Mixed Phase Coexistence of gas and liquid phases.

Liquid Phase (T* = 1, ρ* = 0.85)

Liquid Phase High density, low temperature showing dense particle packing.


πŸ“Š Lennard-Jones Physics

The Lennard-Jones potential describes the interaction between two particles:

$$V_{LJ}(r) = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6} \right]$$

Where:

  • Ξ΅ (epsilon): Depth of the potential well (energy scale)
  • Οƒ (sigma): Finite distance at which inter-particle potential is zero
  • r: Distance between particles

Dimensionless Units

The simulator uses reduced units:

  • T* = k_B T / Ξ΅ (Reduced temperature)
  • ρ* = ρ σ³ (Reduced density)
  • t* = t √(mΞ΅/σ²) (Reduced time)

This allows study across different materials without unit conversion.


πŸš€ Quick Start

Prerequisites

  • CMake 3.18+
  • C++11 compatible compiler
  • Qt5 (for GUI) - optional for CLI tools
  • NVIDIA CUDA Toolkit (optional, for GPU acceleration)
  • OpenGL development libraries

Linux/macOS Installation

git clone https://github.com/ellay21/LJFusion.git
cd LJFusion
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)

Running the Application

GUI Application (Qt5 Required)

./src/gui/QtLennardJones

Command-Line Tools

Isotherm Simulation - Generate phase diagram data:

./src/tasks/run-isotherm <temperature> <density> <steps>

Fluctuations Analysis - Study system fluctuations:

./src/tasks/run-fluctuations <temperature> <density> <duration>

Semi-GCE Analysis - Grand canonical ensemble analysis:

./src/tasks/semiGCEfluctuations <parameters>

πŸ“ Project Structure

LJFusion/
β”œβ”€β”€ CMakeLists.txt              # Root CMake configuration
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ library/                # Core MD library (CPU/GPU)
β”‚   β”‚   β”œβ”€β”€ MDSystem.h/cpp      # Main molecular dynamics engine
β”‚   β”‚   β”œβ”€β”€ MDSystem.cu         # CUDA GPU kernels
β”‚   β”‚   └── splinefunction.*    # Utility functions
β”‚   β”œβ”€β”€ gui/                    # Qt5 GUI application
β”‚   β”‚   β”œβ”€β”€ main.cpp           # Application entry point
β”‚   β”‚   β”œβ”€β”€ mainwindow.*        # Main window UI
β”‚   β”‚   β”œβ”€β”€ glwidget.*          # OpenGL 3D viewport
β”‚   β”‚   └── constants.*         # UI constants
β”‚   β”œβ”€β”€ tasks/                  # Command-line analysis tools
β”‚   β”‚   β”œβ”€β”€ run-isotherm/       # Isotherm simulation task
β”‚   β”‚   β”œβ”€β”€ run-fluctuations/   # Fluctuations analysis
β”‚   β”‚   └── semiGCEfluctuations/ # Semi-GCE analysis
β”‚   └── extra/                  # Utility modules
β”œβ”€β”€ thirdparty/                 # External dependencies
β”‚   β”œβ”€β”€ QCustomPlot/            # Plot visualization
β”‚   └── MersenneTwister/        # RNG implementation
β”œβ”€β”€ input/                      # Sample input data files
β”œβ”€β”€ .github/workflows/          # GitHub Actions CI/CD
└── LICENSE                     # GPLv3 License


πŸ”§ Build Options

Custom CMake options:

cmake .. \
  -DCMAKE_BUILD_TYPE=Release      # Release or Debug
  -DCMAKE_CUDA_COMPILER=OFF       # Disable GPU acceleration
  -DCMAKE_PREFIX_PATH=/path/to/Qt5 # Custom Qt5 location

πŸ“ˆ Performance

Typical performance (NVIDIA RTX 2080 Ti):

  • Single precision (float): ~15 GFLOPS sustained
  • Particle count: Up to 100,000 particles at 60 FPS
  • Integration accuracy: Velocity Verlet, O(dtΒ²)
  • Speedup over CPU: 10-100x depending on system size

πŸ“š Algorithm Details

Velocity Verlet Integration

The simulator uses the Velocity Verlet algorithm for stable, reversible dynamics:

$$v(t + dt/2) = v(t) + \frac{dt}{2m}F(t)$$ $$r(t + dt) = r(t) + dt \cdot v(t + dt/2)$$ $$v(t + dt) = v(t + dt/2) + \frac{dt}{2m}F(t+dt)$$

Boundary Conditions

  1. Periodic: Particles wrap around domain boundaries
  2. Hard-wall: Elastic collisions with fixed walls
  3. Open: Particles can leave the domain

Ensembles

  • NVE (Microcanonical): Constant volume & energy
  • NVT (Canonical): Constant volume & temperature with Berendsen thermostat

πŸ§ͺ Testing & Validation

Sample data files in /input/ directory test various scenarios:

  • N400.Tst1.4.isotherm - Low temperature isotherm
  • N400.Tst1.708.rho0.05 - Gas phase data
  • N400.Tst1.4.rho0.05 - Transition region

πŸ“ License

This project is licensed under the GNU General Public License v3.0. See LICENSE for details.


🀝 Contributing

Contributions are welcome! Areas for enhancement:

  • Additional ensemble implementations (NPT, ΞΌVT)
  • GPU optimization techniques
  • Web-based visualization
  • Performance profiling and optimization

πŸ“ž Support

For issues, feature requests, or questions:

  • Open an issue on GitHub Issues
  • Check existing documentation in the project

Last Updated: November 18, 2025

About

LJ Fusion is a high-performance Lennard-Jones molecular dynamics simulator with CUDA acceleration, real-time Qt5/OpenGL visualization, and CLI thermodynamic tools. Supports Velocity Verlet, NVE/NVT ensembles, and multiple boundary conditions for studying interactions, phase transitions, and statistical mechanics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages