fix: read_input_from_hdf error check was not working

This commit is contained in:
Alexander Hampel 2023-03-23 17:40:13 -04:00
parent 522f67c119
commit 77ca9b614b
1 changed files with 30 additions and 23 deletions

View File

@ -341,10 +341,11 @@ class SumkDFTTools(SumkDFT):
things_to_read = ['n_parproj', 'proj_mat_all',
'rot_mat_all', 'rot_mat_all_time_inv']
value_read = self.read_input_from_hdf(
subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.parproj_data, things_to_read=things_to_read)
if not value_read:
return value_read
if len(values_not_read) > 0 and mpi.is_master_node:
raise ValueError(
'ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
if self.symm_op:
self.symmpar = Symmetry(self.hdf_file, subgroup=self.symmpar_data)
@ -489,15 +490,17 @@ class SumkDFTTools(SumkDFT):
if (pdos):
things_to_read = ['maxlm', 'bc']
value_read = self.read_input_from_hdf(
subgrp=self.bc_data, things_to_read=things_to_read)
if not value_read:
return value_read
subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.bc_data, things_to_read=things_to_read)
if len(values_not_read) > 0 and mpi.is_master_node:
raise ValueError(
'ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
things_to_read = ['n_atoms']
value_read = self.read_input_from_hdf(
subgrp=self.symmcorr_data, things_to_read=things_to_read)
if not value_read:
return value_read
subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.symmcorr_data, things_to_read=things_to_read)
if len(values_not_read) > 0 and mpi.is_master_node:
raise ValueError(
'ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
if mesh is None or with_Sigma:
assert isinstance(self.mesh, MeshReFreq), "mesh must be given if self.mesh is a MeshImFreq"
@ -658,10 +661,11 @@ class SumkDFTTools(SumkDFT):
#read in the energy contour energies and projectors
things_to_read = ['n_k','bmat','symlat','n_symm','vkl',
'n_orbitals', 'proj_mat', 'hopping']
value_read = self.read_input_from_hdf(
subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.fs_data, things_to_read=things_to_read)
if not value_read:
return value_read
if len(values_not_read) > 0 and mpi.is_master_node:
raise ValueError(
'ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
if with_Sigma is True or mesh is None:
assert isinstance(self.mesh, MeshReFreq), "SumkDFT.mesh must be real if with_Sigma is True or mesh is not given"
@ -827,16 +831,18 @@ class SumkDFTTools(SumkDFT):
things_to_read = ['n_k', 'n_orbitals', 'proj_mat',
'hopping', 'n_parproj', 'proj_mat_all']
value_read = self.read_input_from_hdf(
subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.bands_data, things_to_read=things_to_read)
if not value_read:
return value_read
if len(values_not_read) > 0 and mpi.is_master_node:
raise ValueError(
'ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
if ishell is not None:
things_to_read = ['rot_mat_all', 'rot_mat_all_time_inv']
value_read = self.read_input_from_hdf(
subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.parproj_data, things_to_read=things_to_read)
if not value_read:
return value_read
if len(values_not_read) > 0 and mpi.is_master_node:
raise ValueError(
'ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
if mu is None:
mu = self.chemical_potential
@ -966,10 +972,11 @@ class SumkDFTTools(SumkDFT):
things_to_read = ['dens_mat_below', 'n_parproj',
'proj_mat_all', 'rot_mat_all', 'rot_mat_all_time_inv']
value_read = self.read_input_from_hdf(
subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.parproj_data, things_to_read=things_to_read)
if not value_read:
return value_read
if len(values_not_read) > 0 and mpi.is_master_node:
raise ValueError(
'ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
if self.symm_op:
self.symmpar = Symmetry(self.hdf_file, subgroup=self.symmpar_data)