Last active
          April 17, 2016 10:15 
        
      - 
      
- 
        Save Asif-Iqbal-Bhatti/b1061b59f0bfb46b762a862781794433 to your computer and use it in GitHub Desktop. 
    Extract Hirshfels volume from FHI-aim output file to append in the last column of inputfile for Many body theory implemented in FHI-aim
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import sys | |
| import subprocess | |
| import os | |
| ##usage: python Hirshfeld_extract.py FHI-aim_outputfile | |
| print "Writing to a file..." | |
| f = open('hir.dat', 'w') | |
| print "Name of the file: ", f.name | |
| file = open(sys.argv[1]) | |
| while True: | |
| line = file.readline() | |
| gap = line.strip(" | ") | |
| tpl = line.split(":") | |
| if tpl[0] == " | Free atom volume ": | |
| var1 = tpl[1] | |
| if tpl[0] == " | Hirshfeld volume ": | |
| var2 = tpl[1] | |
| var3 = float(var2)/float(var1) | |
| print float(var1), float(var2), var3 | |
| f.write ('%8f %8f %8f\n' % (float(var1), float(var2), var3) ) | |
| if not line: | |
| break | |
| print "Writing to a file finished." | |
| f.close() | |
| #After extracting run the command below | |
| s = "cat hir.dat |tail -48 | awk '{print $3}' > relativeHirshfeld.dat" | |
| subprocess.call(s, shell=True) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Extract the Hirshfeld volume from FHI-aim output file.