Advertisement
UHLI_REMO

Media:get-smearing-pdos.txt (pdos1)

Nov 26th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. #! /usr/bin/env python
  2. #---------------------------------------------------
  3. # get-smearing-pdos.py: read one or a pair alpha,
  4. # beta spin files with the cp2k pdos format and
  5. # return a file "smeared.dat" with the Smeared DOS
  6. #---------------------------------------------------
  7. # Usage: ./get-smearing-pdos.py ALPHA.pdos BETA.pdos
  8. # or
  9. # ./get-smearing-pdos.py file.pdos
  10. #
  11. # Output:
  12. # smeared.dat: smeared DOS
  13. #---------------------------------------------------
  14. # Todo:
  15. # - Atomatic name generation of output file
  16. # - Move the algorithm to the module pdos
  17. # - Implement printing of d orbitals
  18. # - ...
  19. #---------------------------------------------------
  20. # Author: Juan Garcia e-mail: jcgarcia [at] wpi.edu
  21. # Date: 11-12-2012
  22. #---------------------------------------------------
  23.  
  24. import sys
  25. from pdos import *
  26.  
  27.  
  28. if len(sys.argv) == 2:
  29.  
  30. infilename = sys.argv[1]
  31.  
  32. alpha = pdos(infilename)
  33. npts = len(alpha.e)
  34. alpha_smeared = alpha.smearing(npts,0.2)
  35. eigenvalues = np.linspace(min(alpha.e), max(alpha.e),npts)
  36.  
  37. g = open('smeared.dat','w')
  38. for i,j in zip(eigenvalues, alpha_smeared):
  39. t = str(i).ljust(15) + ' ' + str(j).ljust(15) + '\n'
  40. g.write(t)
  41.  
  42. elif len(sys.argv) == 3:
  43.  
  44. infilename1 = sys.argv[1]
  45. infilename2 = sys.argv[2]
  46.  
  47. alpha = pdos(infilename1)
  48. beta = pdos(infilename2)
  49. npts = len(alpha.e)
  50. alpha_smeared = alpha.smearing(npts,0.2)
  51. beta_smeared = beta.smearing(npts,0.2)
  52. totalDOS = sum_tpdos(alpha_smeared, beta_smeared)
  53.  
  54. eigenvalues = np.linspace(min(alpha.e), max(alpha.e),npts)
  55.  
  56. g = open('smeared.dat','w')
  57. for i,j in zip(eigenvalues, totalDOS):
  58. t = str(i).ljust(15) + ' ' + str(j).ljust(15) + '\n'
  59. g.write(t)
  60.  
  61. else:
  62. print ' Wrong number of arguments!'
  63. print ' usage:'
  64. print ' ./get-smearing-pdos.py ALPHA.pdos'
  65. print ' ./get-smearing-pdos.py ALPHA.pdos BETA.pdos'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement