Created
November 7, 2017 17:56
-
-
Save mhoffman/b20e81b9cc2839f1a30ab53ad66f9d3a to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import os | |
import os.path | |
import optparse | |
import tempfile | |
parser = optparse.OptionParser(usage='%script <cube-filename>') | |
options, args = parser.parse_args() | |
if not args: | |
raise UserWarning("Expected cube file as first argument.") | |
cube_filename = args[0] | |
seed = os.path.splitext(cube_filename)[0] | |
os.system('bader -vac off {cube_filename}'.format(**locals())) | |
if os.path.exists('ACF.dat') and os.path.exists('BCF.dat'): | |
with open('{seed}.bader'.format(**locals()), 'w') as outfile: | |
outfile.write('########## BADER ATOMIC CHARGES for {seed}\n'.format(**locals())) | |
with open('ACF.dat') as infile: | |
outfile.write(infile.read()) | |
outfile.write('\n\n########## BADER ATOMIC VOLUMES for {seed}\n'.format(**locals())) | |
with open('BCF.dat') as infile: | |
outfile.write(infile.read()) | |
os.remove('BCF.dat') | |
os.remove('ACF.dat') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment