mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 20:34:38 +01:00
Modify HDFArchive calls to 'r' where possible to handle corrupt files
This commit is contained in:
parent
b2c3d6ddf6
commit
79b4b426a8
@ -512,7 +512,7 @@ class Wien2kConverter(ConverterTools):
|
|||||||
raise "convert_misc_input: reading file %s failed" %self.outputs_file
|
raise "convert_misc_input: reading file %s failed" %self.outputs_file
|
||||||
|
|
||||||
# Save it to the HDF:
|
# Save it to the HDF:
|
||||||
ar=HDFArchive(self.hdf_file,'a')
|
ar = HDFArchive(self.hdf_file,'a')
|
||||||
if not (self.misc_subgrp in ar): ar.create_group(self.misc_subgrp)
|
if not (self.misc_subgrp in ar): ar.create_group(self.misc_subgrp)
|
||||||
for it in things_to_save: ar[self.misc_subgrp][it] = locals()[it]
|
for it in things_to_save: ar[self.misc_subgrp][it] = locals()[it]
|
||||||
del ar
|
del ar
|
||||||
@ -660,7 +660,7 @@ class Wien2kConverter(ConverterTools):
|
|||||||
# Reading done!
|
# Reading done!
|
||||||
|
|
||||||
# Save it to the HDF:
|
# Save it to the HDF:
|
||||||
ar=HDFArchive(self.hdf_file,'a')
|
ar = HDFArchive(self.hdf_file,'a')
|
||||||
if not (symm_subgrp in ar): ar.create_group(symm_subgrp)
|
if not (symm_subgrp in ar): ar.create_group(symm_subgrp)
|
||||||
things_to_save = ['n_symm','n_atoms','perm','orbits','SO','SP','time_inv','mat','mat_tinv']
|
things_to_save = ['n_symm','n_atoms','perm','orbits','SO','SP','time_inv','mat','mat_tinv']
|
||||||
for it in things_to_save: ar[symm_subgrp][it] = locals()[it]
|
for it in things_to_save: ar[symm_subgrp][it] = locals()[it]
|
||||||
|
@ -160,7 +160,7 @@ class SumkDFT:
|
|||||||
subgroup_present = 0
|
subgroup_present = 0
|
||||||
|
|
||||||
if mpi.is_master_node():
|
if mpi.is_master_node():
|
||||||
ar = HDFArchive(self.hdf_file,'a')
|
ar = HDFArchive(self.hdf_file,'r')
|
||||||
if subgrp in ar:
|
if subgrp in ar:
|
||||||
subgroup_present = True
|
subgroup_present = True
|
||||||
# first read the necessary things:
|
# first read the necessary things:
|
||||||
@ -225,7 +225,7 @@ class SumkDFT:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if not (mpi.is_master_node()): return # do nothing on nodes
|
if not (mpi.is_master_node()): return # do nothing on nodes
|
||||||
ar = HDFArchive(self.hdf_file,'a')
|
ar = HDFArchive(self.hdf_file,'r')
|
||||||
if not subgrp in ar: mpi.report("Loading %s failed!"%subgrp)
|
if not subgrp in ar: mpi.report("Loading %s failed!"%subgrp)
|
||||||
list_to_return = []
|
list_to_return = []
|
||||||
for it in things_to_load:
|
for it in things_to_load:
|
||||||
|
@ -598,7 +598,7 @@ class SumkDFTTools(SumkDFT):
|
|||||||
|
|
||||||
# Check if wien converter was called and read transport subgroup form hdf file
|
# Check if wien converter was called and read transport subgroup form hdf file
|
||||||
if mpi.is_master_node():
|
if mpi.is_master_node():
|
||||||
ar = HDFArchive(self.hdf_file, 'a')
|
ar = HDFArchive(self.hdf_file, 'r')
|
||||||
if not (self.transp_data in ar): raise IOError, "transport_distribution: No %s subgroup in hdf file found! Call convert_transp_input first." %self.transp_data
|
if not (self.transp_data in ar): raise IOError, "transport_distribution: No %s subgroup in hdf file found! Call convert_transp_input first." %self.transp_data
|
||||||
self.read_transport_input_from_hdf()
|
self.read_transport_input_from_hdf()
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class Symmetry:
|
|||||||
|
|
||||||
if mpi.is_master_node():
|
if mpi.is_master_node():
|
||||||
#Read the stuff on master:
|
#Read the stuff on master:
|
||||||
ar = HDFArchive(hdf_file,'a')
|
ar = HDFArchive(hdf_file,'r')
|
||||||
if subgroup is None:
|
if subgroup is None:
|
||||||
ar2 = ar
|
ar2 = ar
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user