Skip to content

Asif-Iqbal-Bhatti/Script-to-extract-various-properties-from-VASP-OUTCAR-file

Repository files navigation

Code to extract Elastic properties, Energy, and lattice parameter from VASP output files

Maintenance pypi versions GPLv3 license

==> supercell.py script constructs a bcc/fcc supercell for high-entropy alloys.

This repository contains a set of Python scripts for analyzing High Entropy Alloys using VASP output files. The scripts can extract lattice parameters, energy, and volume from each directory in a given parent directory. Additionally, it can scan the CONTCAR file, compute the volume and lattice parameters, and print the volume difference upon structure minimization. The extracted data can be used to analyze the Elastic Constants and make decisions on adjusting ENCUT or KPOINTS to minimize Pulay stress, as indicated in the VASP manual.

**USAGE** : Just run the Main_file.py it will call all the modules
The code has been given in one script (**Extract_elastic_energy_VASP.py**) and in modules. 
The module form is much easier to handle than one long complex code.
~/dir/ -->
dir1
dir2
dir3
POSCAR
OUTCAR
Python Main_file.py

Structural Minimization in VASP:

For VASP structural minimization, the following tags should be used: IBRION = 2; ISIF = 3; EDIFF = 10**-8. VASP implements both the stress method (First derivative approach) and the Energy-strain method for Elastic Constants calculation. The Energy-strain method involves applying Lagrangian strains to the cell and calculating the resulting energy for various deformations. Polynomial fitting is then performed, and the second derivative is calculated at equilibrium volume.

An exercise to print Cij matrix in a Pythonic way: 2D array is created as a List of Lists unlike C++ where you define by C[i][j]

def print_Cij_Matrix():
	Bij = []
	C = "C"
	for i in range(0,6):
		Bij.append([])
		for j in range(0,6):
			Bij[i].append((C + str(i) + str(j)))
	l = np.matrix(Bij)		
	print (l)

ref: exciting ref: materialsproject

licensebuttons by-nd

Parsing Hessian matrix from a file

Script to parse Hessian Matrix from a file

USAGE: To parse the VASP vasprun.xml input file to extract the Hessian Matrix Output file has already been defined in the code (hessian.dat).

CAUTION: Use at your own risk (NOTEVEN IMPLIED GUARANTEED, WHATSOEVER), the code has been tested but the user in the end will have to verify the ouput.

Xpath is a useful tool for directly accessing the element in a Node

-> CHECK this website for lxml introduccion: https://lxml.de/tutorial.html & -> https://github.com/lxml/lxml

NB: The Matrix is obtained from VASP, vasprun.xml file. It contains the hessian matrix that can be edited with the appropriate script.

The complication that arises by parsing the data from the file is the trailing empty lines and tabs that need to be deleted before it can be read. In the case of a simple file format, there is no need for it. But if the file contains irregular data entry such as empty lines with commas and spaces then it needs to be formatted.

In my case, I have only leading empty lines and spaces and in between columns there are white spaces of different sizes.

Convert exciting(LMTO) input file to VASP input file (DFT code)

