Note

VASP package: This package does processing of the VASP sofware output files

esta.vaspBag.inout package#

Submodules#

esta.vaspBag.inout.crystal_lattice module#

Crystal lattice class to define lattice parameters and basis crystal = lattice + basis (atoms or molecules )

Author: Sonu Kumar Email: sonukumar.physics@gmail.com

Date: April, 2017 updates:2019, 2020, 2022

class esta.vaspBag.inout.crystal_lattice.CrystalLattice(filename=None, location=None)#

Bases: object

Crystal lattice class to define lattice parameters and basis crystal = lattice + basis (atoms or molecules )

get_all_atoms_labels()#

by reading POSCAR, find the atomic labels of the atoms and total no of atoms

input: POSCAR file in current dir.

output:
  • list of strings of atomic lebels of all atoms according to the numbering of atoms in

POSCAR file - scalar; total number of atoms in the POSCAR file - list of integer numbers starting from 1 to ntotal for all atoms(e.g. 1 1 1 2 3 4 4 ..)

author: sk email: sonukumar.physics@gmail.com

property get_atm_type#

get symbolic representation of atoms of each type in the form of list

get_cell_matrix(style_format=None)#

get lattice matrix of three cell/lattice vectors lv1, lv2, and lv3 in c-style format or fortran stype format

property get_cell_vectors#

geta tuple of set of three cell/lattice vectors lv1, lv2, and lv3 in c-style format

get_dispPOSCAR(ldisp=None, disp_atoms_num=None)#

get displaced poscar with selective tag and atomic positions tagged as T T T or F F F

input:

logical: ldisp, True/False (displace all atoms or dont displace any of the atoms)

list: disp_atoms_num; atm numbers which are to be displaced;

numbering starts from 1 .. to natoms ….TODO YET

output:

POSCAR file with selective dynamics tags

property get_each_atm_type#

get same integer for atoms of same type

get_grouped_list(llist)#

get same string elements of list grouped together

property get_natm_type#

get no. of atoms of each type in a list format

get_neach_type(inp)#

get number of list entries of each type

Returns

list of integers for each type of atoms specifying their number

get_poscar()#

** get_poscar is deprecated; use read_poscar instead!! **

read poscar file present in the current dir or in the location specified.

parameters

crysatal lattice object

return
if l_SelectDynamics:

return self.tau_cartesian, self.real_volume, self.LV1, self.LV2, self.LV3,self.atm_type, self.natm_type, self.natoms, self.atomFix, self.atomMove

else:

return self.tau_cartesian, self.real_volume, self.LV1, self.LV2, self.LV3,self.atm_type, self.natm_type, self.natoms

property get_rVolume#

get real space lattice volume

get_reciprocal_lattice()#

return the reciprocal lattice vectors

input: real space lattice vectors: LV1, LV2, LV3

output: reciprocal space lattice vectors: b1, b2, b3
  • note: a factor of 2pi is included in b1, b2, and b3

get_selectivePOSCAR(ldisp=None, disp_atoms_num=None)#

get displaced poscar with selective tag and atomic positions tagged as T T T or F F F

input:

logical: ldisp, True/False (displace all atoms or dont displace any of the atoms)

list: disp_atoms_num; atm numbers which are to be displaced;

numbering starts from 1 .. to natoms ….TODO YET

output:

POSCAR file with selective dynamics tags

get_unique_list(inp)#

get unique elements of list

Returns

string for each type of atoms

property is_cartesian#

check if atom positions in cartesian coordinates

property is_crystal#

check if atom positions in crytal coordinates

property is_selective_dynamics#

check whether selective dynamics True or False

read_poscar(verbosity=None)#

read poscar file present in the current dir or in the location specified.

parameters

crysatal lattice object

return
if l_SelectDynamics:

return self.tau_cartesian, self.real_volume, self.LV1, self.LV2, self.LV3,self.atm_type, self.natm_type, self.natoms, self.atomFix, self.atomMove

else:

return self.tau_cartesian, self.real_volume, self.LV1, self.LV2, self.LV3,self.atm_type, self.natm_type, self.natoms

reciprocal_lattice()#

method to calculate the reciprocal lattice vectors

input: real space lattice vectors: LV1, LV2, LV3 output: reciprocal space lattice vectors: b1, b2, b3

  • note: a factor of 2pi is included in b1, b2, and b3

