Giter Club home page Giter Club logo

f-md's Introduction

F-MD, Fortran Molecular Dynamic

A simple Molecular Dynamic implementation in Fortran.

Water molecules are randomly initialized in a simulation box with Periodic Bondary Condition using minimal image. This work relies on the SPC/Fw water model, where interaction potential is described as:

$$V = V^\text{intra} + V^\text{inter}$$

with $$ V^\text{intra} = \cfrac{k_b}{2}\left[ (r_{\text{OH}1} - r\text{OH}^\text{eq})^2 + (r_{\text{OH}2} - r\text{OH}^\text{eq})^2 \right] + \cfrac{k_a}{2} (\theta_\text{HOH} - \theta_\text{HOH}^\text{eq})^2 $$

and $$ V^\text{inter} = \sum_{ij}^\text{all pairs} \left{ 4\epsilon_{ij} \left[ \left(\cfrac{\sigma_{ij}}{R_{ij}} \right)^{12} - \left(\cfrac{\sigma_{ij}}{R_{ij}} \right)^{6} \right] - q_i q_j \cfrac{e^{-\alpha m R_{ij}}}{R_{ij}} \right} $$

Parameters are given in the following table:

$k_b$ $r_\text{OH}^\text{eq}$ (ร…) $k_a$ $\theta_\text{HOH}^\text{eq}$ (deg) $\sigma_\text{OO}$ (ร…) $\epsilon_\text{OO}$ (kcal.mol-1) $q(\text{O})$ (e) $q(\text{H})$ (e)
1059.162 1.012 75.90 113.24 3.165492 0.1554253 -0.82 0.41
  • Bonded and angle interactions are modeled by harmonic potentials
  • van der Waals interactions are modeled by a Lennard-Jones potential
  • Coulomb interactions are modeled by a Yukawa potential, ie. screened Coulomb potential

Installation

To install, clone this repository:

git clone [email protected]:comecattin/F-MD.git
cd F-MD

Then compile the source:

cd src
make

Run an MD simulation

To run an MD simulation simply run ./md_simulation input.in in the src directory.

The file input.in is the input file and contain:

  • The number of particles (n_atoms, default 30)
  • The number of time steps (n_steps, default 1000)
  • The time step (dt, default 0.001)
  • The box length (box_length, default 10.0)
  • Stride, write position, energies and print them every nth step (stride, default 1)

An example is given in the examples/example_input.in file.

Output and plot the trajectories

By default, positions along time steps are outputted in the trajectories.dat file.

To plot an animation of the trajectories, run python plot_trajectories.py in the directory where the trajectories.dat file is written.

Output and plot the energies

Kinetic, potential and total energies are by default computed at each time step and saved under the energies.dat file.

To plot theses energies along the time, run python plot_energies.py energies.dat. An energies.pdf file will be written.

f-md's People

Contributors

comecattin avatar

Watchers

 avatar

f-md's Issues

Better input parsing

Is your feature request related to a problem? Please describe.
Input parser is not really efficient.

Describe the solution you'd like
More flexible parser. Read the input file using a python program

[BUG] Correct the Coulomb potential

Describe the bug
Coulomb potential do not converge as simply as implemented now. Ewald sum could be implemented but more simple, the Yukawa potential could be implemented. See the potential here

Expected behavior
Better energy conservation

[BUG] Constraints algorithm

Describe the bug
The constraints algorithm doesn't seem to work properly. As a consequence, the total energy is not conserved and loss in the kinetic energy is noted. This may be due to wrong implementation of the SHAKE algorithm, especially on the velocities update.

To Reproduce
input to reproduce the behavior:

n_atoms : 60          # Number of atoms in the system
n_steps : 10000       # Number of time steps
dt : 0.001            # Time step
box_length : 10.0     # Length of the PBC box
tolerance : 1.0e-6    # SHAKE tolerance
max_iter : 100        # Maximum iteration for SHAKE algorithm

Expected behavior
Total energy must be conserved along time

Potential and kinetic energies

Potential and kinetic energies should be output by the code

  • Compute kinetic energy
  • Compute potential energy
  • Compute total energy
  • Output these energies
  • Plot these energies

Export trajectories

Export the trajectories as to be readable by VMD or other visualisation program. Use the .arc file type

Pression control

Implement a barostat to control the pression during simulations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.