๐—ข๐—ป๐—ฒ ๐—ณ๐—ถ๐—ฒ๐—น๐—ฑ ๐—ผ๐—ณ ๐˜„๐—ผ๐—ฟ๐—ธ ๐—ถ๐—ป ๐˜„๐—ต๐—ถ๐—ฐ๐—ต ๐˜๐—ต๐—ฒ๐—ฟ๐—ฒ ๐—ต๐—ฎ๐˜€ ๐—ฏ๐—ฒ๐—ฒ๐—ป ๐˜๐—ผ๐—ผ ๐—บ๐˜‚๐—ฐ๐—ต ๐˜€๐—ฝ๐—ฒ๐—ฐ๐˜‚๐—น๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ถ๐˜€ ๐—ฐ๐—ผ๐˜€๐—บ๐—ผ๐—น๐—ผ๐—ด๐˜†. ๐—ง๐—ต๐—ฒ๐—ฟ๐—ฒ ๐—ฎ๐—ฟ๐—ฒ ๐˜ƒ๐—ฒ๐—ฟ๐˜† ๐—ณ๐—ฒ๐˜„ ๐—ต๐—ฎ๐—ฟ๐—ฑ ๐—ณ๐—ฎ๐—ฐ๐˜๐˜€ ๐˜๐—ผ ๐—ด๐—ผ ๐—ผ๐—ป, ๐—ฏ๐˜‚๐˜ ๐˜๐—ต๐—ฒ๐—ผ๐—ฟ๐—ฒ๐˜๐—ถ๐—ฐ๐—ฎ๐—น ๐˜„๐—ผ๐—ฟ๐—ธ๐—ฒ๐—ฟ๐˜€ ๐—ต๐—ฎ๐˜ƒ๐—ฒ ๐—ฏ๐—ฒ๐—ฒ๐—ป ๐—ฏ๐˜‚๐˜€๐˜† ๐—ฐ๐—ผ๐—ป๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜๐—ถ๐—ป๐—ด ๐˜ƒ๐—ฎ๐—ฟ๐—ถ๐—ผ๐˜‚๐˜€ ๐—บ๐—ผ๐—ฑ๐—ฒ๐—น๐˜€ ๐—ณ๐—ผ๐—ฟ ๐˜๐—ต๐—ฒ ๐—จ๐—ป๐—ถ๐˜ƒ๐—ฒ๐—ฟ๐˜€๐—ฒ, ๐—ฏ๐—ฎ๐˜€๐—ฒ๐—ฑ ๐—ผ๐—ป ๐—ฎ๐—ป๐˜† ๐—ฎ๐˜€๐˜€๐˜‚๐—บ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€ ๐˜๐—ต๐—ฎ๐˜ ๐˜๐—ต๐—ฒ๐˜† ๐—ณ๐—ฎ๐—ป๐—ฐ๐˜†. ๐—ง๐—ต๐—ฒ๐˜€๐—ฒ ๐—บ๐—ผ๐—ฑ๐—ฒ๐—น๐˜€ ๐—ฎ๐—ฟ๐—ฒ ๐—ฝ๐—ฟ๐—ผ๐—ฏ๐—ฎ๐—ฏ๐—น๐˜† ๐—ฎ๐—น๐—น ๐˜„๐—ฟ๐—ผ๐—ป๐—ด. ๐—œ๐˜ ๐—ถ๐˜€ ๐˜‚๐˜€๐˜‚๐—ฎ๐—น๐—น๐˜† ๐—ฎ๐˜€๐˜€๐˜‚๐—บ๐—ฒ๐—ฑ ๐˜๐—ต๐—ฎ๐˜ ๐˜๐—ต๐—ฒ ๐—น๐—ฎ๐˜„๐˜€ ๐—ผ๐—ณ ๐—ป๐—ฎ๐˜๐˜‚๐—ฟ๐—ฒ ๐—ต๐—ฎ๐˜ƒ๐—ฒ ๐—ฎ๐—น๐˜„๐—ฎ๐˜†๐˜€ ๐—ฏ๐—ฒ๐—ฒ๐—ป ๐˜๐—ต๐—ฒ ๐˜€๐—ฎ๐—บ๐—ฒ ๐—ฎ๐˜€ ๐˜๐—ต๐—ฒ๐˜† ๐—ฎ๐—ฟ๐—ฒ ๐—ป๐—ผ๐˜„. ๐—ง๐—ต๐—ฒ๐—ฟ๐—ฒ ๐—ถ๐˜€ ๐—ป๐—ผ ๐—ท๐˜‚๐˜€๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ณ๐—ผ๐—ฟ ๐˜๐—ต๐—ถ๐˜€. ๐—ง๐—ต๐—ฒ ๐—น๐—ฎ๐˜„๐˜€ ๐—บ๐—ฎ๐˜† ๐—ฏ๐—ฒ ๐—ฐ๐—ต๐—ฎ๐—ป๐—ด๐—ถ๐—ป๐—ด, ๐—ฎ๐—ป๐—ฑ ๐—ถ๐—ป ๐—ฝ๐—ฎ๐—ฟ๐˜๐—ถ๐—ฐ๐˜‚๐—น๐—ฎ๐—ฟ, ๐—พ๐˜‚๐—ฎ๐—ป๐˜๐—ถ๐˜๐—ถ๐—ฒ๐˜€ ๐˜๐—ต๐—ฎ๐˜ ๐—ฎ๐—ฟ๐—ฒ ๐—ฐ๐—ผ๐—ป๐˜€๐—ถ๐—ฑ๐—ฒ๐—ฟ๐—ฒ๐—ฑ ๐˜๐—ผ ๐—ฏ๐—ฒ ๐—ฐ๐—ผ๐—ป๐˜€๐˜๐—ฎ๐—ป๐˜๐˜€ ๐—ผ๐—ณ ๐—ป๐—ฎ๐˜๐˜‚๐—ฟ๐—ฒ ๐—บ๐—ฎ๐˜† ๐—ฏ๐—ฒ ๐˜ƒ๐—ฎ๐—ฟ๐˜†๐—ถ๐—ป๐—ด ๐˜„๐—ถ๐˜๐—ต ๐—ฐ๐—ผ๐˜€๐—บ๐—ผ๐—น๐—ผ๐—ด๐—ถ๐—ฐ๐—ฎ๐—น ๐˜๐—ถ๐—บ๐—ฒ. ๐—ฆ๐˜‚๐—ฐ๐—ต ๐˜ƒ๐—ฎ๐—ฟ๐—ถ๐—ฎ๐˜๐—ถ๐—ผ๐—ป๐˜€ ๐˜„๐—ผ๐˜‚๐—น๐—ฑ ๐—ฐ๐—ผ๐—บ๐—ฝ๐—น๐—ฒ๐˜๐—ฒ๐—น๐˜† ๐˜‚๐—ฝ๐˜€๐—ฒ๐˜ ๐˜๐—ต๐—ฒ ๐—บ๐—ผ๐—ฑ๐—ฒ๐—น ๐—บ๐—ฎ๐—ธ๐—ฒ๐—ฟ๐˜€." ๐——๐—ถ๐—ฟ๐—ฎ๐—ฐ, ๐—ฃ๐—ฎ๐˜‚๐—น. ๐—ข๐—ป ๐—บ๐—ฒ๐˜๐—ต๐—ผ๐—ฑ๐˜€ ๐—ถ๐—ป ๐˜๐—ต๐—ฒ๐—ผ๐—ฟ๐—ฒ๐˜๐—ถ๐—ฐ๐—ฎ๐—น ๐—ฝ๐—ต๐˜†๐˜€๐—ถ๐—ฐ๐˜€. (๐—ง๐—ฟ๐—ถ๐—ฒ๐˜€๐˜๐—ฒ. ๐—๐˜‚๐—ป๐—ฒ ๐Ÿญ๐Ÿต๐Ÿฒ๐Ÿด .)