Header Ads Widget

Ab initio Calculations Using Q-Espresso Code

Last Posts

10/recent/ticker-posts

How to do lattice parameter optimization using ASE interface

 

 

The ASE (Atomic Simulation Environment)  interface s a set of tools and Python modules for setting up, manipulating, running, visualizing and analyzing atomistic simulations. To install it click on the following link:

How to download and install the Atomic Simulation Environment ASE

The ASE interface create the input file and do the calculation using only a python script.

We will take the example of NaCl

First we need to add the path for vasp executable and path for pseudopotentials as follows:

#-----QE-ase Path---------------

export ASE_ESPRESSO_COMMAND="/home/algerien1970/abinitio/q-e-qe-6.8/bin/pw.x -in PREFIX.pwi > PREFIX.pwo"

export pseudo_dir="/home/algerien1970/abinitio/q-e-qe-6.8/pseudo"
#-----------------------------------

 

The directoriy pseudo will contain the psudopotentials. For NaCl we need the files

na_lda_v1.5.uspp.F.UPF

 cl_lda_v1.4.uspp.F.UPF


Calculation

algerien1970@linux-kq57:~/abinitio/vasp-ase-tutorials/NaCl> conda activate ase
(ase) algerien1970@linux-kq57:~/abinitio/vasp-ase-tutorials> mkdir NaCl-Opt 

(ase) algerien1970@linux-kq57:~/abinitio/vasp-ase-tutorials> cd NaCl-Opt

 

NaCl-Opt.py   script

from ase.build import bulk
from ase.calculators.espresso import Espresso
from ase.constraints import UnitCellFilter
from ase.optimize import LBFGS

pseudopotentials = {'Na': 'na_lda_v1.5.uspp.F.UPF',
'Cl': 'cl_lda_v1.4.uspp.F.UPF'}


rocksalt = bulk('NaCl', crystalstructure='rocksalt', a=6.0)
calc = Espresso(pseudopotentials=pseudopotentials,
tstress=True, tprnfor=True, kpts=(3, 3, 3), ecutwfc=64, ecutrho=576)



rocksalt.calc = calc

ucf = UnitCellFilter(rocksalt)
opt = LBFGS(ucf)
opt.run(fmax=0.005)

# cubic lattic constant
print((8*rocksalt.get_volume()/len(rocksalt))**(1.0/3.0))


(ase) algerien1970@linux-kq57:~/abinitio/vasp-ase-tutorials/Si> chmod +x NaCl-Opt.py

(ase) algerien1970@linux-kq57:~/abinitio/vasp-ase-tutorials/mg-hcp> python NaCl-Opt.py

       Step     Time          Energy         fmax
*Force-consistent energies used in optimization.
LBFGS: 0 18:41:32 -1750.616720* 0.8027
LBFGS: 1 18:41:54 -1750.642194* 0.7579
LBFGS: 2 18:42:10 -1750.828514* 0.2982
LBFGS: 3 18:42:30 -1750.840000* 0.1215
LBFGS: 4 18:42:48 -1750.843633* 0.0184
LBFGS: 5 18:43:05 -1750.843750* 0.0019

5.49230453123335

 

 

 

 

 

Post a Comment

0 Comments