property to_cartesian#

get atomic position in cartesin cooridnates

property to_crystal#

get atomic position in crystal cooridnates

esta.vaspBag.inout.diameter_or_area_nanowire module#

Calculate the diametere or area/volume of a nanowire

Parameters/Input: (string) default string taken is “POSCAR”

Returns/output: (float) diameter

esta.vaspBag.inout.diameter_or_area_nanowire.diameter_nanowire(tau_cartesian, periodicity_direction)#

esta.vaspBag.inout.get_labelling_atoms module#

esta.vaspBag.inout.get_labelling_atoms.get_all_atoms_lebels(ffile)#

by reading POSCAR, find the atomic labels of the atoms and total no of atoms

input: POSCAR file in current dir.

output:
  • list of strings of atomic lebels of all atoms according to the numbering of atoms in

POSCAR file - integer for total number of atoms in the POSCAR file

author: sk email: sonukumar.physics@gmail.com

esta.vaspBag.inout.lattice module#

lattice class to define unit cell and lattice parameters

class esta.vaspBag.inout.lattice.lattice#

Bases: object

esta.vaspBag.inout.old_reciprocal_lattice module#

method to calculate the reciprocal lattice vectors

esta.vaspBag.inout.old_reciprocal_lattice.reciprocal_lattice(LV1, LV2, LV3)#

input: real space lattice vectors: LV1, LV2, LV3 output: reciprocal space lattice vectors: b1, b2, b3

  • note: a factor of 2pi is included in b1, b2, and b3

esta.vaspBag.inout.read_eigenval module#

esta.vaspBag.inout.read_eigenval.read_eigenval()#

read EIGENVAL file and find the band gap and other required items …

format of eigenval file : #1 108 108 1 1 #2 0.5831055E+02 0.1906800E-08 0.1906800E-08 0.2000000E-08 0.5000000E-15 #3 1.000000000000000E-004 #4 CAR #5 unknown system #6 648 13 388 #7 #8 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.2777778E-01

1 -16.615104 1.000000 2 -16.236469 1.000000 3 -16.236325 1.000000 4 -16.236284 1.000000

the numbers are 1) # of ions , # of ions, the number of loops after which the averaged pair correlation functions and the DOS are written, ISPIN 2) the volume of the cell (in Ã…^3) and the lattice parameters of the box (in m) 3) T 4) the string ‘CAR’ 5) the header 6) # of electrons, # of k-points, #of bands 7) the k-point and its weight

NOTE: what about magnetic systems or SOC calculations?

esta.vaspBag.inout.read_eigenval_file module#

esta.vaspBag.inout.read_eigenval_file.read_eigenval()#

read EIGENVAL file and find the band gap and other required items …

format of eigenval file : #1 108 108 1 1 #2 0.5831055E+02 0.1906800E-08 0.1906800E-08 0.2000000E-08 0.5000000E-15 #3 1.000000000000000E-004 #4 CAR #5 unknown system #6 648 13 388 #7 #8 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.2777778E-01

1 -16.615104 1.000000 2 -16.236469 1.000000 3 -16.236325 1.000000 4 -16.236284 1.000000

the numbers are 1) # of ions , # of ions, the number of loops after which the averaged pair correlation functions and the DOS are written, ISPIN 2) the volume of the cell (in Ã…^3) and the lattice parameters of the box (in m) 3) T 4) the string ‘CAR’ 5) the header 6) # of electrons, # of k-points, #of bands 7) the k-point and its weight

NOTE: what about magnetic systems or SOC calculations?

esta.vaspBag.inout.read_outcar module#

esta.vaspBag.inout.read_outcar.read_outcar()#

read outcar file

esta.vaspBag.inout.read_outcar_file module#

esta.vaspBag.inout.read_outcar_file.read_outcar()#

read outcar file

esta.vaspBag.inout.read_poscar module#

routine to read POSCAR file (VASP)

Input: default POSCAR file is taken from current dir.

returns

return tau_cartesian, real_volume, LV1, LV2, LV3, atomFix, atomMove else:

return tau_cartesian, real_volume, LV1, LV2, LV3

rtype

if selective dynamics

Note

modification done to coordinates if -ve by more than 1. unit of angstrom: see if there is a better way to handle it

esta.vaspBag.inout.read_poscar.get_poscar(location)#

