Pos2pot.py: Difference between revisions

From Wiki
Jump to navigation Jump to search
Rgarcia (talk | contribs)
mNo edit summary
Rgarcia (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
go back to [[Main Page]], [[Group Pages]], [[Núria López and Group]]
go back to [[Main Page]], [[Group Pages]], [[Núria López and Group]], [[Scripts_for_VASP]]


This script reads your POSCAR and generates POTCAR with pseudopotentials recommended by VASP which are on the page: [1]
This script reads your POSCAR and generates POTCAR with pseudopotentials recommended by VASP which are on the page: [https://cms.mpi.univie.ac.at/vasp/vasp/Recommended_PAW_potentials_DFT_calculations_using_vasp_5_2.html]


This version works with in conjunction with [[potgenpbe5.3]] which you can change in line 116 if you prefer some other version.
This version works with in conjunction with [[potgenpbe5.3]] which you can change in line 116 if you prefer some other version.


script: pos2pot.py
'''Instructions''': Put it in your ~/bin/ folder ($ vim ~/bin/pos2pot.py) and make it executable ($ chmod +x pos2pot.py).


'''pos2pot.py'''
  #!/usr/bin/env python  
  #!/usr/bin/env python  
  # by Konstantin
  # by Konstantin
Line 135: Line 137:
  print "***"*10
  print "***"*10
  subprocess.call("sed -n 6p POSCAR", shell = True)
  subprocess.call("sed -n 6p POSCAR", shell = True)
go back to [[Main Page]], [[Group Pages]], [[Núria López and Group]], [[Scripts_for_VASP]]

Latest revision as of 10:50, 7 November 2019

go back to Main Page, Group Pages, Núria López and Group, Scripts_for_VASP

This script reads your POSCAR and generates POTCAR with pseudopotentials recommended by VASP which are on the page: [1]

This version works with in conjunction with potgenpbe5.3 which you can change in line 116 if you prefer some other version.

Instructions: Put it in your ~/bin/ folder ($ vim ~/bin/pos2pot.py) and make it executable ($ chmod +x pos2pot.py).


pos2pot.py

#!/usr/bin/env python 
# by Konstantin
# adapted from shifu Qiang
# 7 Avg 2019
#################################################################################
#  									       	 #
# Read your POSCAR and generate POTCAR with pseudopotentials redomended by VASP #
#										 #	
#################################################################################

import subprocess
print "***"*10
print "Removing OLD POTCAR..."
print "***"*10
subprocess.call("rm POTCAR", shell = True)
print "Generating NEW POTCAR..."
print "***"*10
f = open ("POSCAR", mode='r')
pos_elem = f.readlines()[5].split()
elem = ""
for i in pos_elem:
 if i == "Li":
  elem += "Li_sv "
 elif i == "Na":
  elem += "Na_pv "
 elif i == "K":
  elem += "K_sv "
 elif i == "Ca":
  elem += "Ca_sv "
 elif i == "Sc":
  elem += "Sc_sv "
 elif i == "Ti":
  elem += "Ti_sv "
 elif i == "V":
  elem += "V_sv "
 elif i == "Cr":
  elem += "Cr_pv "
 elif i == "Mn":
  elem += "Mn_pv "
 elif i == "Ga":
  elem += "Ga_d "
 elif i == "Ge":
  elem += "Ge_d "
 elif i == "Rb":
  elem += "Rb_sv "
 elif i == "Sr":
  elem += "Sr_sv "
 elif i == "Y":
  elem += "Y_sv "
 elif i == "Zr":
  elem += "Zr_sv "
 elif i == "Nb":
  elem += "Nb_sv "
 elif i == "Mo":
  elem += "Mo_sv "
 elif i == "Tc":
  elem += "Tc_pv "
 elif i == "Ru":
  elem += "Ru_pv "
 elif i == "Rh":
  elem += "Rh_pv "
 elif i == "In":
  elem += "In_d "
 elif i == "Sn":
  elem += "Sn_d "
 elif i == "Cs":
  elem += "Cs_sv "
 elif i == "Ba":
  elem += "Ba_sv "
 elif i == "Pr":
  elem += "Pr_3 "
 elif i == "Nd":
  elem += "Nd_3 "
 elif i == "Pm":
  elem += "Pm_3 "
 elif i == "Sm":
  elem += "Sm_3 "
 elif i == "Eu":
  elem += "Eu_2 "
 elif i == "Gd":
  elem += "Gd_3 "
 elif i == "Tb":
  elem += "Tb_3 "
 elif i == "Dy":
  elem += "Dy_3 "
 elif i == "Ho":
  elem += "Ho_3 "
 elif i == "Er":
  elem += "Er_3 "
 elif i == "Tm":
  elem += "Tm_3 "
 elif i == "Yb":
  elem += "Yb_2 "
 elif i == "Lu":
  elem += "Lu_3 "
 elif i == "Hf":
  elem += "Hf_pv "
 elif i == "Ta":
  elem += "Ta_pv "
 elif i == "W":
  elem += "W_pv "
 elif i == "Tl":
  elem += "Tl_d "
 elif i == "Pb":
  elem += "Pb_d "
 elif i == "Bi":
  elem += "Bi_d "
 elif i == "Po":
  elem += "Po_d "
 elif i == "At":
  elem += "At_d "
 elif i == "Fr":
  elem += "Fr_sv "
 elif i == "Ra":
  elem += "Ra_sv "
 else:
  elem = elem + i + " "
subprocess.call("potgenpbe5.3 " + elem, shell = True)
f.close()
print "Done"
print "***"*10
print 'NEW POTCAR containes .....'
print "***"*10
subprocess.call("grep TIT POTCAR| awk '{print $4}' | xargs -n100", shell = True)
print "***"*10
print "Elements in POSCAR" 
print "***"*10
subprocess.call("sed -n 6p POSCAR", shell = True)

go back to Main Page, Group Pages, Núria López and Group, Scripts_for_VASP