-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathget_NEBPLot.py
43 lines (37 loc) · 1.24 KB
/
get_NEBPLot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
"""
################################################################################
# Author: Asif Iqbal
# GitHUb: AIB_EM
# Usage: For publication plot. THis script reads the neb.dat file
# generated from VTST sctipts and using scipy perform the
# cubic interpolation (spline).
#
#################################################################################
"""
import numpy as np
import matplotlib.pyplot as plt
from ase.io import read, write
from scipy.interpolate import CubicSpline
def get_NebPLot():
outFile = 'Fe210'
data = np.loadtxt("neb.dat")
pos = read('00/CONTCAR')
natoms = len(pos.get_positions())
x = data[:, 1]
yy = data[:, 2] / natoms
cs = CubicSpline(x, yy)
new_x = np.linspace(min(x), max(x), 100)
f_dft = cs(new_x)
plt.figure(figsize=(8, 6))
plt.plot(x, yy, "ko", label="Raw NEB points")
plt.plot(new_x, f_dft, "m-", label="Interpolated NEB")
plt.axhline(color="black", linestyle="--")
plt.xlabel("Reaction coordinate [$ \AA $]")
plt.ylabel("Energy [eV/atom]")
plt.legend(loc="best")
plt.grid(True)
plt.title(f"{outFile}")
plt.savefig(f"{outFile}_MEP.pdf", dpi=300, bbox_inches='tight')
plt.show()
get_NebPLot()