7
$\begingroup$

I am considering using ASE to translate my old work into a Python script. I already have the INCAR and POSCAR KPOINTS files. Is it possible to let ASE read these files and generate Python scripts that include the key information?

For example, I have an INCAR file like:

INCAR:

Global Parameters
ISTART =  1            (Read existing wavefunction; if there)
ISPIN  =  2            (Non-Spin polarised DFT)
# ICHARG =  11         (Non-self-consistent: GGA/LDA band structures)
LREAL  = .FALSE.       (Projection operators: automatic)
ENCUT  =  520        (Cut-off energy for plane wave basis set, in eV)
PREC   =  Normal       (Precision level)
LWAVE  = .TRUE.        (Write WAVECAR or not)
LCHARG = .TRUE.        (Write CHGCAR or not)
ADDGRID= .TRUE.        (Increase grid; helps GGA convergence)
# LVTOT  = .TRUE.      (Write total electrostatic potential into LOCPOT or not)
# LVHAR  = .TRUE.      (Write ionic + Hartree electrostatic potential into LOCPOT or not)
# NELECT =             (No. of electrons: charged cells; be careful)
# LPLANE = .TRUE.      (Real space distribution; supercells)
# NPAR   = 4           (Max is no. nodes; don't set for hybrids)
# Nwrite = 2           (Medium-level output)
# KPAR   = 2           (Divides k-grid into separate groups)
# NGX    = 500         (FFT grid mesh density for nice charge/potential plots)
# NGY    = 500         (FFT grid mesh density for nice charge/potential plots)
# NGZ    = 500         (FFT grid mesh density for nice charge/potential plots)
 
Static Calculation
ISMEAR =  0            (gaussian smearing method)
SIGMA  =  0.05         (please check the width of the smearing)
LORBIT =  11           (PAW radii for projected DOS)
NEDOS  =  2001         (DOSCAR points)
NELM   =  60           (Max electronic SCF steps)
EDIFF  =  1E-04        (SCF energy convergence; in eV)
 

I'd like to translate this INCAR into something like:

from ase.build import bulk
from ase.calculators.vasp import Vasp

si = bulk('Si')

mydir = 'bandstructure'    # Directory where we will do the calculations

# Make self-consistent ground state
calc = Vasp(kpts=(4, 4, 4), directory=mydir)

si.calc = calc
si.get_potential_energy()  # Run the calculation

# Non-SC calculation along band path
kpts = {'path': 'WGX',     # The BS path
        'npoints': 30}     # Number of points along the path

calc.set(isym=0,           # Turn off kpoint symmetry reduction
         icharg=11,        # Non-SC calculation
         kpts=kpts)

# Run the calculation
si.get_potential_energy()

```
$\endgroup$
2
  • $\begingroup$ Can you give some additional details? Do you need to do this once or many times? $\endgroup$ Commented Jan 18, 2022 at 5:33
  • $\begingroup$ @TristanMaxson,I just add some example files. $\endgroup$
    – Jack
    Commented Jan 18, 2022 at 9:42

1 Answer 1

8
+200
$\begingroup$

There seems to be a function to read INCAR files in ASE however in the code it mentions that the functions "are under early constructions". You can give it a try though and it might work well enough:

from ase.calculators.vasp import Vasp
calc = Vasp()
calc.read_incar('INCAR')

Alternatively, you could move over to Pymatgen which has a more thorough pipeline to parse Vasp files: https://pymatgen.org/pymatgen.io.vasp.inputs.html

Good luck!

-Peter

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .