3
0
mirror of https://github.com/triqs/dft_tools synced 2024-07-12 14:14:41 +02:00

Reading misc_input files only if present

This commit is contained in:
Manuel Zingl 2015-02-20 15:15:17 +01:00
parent c19babd33a
commit 8db46b16b5

View File

@ -395,7 +395,7 @@ class Wien2kConverter(ConverterTools):
band_window = [numpy.zeros((n_k, 2), dtype=int) for isp in range(SP + 1 - SO)] band_window = [numpy.zeros((n_k, 2), dtype=int) for isp in range(SP + 1 - SO)]
for isp, f in enumerate(files): for isp, f in enumerate(files):
if not os.path.exists(f): raise IOError, "convert_misc_input: File %s does not exist" %f if os.path.exists(f):
mpi.report("Reading input from %s..."%f) mpi.report("Reading input from %s..."%f)
R = ConverterTools.read_fortran_file(self, f, self.fortran_to_replace) R = ConverterTools.read_fortran_file(self, f, self.fortran_to_replace)
@ -415,7 +415,7 @@ class Wien2kConverter(ConverterTools):
# lattice_constants: unit cell parameters in a. u. # lattice_constants: unit cell parameters in a. u.
# lattice_angles: unit cell angles in rad # lattice_angles: unit cell angles in rad
if not (os.path.exists(self.struct_file)) : raise IOError, "convert_misc_input: File %s does not exist" %self.struct_file if (os.path.exists(self.struct_file)):
mpi.report("Reading input from %s..."%self.struct_file) mpi.report("Reading input from %s..."%self.struct_file)
with open(self.struct_file) as R: with open(self.struct_file) as R:
@ -433,7 +433,7 @@ class Wien2kConverter(ConverterTools):
####################################### #######################################
# rot_symmetries: matrix representation of all (space group) symmetry operations # rot_symmetries: matrix representation of all (space group) symmetry operations
if not (os.path.exists(self.outputs_file)) : raise IOError, "convert_misc_input: File %s does not exist" %self.outputs_file if (os.path.exists(self.outputs_file)):
mpi.report("Reading input from %s..."%self.outputs_file) mpi.report("Reading input from %s..."%self.outputs_file)
rot_symmetries = [] rot_symmetries = []
@ -457,7 +457,6 @@ class Wien2kConverter(ConverterTools):
except IOError: except IOError:
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 (misc_subgrp in ar): ar.create_group(misc_subgrp) if not (misc_subgrp in ar): ar.create_group(misc_subgrp)