Giter Site home page Giter Site logo

majestyv / md2d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lyg-ucl/md2d

0.0 0.0 0.0 4.7 MB

MD2D: a python module for accurate determination of diffusion coefficient from molecular dynamics

License: GNU General Public License v3.0

Python 100.00%

md2d's Introduction

Installing

MD2D needs the dependencies:

numpy
scipy
matplotlib
mdanaysis

It can be installed locally. Under the package directory

pip install .

It can also be installed from pypi

pip install md2d

Usage

MD2D can be used as a standalone code

md2d

or imported as a module

>>> import md2d
>>> md2d.diffusion(xdatcar="XDATACR",outcar="OUTCAR")

Files

Input:

MD2D reads the output of molecular dynamics simulations in the VASP format. Only two input files will be read: XDATCAR and OUTCAR.

..

POTIM  = 1.0000    time-step for ionic-motion
NBLOCK =      1;   KBLOCK =      1    inner block; outer block
Mass of Ions in am
   POMASS =  55.85 
volume of cell :     711.71
kin. lattice  EKIN_LAT=         93.098925  (temperature 7275.16 K)
Total+kin.     3416.08  3605.40  3585.13   -42.72  -109.39   -38.68

..

The keys words “POTIM”, “NBLOCK”, “Mass of Ions in am”, “number of ions“, “volume of cell”, “EKIN_LAT=”, “Total+kin.” are used for searching.

Besides, MD2D uses MDAnalysis to transform the outputs from other molecular dynamics codes to the VASP format. After installation, use the “md2vasp” command to initiate the conversion, or call the “md2v” function.

image

image

Output:

Calculated diffusion coefficients, viscosities, and correction to diffusion coefficient are streamed in standard output. Besides, D-tau, mean squared displacement (MSD) and stress auto-correlation function (SACF) will be written into file as X_D_tau.dat (X is the element name), msd.dat and sacf_average.dat, and their plotsare saved as D_tau.pdf, msd.pdf and SACF.pdf. In each X_D_tau.dat, the first column is the time interval, the left three columns are the Ds for x, y and z directions. The columns in msd.dat corresponds to the MSDs for the elements in the order provided in XDATCAR. The three columns in sacf_average.dat are the MD step, bulk SACF and shear SACF.

How-To Guides

Lauch the code

Simply import the package within python, and enter the menu by typing:

import md2d
md2d.diffusion(XDATCAR", outcar="OUTCAR")

It takes two variables: the names of input files. Default values will be XDATCAR and OUTCAR.

image

Calculate diffusion coefficient

Choose option 1 will lead to the calculation of diffusion coefficient. Then, MD2D will exhaust the available time intervals to calculate the diffusion coefficient as a function of time interval. The procedure and results will be streamed on the screen, and the D-tau data will be written into the file X_D_tau.dat.

Two integer parameters will be asked for, namely, the number of initial MD steps to drop and the number of MD steps to skip for each segment. The first is to drop out the unwanted/unequilibrated initial stage of MD. The second is to exclude the ballistic motion stage from fitting the Einstein relation. The second parameter can be determined from the log-log plot or MSD.

image

image

Plot D-tau

If diffusion coefficients have been calculated by doing option 1, then choose the option 4 will plot the D-tau curve.

image

If step one hasn’t been done, they a warning message will prompt to do option 1 firstly.

image

Calculate MSD

The MSD can be calculated and plotted by choosing option 3. The plot usually sees a change of trending, and the length of the first part is the length of ballistic motion that needs to be removed from fitting the Einstein relation.

image

Calculate viscosities and correction to diffusion coefficient

The stress auto-correlation function, viscosities, and correction to diffusion coefficient will be calculated by choosing option 2. The results will be streamed on the screen. The correction to diffusion coefficient is best applied to single-component system, e.g., pure Fe liquid or molecular liquid. For complex system like silicate melt, an element- or component-wise correction according to Eq. (4) in Li and Ni, (2022) should be considered.

image

Plot stress auto-correlation function

The stress auto-correlation function can be plotted by choosing option 5 after finishing the calculation in option 2. Otherwise, MD2D will ask for doing option 2 firstly.

image

image

License & disclaimer

MD2D Copyright (C) University of Science and Technology of China. This file is part of MD2D. MD2D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 3 of the License. MD2D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with MD2D. If not, see <http: //www.gnu.org/licenses/>.

md2d's People

Contributors

lyg-ucl avatar

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.