3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 20:34:38 +01:00
dft_tools/python/triqs_dft_tools/clear_h5_output.py
Alexander Hampel 11d394fd5b synchronize dfttools with app4triqs structure
* moved the plovasp C++ code to c++/triqs_dft_tools/converters/vasp
* added global header triqs_dft_tools/triqs_dft_tools.hpp
* python dir based on single cmakelist file
* registered C++ tests for plovasp
* corrected imports for py3 tests for plovasp
* corrected block order in sigma_from_file and srvo3_Gloc
* exchanged ref files for sigma_from_file, srvo3_Gloc, SrVO3.ref.h5
* moved vasp converter bash scripts from dir shells to bin dir
2020-06-10 17:45:53 +02:00

27 lines
650 B
Python

import h5py
import sys
import subprocess
if len(sys.argv) < 2:
print("Usage: python clear_h5_output.py archive")
sys.exit()
print("""
This script is to remove any SumkDFT generated output from the h5 archive
and to restore it to the original post-converter state.
""")
filename = sys.argv[1]
A = h5py.File(filename)
for group in ['dmft_output', 'user_data']:
if group in A:
del(A[group])
A.close()
# Repack to reclaim disk space
retcode = subprocess.call(["h5repack", "-i%s" % filename, "-otemphgfrt.h5"])
if retcode != 0:
print("h5repack failed!")
else:
subprocess.call(["mv", "-f", "temphgfrt.h5", "%s" % filename])