kGorze / MDS

Molecular Dynamics Simulation
0 stars 0 forks source link

Project Name

Molecular Dynamic Simulator - Simulates the molecular dynamics of atoms.


Project Description

This is an academic project focused on developing a molecular dynamics simulator. Currently, it simulates Lennard-Jones (LJ) forces using a (less efficient) all-pairs algorithm on a 2D Boltzmann lattice of atoms.

Am not familiar with Docker yet, so here's a breakdown of the "toolchain" dependencies needed for the project: Those are the files required to:

Initial Conditions:

Velocities and accelerations are randomly assigned, preventing the exact reproduction of simulations at present.

Data Output:

Each iteration is saved with coordinates, physical properties, and velocity distribution for later analysis.

Visualization:

A separate Python script utilizing Pygame generates a visual representation of the atomic plane.

Calculations:

Alt Text

Visualization:

Color coded made by python script:

draw_atoms_velocity_sensitive.py

Alt Text

No colour coded by python script:

draw_atoms_no_color_coded.py

Alt Text


Project Status

This project is in its initial stages. The ultimate goal is a 3D simulation of water and solutes, but the current focus is on achieving a stable 2D simulation of atoms.

Stability:

The 2D simulation functionality is still under development.


Features

The project employs a director-builder pattern to create a simulation object. The computeForces function calculates the forces acting on the atoms.


Requirements

For main program

Development Environment:

CLion

Compiler:

Likely GCC (as used by CLion)

For python visualizations

pygame


Installation

The program is not only intended for Windows environment and JetBrains CLion IDE. installation youtube instruction


Usage Examples

The configuration file can be modified to obtain different simulation results.


Documentation

Doxygen documentation is not yet available.


Testing

Unit tests are still under development. The Google Test framework is being considered for implementation.


Contribution and Issue Reporting

Feel free to fork the project or report issues for collaboration. No formal oversight exists yet.


License

The code is freely reusable. The license for the book-based portions is still under consideration.


Authors and Acknowledgments

This project is heavily inspired by the book: The Art of Molecular Dynamics Simulation

  1. Rapaport DC. The Art of Molecular Dynamics Simulation. 2nd ed. Cambridge University Press; 2004.

--

Post-Mortem

First Iteration: The initial challenge arose when we needed to create 3D simulations using methods originally designed for 2D. As a quick solution, we implemented a very primitive object-oriented paradigm with a deeply hierarchical structure.

Second Iteration: The structure became an issue again when we had to incorporate design patterns for the final project submission. To address this, we rewrote the program, adding design patterns like Factory and Builder.

Third Iteration: The third challenge was related to making the base class too generic, which hindered further development. To overcome this, we:

Created a UML diagram before coding. Added design patterns to promote code reusability, modularity, and scalability. Implemented a CI/DI framework with Google tests. Divided the work into modules responsible for multithreading, inter-module communication, physics, etc.

Lessons Learned:

Early planning: Creating a UML diagram from the beginning can prevent architectural issues. Design patterns: They are essential for maintainable and extensible code. Testing: A comprehensive test suite is crucial for catching regressions. Modularization: Breaking down the system into smaller, well-defined modules improves understanding and maintainability.