An enhanced-sampling algorithm that increases acceptance probability by perfomring non-equilibrium work simulations.
Table of Contents
This repository was made with the intention of implementing a Molecular Dynamics algorithm written in 2009 by Prof. Jarzynski and Mr. Andrew Ballard, titled "Replica Exchange with Non-Equilibrium Switches". It eventually became a module which not only did that, but also as a framework for attempting molecular dynamics simulations on any toy system.
-
Clone the repository :
git clone https://github.com/shaunak-badani/1D_MD.git
-
Install anaconda or miniconda to manage the packages required to run this code.
-
Use the
MD.yml
environment file to create an environmentMD
which contains all the packages required to run this module, and activate it. Some of the packages in the environment may not be required, likeopenmm
, so you can manually remove them if there are space constraints.conda env create -f MD.yml conda activate MD
-
Copy the following into a file
nve.json
:{ "num_particles": 10, "num_steps": 10000, "run_type": "nve", "files" : "." }
-
Run the code with the json file, in the
Basic
directory :cd Basic python3 main.py -c nve.json
-
This creates a folder in the directory
Basic/
, by the name of the json file,nve
. -
The folder contains the following files :
nve ├── end.rst ├── p.txt ├── scalars.txt └── v.txt
-
The above mentioned folder contains data about the simulation that was just performed. More details on it are given below. Furthermore, analysis of the simulation can be performed using the following command :
cd Basic python3 analyze.py -c nve.json
-
This creates a bunch of plots in
analysis_plots
folder, which help in analyzing the simulation. For the NVE run, it is sufficient to see theenergies
plot and check whether the total energy remained constant or not. -
Further options for the json file are given in the README in
Basic
.
The module implements a couple of interesting toy systems on which MD is performed.
This system contains a single particle moving in 1 direction, along the x-axis. It is a continuous version of the potential function as described in chapter 13 of Leach. Its potential, at any given point, is calculated using the graph below :
This graph has three local minima, transitions between which are of great interest in studying Molecular Dynamics Algorithms.
If a system were to include multiple particles at once, they would be considered non-interacting particles, and the potential energy of the system would be the sum of potential energies of all particles on the surface.
The Muller Brown potential is a combination of multiple gaussians in the 2-D plane. Its potential energy surface, or PES, looks like the following :
There are two valleys separated by an energy barrier, which again makes this system of great interest.
-
Running individual tests :
cd Basic python -m unittest -v tests.test_nh python -m unittest -v tests.test_leach
-
Running all tests :
python -m unittest discover -v
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
snsinfu's
Replica Exchange implementation which gave inspiration to the REMD implementation in this module.- sandeshkalantre, for his Jarzynski repo which contains computational examples on proving Jarzynski's equality.