A high-performance, GPU-accelerated molecular dynamics simulator for studying the Lennard-Jones system with real-time 3D visualization and comprehensive thermodynamic analysis.
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
| 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 |
The main Qt5-based GUI provides interactive control and real-time visualization:
The simulator can explore all major phases of the Lennard-Jones system:
Low density, high temperature regime showing diffuse particle distribution.
Coexistence of gas and liquid phases.
High density, low temperature showing dense particle packing.
The Lennard-Jones potential describes the interaction between two particles:
Where:
- ε (epsilon): Depth of the potential well (energy scale)
- σ (sigma): Finite distance at which inter-particle potential is zero
- r: Distance between particles
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.
- CMake 3.18+
- C++11 compatible compiler
- Qt5 (for GUI) - optional for CLI tools
- NVIDIA CUDA Toolkit (optional, for GPU acceleration)
- OpenGL development libraries
git clone https://github.com/ellay21/LJFusion.git
cd LJFusion
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)./src/gui/QtLennardJonesIsotherm 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>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
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 locationTypical 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
The simulator uses the Velocity Verlet algorithm for stable, reversible dynamics:
- Periodic: Particles wrap around domain boundaries
- Hard-wall: Elastic collisions with fixed walls
- Open: Particles can leave the domain
- NVE (Microcanonical): Constant volume & energy
- NVT (Canonical): Constant volume & temperature with Berendsen thermostat
Sample data files in /input/ directory test various scenarios:
N400.Tst1.4.isotherm- Low temperature isothermN400.Tst1.708.rho0.05- Gas phase dataN400.Tst1.4.rho0.05- Transition region
This project is licensed under the GNU General Public License v3.0. See LICENSE for details.
Contributions are welcome! Areas for enhancement:
- Additional ensemble implementations (NPT, μVT)
- GPU optimization techniques
- Web-based visualization
- Performance profiling and optimization
For issues, feature requests, or questions:
- Open an issue on GitHub Issues
- Check existing documentation in the project
