Skip to content

Commit 3c2912b

Browse files
author
Shaunak
committed
Added README, and files option in json
1 parent 6bb4c59 commit 3c2912b

File tree

7 files changed

+186
-9
lines changed

7 files changed

+186
-9
lines changed

Basic/README.md

-8
This file was deleted.

Basic/src/config.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ def import_from_file(file_name):
8787
Config.run_name = os.path.splitext(file_name)[0]
8888

8989
if not Config.ada:
90-
Config.files = "../../runs"
90+
if 'files' in data:
91+
Config.files = data['files']
92+
else:
93+
Config.files = "../../runs"
94+
9195

9296
if 'primary_replica' in data:
9397
Config.primary_replica = data['primary_replica']

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Shaunak Badani
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<br />
2+
<div align="center">
3+
<img src="./images/RENS.png" alt="Logo" width="200" height="80">
4+
5+
6+
<h3 align="center">Replica Exchange With Non-Equilibrium Switches</h3>
7+
8+
<p align="center">
9+
An enhanced-sampling algorithm that increases acceptance probability by perfomring non-equilibrium work simulations.
10+
<br />
11+
</p>
12+
</div>
13+
14+
15+
16+
<!-- TABLE OF CONTENTS -->
17+
<details>
18+
<summary>Table of Contents</summary>
19+
<ol>
20+
<li>
21+
<a href="#about-the-project">About The Project</a>
22+
</li>
23+
<li>
24+
<a href="#getting-started">Getting Started</a>
25+
</li>
26+
<li><a href="#systems">Systems</a></li>
27+
<li><a href="#roadmap">Roadmap</a></li>
28+
<li><a href="#license">License</a></li>
29+
<li><a href="#contact">Contact</a></li>
30+
<li><a href="#acknowledgments">Acknowledgments</a></li>
31+
</ol>
32+
</details>
33+
34+
35+
36+
<!-- ABOUT THE PROJECT -->
37+
## About The Project
38+
39+
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"](https://www.pnas.org/content/106/30/12224). It eventually became a module which not only did that, but also as a framework for attempting molecular dynamics simulations on any toy system.
40+
41+
<p align="right">(<a href="#top">back to top</a>)</p>
42+
43+
44+
45+
<!-- GETTING STARTED -->
46+
## Getting Started
47+
48+
* Clone the repository :
49+
```
50+
git clone https://github.com/shaunak-badani/1D_MD.git
51+
```
52+
* Install [anaconda](https://docs.anaconda.com/anaconda/install/index.html) or [miniconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html) to manage the packages required to run this code.
53+
54+
* Use the `MD.yml` environment file to create an environment `MD` which contains all the packages required to run this module, and activate it. Some of the packages in the environment may not be required, like `openmm`, so you can manually remove them if there are space constraints.
55+
```
56+
conda env create -f MD.yml
57+
conda activate MD
58+
```
59+
60+
* Copy the following into a file `nve.json` :
61+
```
62+
{
63+
"num_particles": 10,
64+
"num_steps": 10000,
65+
"run_type": "nve",
66+
"files" : "."
67+
}
68+
```
69+
* Run the code with the json file, in the `Basic` directory :
70+
```
71+
cd Basic
72+
python3 main.py -c nve.json
73+
```
74+
75+
* This creates a folder in the directory `Basic/`, by the name of the json file, `nve`.
76+
77+
* The folder contains the following files :
78+
79+
```tree
80+
nve
81+
├── end.rst
82+
├── p.txt
83+
├── scalars.txt
84+
└── v.txt
85+
```
86+
87+
* 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 :
88+
```
89+
cd Basic
90+
python3 analyze.py -c nve.json
91+
```
92+
93+
* 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 the `energies` plot and check whether the total energy remained constant or not.
94+
95+
* Further options for the json file are given in the README in `Basic`.
96+
97+
98+
## Systems
99+
100+
The module implements a couple of interesting toy systems on which MD is performed.
101+
102+
103+
104+
### 1-Dimensional Leach
105+
106+
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 :
107+
108+
<img src="./images/U.png" alt="1D_U" width="400" height="300">
109+
110+
This graph has three local minima, transitions between which are of great interest in studying Molecular Dynamics Algorithms.
111+
112+
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.
113+
114+
### 2-Dimensional Muller Brown Potential
115+
116+
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 :
117+
118+
119+
<img src="./images/2D_U.png" alt="2D_U" width="400" height="350">
120+
121+
There are two valleys separated by an energy barrier, which again makes this system of great interest.
122+
123+
124+
125+
<!-- ROADMAP -->
126+
## Roadmap
127+
128+
- [] Implement Analysis objects for 2-D brown muller potential
129+
- [] Benchmarking for RENS runs.
130+
131+
132+
133+
<!-- CONTRIBUTING -->
134+
## Contributing
135+
136+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
137+
138+
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".
139+
Don't forget to give the project a star! Thanks again!
140+
141+
1. Fork the Project
142+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
143+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
144+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
145+
5. Open a Pull Request
146+
147+
148+
<!-- LICENSE -->
149+
## License
150+
151+
Distributed under the MIT License. See `LICENSE.txt` for more information.
152+
153+
154+
155+
<!-- ACKNOWLEDGMENTS -->
156+
## Acknowledgments
157+
158+
* `snsinfu's` [Replica Exchange implementation](https://github.com/snsinfu/f95-replica-exchange) which gave inspiration to the REMD implementation in this module.
159+
* sandeshkalantre, for his [Jarzynski repo](https://github.com/sandeshkalantre/jarzynski) which contains computational examples on proving Jarzynski's equality.
160+

images/2D_U.png

19.9 KB
Loading

images/RENS.png

7.22 KB
Loading

images/U.png

22.9 KB
Loading

0 commit comments

Comments
 (0)