method to read poscar file

Input: location of “POSCAR” file

Returns

return tau_cartesian, real_volume, LV1, LV2, LV3, atm_type, natom_type, natoms, atomFix, atomMove else:

return tau_cartesian, real_volume, LV1, LV2, LV3, atm_type, natom_type, natoms

Return type

if selective dynamics

esta.vaspBag.inout.reciprocal_lattice module#

method to calculate the reciprocal lattice vectors

esta.vaspBag.inout.reciprocal_lattice.reciprocal_lattice(LV1, LV2, LV3)#

input: real space lattice vectors: LV1, LV2, LV3 output: reciprocal space lattice vectors: b1, b2, b3

  • note: a factor of 2pi is included in b1, b2, and b3

esta.vaspBag.inout.shift_to_origin module#

esta.vaspBag.inout.xml_vasp module#

esta.vaspBag.inout.xml_vasp.read_vasp_xml(filename='vasprun.xml', index=- 1)#

Parse vasprun.xml file of vasp

Input: string: ‘vasprun.xml’ Returns: array: unit cell,

array: atomic positions, array: forces

Taken from ase – to be rewritten again

esta.vaspBag.inout.xml_vasp_ASE module#

This module contains functionality for reading and writing an ASE Atoms object in VASP POSCAR format.

esta.vaspBag.inout.xml_vasp_ASE.atomtypes_outpot(posfname, numsyms)#

Try to retreive chemical symbols from OUTCAR or POTCAR

If getting atomtypes from the first line in POSCAR/CONTCAR fails, it might be possible to find the data in OUTCAR or POTCAR, if these files exist.

posfname – The filename of the POSCAR/CONTCAR file we’re trying to read

numsyms – The number of symbols we must find

esta.vaspBag.inout.xml_vasp_ASE.get_atomtypes(fname)#

Given a file name, get the atomic symbols.

The function can get this information from OUTCAR and POTCAR format files. The files can also be compressed with gzip or bzip2.

esta.vaspBag.inout.xml_vasp_ASE.get_atomtypes_from_formula(formula)#

Return atom types from chemical formula (optionally prepended with and underscore).

esta.vaspBag.inout.xml_vasp_ASE.read_vasp(filename='CONTCAR')#

Import POSCAR/CONTCAR type file.

Reads unitcell, atom positions and constraints from the POSCAR/CONTCAR file and tries to read atom types from POSCAR/CONTCAR header, if this fails the atom types are read from OUTCAR or POTCAR file.

esta.vaspBag.inout.xml_vasp_ASE.read_vasp_out(filename='OUTCAR', index=- 1)#

Import OUTCAR type file.

Reads unitcell, atom positions, energies, and forces from the OUTCAR file and attempts to read constraints (if any) from CONTCAR/POSCAR, if present.

esta.vaspBag.inout.xml_vasp_ASE.read_vasp_xdatcar(filename, index=- 1)#

Import XDATCAR file

Reads all positions from the XDATCAR and returns a list of Atoms objects. Useful for viewing optimizations runs from VASP5.x

Constraints ARE NOT stored in the XDATCAR, and as such, Atoms objects retrieved from the XDATCAR will not have constraints set.

esta.vaspBag.inout.xml_vasp_ASE.read_vasp_xml(filename='vasprun.xml', index=- 1)#

Parse vasprun.xml file.

Reads unit cell, atom positions, energies, forces, and constraints from vasprun.xml file

esta.vaspBag.inout.xml_vasp_ASE.write_vasp(filename, atoms, label='', direct=False, sort=None, symbol_count=None, long_format=True, vasp5=False)#

Method to write VASP position (POSCAR/CONTCAR) files.

Writes label, scalefactor, unitcell, # of various kinds of atoms, positions in cartesian or scaled coordinates (Direct), and constraints to file. Cartesian coordiantes is default and default label is the atomic species, e.g. ‘C N H Cu’.

esta.vaspBag.inout.xml_vasp_hse module#

esta.vaspBag.inout.xml_vasp_hse.read_vasp_xml(filename='vasprun.xml', index=- 1)#

Parse vasprun.xml file of vasp

Input: string: ‘vasprun.xml’ Returns: array: unit cell,

array: atomic positions, array: forces

Taken from ase – to be rewritten again

Module contents#