GithubHelp home page GithubHelp logo

lepingkyxk / dipole-acf Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 6.0 1.08 MB

A Python (version 2.7) script for calculating the IR spectrum based on the Fast Fourier Transform (FFT) of the Auto-Correlation Function of the total dipole moment data (Dipole-ACF, or DACF). The total dipole moment data were generated from the CP2K ab initio molecular dynamics (AIMD) simulations.

Python 100.00%

dipole-acf's Introduction

Dipole-ACF

This little project was one of my works in ab initio molecular dynamics (AIMD) simulations, in which a Python (version 2.7) script was composed for calculating the IR spectrum based on the fast Fourier transform (FFT) of the autocorrelation function.

This script first read the total dipole moment (Dipole in short) data, which is generated from the [CP2K/QuickStep] (https://www.cp2k.org/quickstep "CP2K") simulations, and then calculates the time derivative of the Dipole, yielding the dipole prime (D_p in short). After computing the autocorrelation of the D_p, the DACF data array was obtained. By performing the FFT on the DACF, the final IR spectrum is produced. And then plotted on the graph panel by using the Matplotlib module.

Modules required:

  • Numpy (version 1.9.1 or above)
  • Scipy (version 0.17.0 or above)
  • Matplotlib (version 1.4 or above)

Short history

This script (VERSION 3.3) is the improved version based on Dr. Kulig's first version of ir_total_QC.py, which was a pure Python script without using Numpy, Scipy, and no visualization of the results.

The author renamed it into IR_DACF_KW.py, where "K" refers to Dr. Kulig, and "W" refers to Dr. Wang.

The main improvements are:

  1. Implementation of the powerful Numpy module, which facilitates the fast calculation of the data array. The Numpy module accelerates the calculations dramatically by converting all data lists into data arrays. Usually, the calculations would complete within 3 seconds.

  2. Built a zero_padding() function. This function dynamically adds a series of zeros to the end of the Dipole moment array before FFT. The length of the whole data series is the power-of-two (2n).

    • [Note] FFT (Fast Fourier Transform) refers to a way the discrete Fourier Transform (DFT) can be calculated efficiently, by using symmetries in the calculated terms. The symmetry is highest when n is a power of 2, and the transform is, therefore, most efficient for these sizes.
  3. Using built-in signal.fftconvolve() function in scipy.signal module for accelerating the auto-correlation function calculation.

  4. A choose_window() function was taken into consideration for suppressing noise. The window function is imported from scipy.signal module.

  5. Built a visualization() function for plotting the results.

Contribution:

Dr. Huan Wang (The 3rd and 2nd versions)
Dr. Waldemar Kulig (The 1st version)

E-mail address for contacting the authors:

[email protected] or [email protected] (China)

Copyright:

The Hebrew University of Jerusalem, Givat Ram, Jerusalem, 91904, Israel.

PLEASE READ THE FOLLOWING INSTRUCTIONS BEFORE RUNNING SCRIPT

The Format for Running This Script:

python IR_total_KW.py INPUT_FILE DELTA_T WINDOW OUTPUT_FILE

The values need to be input manually when running this script

  1. INPUT_FILE: The Total_Dipole_Moment.Diople file
    • NOTE: do NOT need to re-split the Dipole file)
  2. DELTA_T: The Time_step set in simulation, in unit of fs
  3. WINDOW: The Name of the Window Function
  4. OUTPUT_FILE: The Name of the Output File
    • NOTE: do NOT need to type '>' sign!

######################## Let's Try It! ######################

dipole-acf's People

Contributors

lepingkyxk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.