3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 12:23:41 +01:00

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

View File

@ -341,10 +341,11 @@ class SumkDFTTools(SumkDFT):
things_to_read = ['n_parproj', 'proj_mat_all', things_to_read = ['n_parproj', 'proj_mat_all',
'rot_mat_all', 'rot_mat_all_time_inv'] '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) subgrp=self.parproj_data, things_to_read=things_to_read)
if not value_read: if len(values_not_read) > 0 and mpi.is_master_node:
return value_read 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: if self.symm_op:
self.symmpar = Symmetry(self.hdf_file, subgroup=self.symmpar_data) self.symmpar = Symmetry(self.hdf_file, subgroup=self.symmpar_data)
@ -489,15 +490,17 @@ class SumkDFTTools(SumkDFT):
if (pdos): if (pdos):
things_to_read = ['maxlm', 'bc'] things_to_read = ['maxlm', 'bc']
value_read = self.read_input_from_hdf( subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.bc_data, things_to_read=things_to_read) subgrp=self.bc_data, things_to_read=things_to_read)
if not value_read: if len(values_not_read) > 0 and mpi.is_master_node:
return value_read 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'] things_to_read = ['n_atoms']
value_read = self.read_input_from_hdf( subgroup_present, values_not_read = self.read_input_from_hdf(
subgrp=self.symmcorr_data, things_to_read=things_to_read) subgrp=self.symmcorr_data, things_to_read=things_to_read)
if not value_read: if len(values_not_read) > 0 and mpi.is_master_node:
return value_read 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: if mesh is None or with_Sigma:
assert isinstance(self.mesh, MeshReFreq), "mesh must be given if self.mesh is a MeshImFreq" 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 #read in the energy contour energies and projectors
things_to_read = ['n_k','bmat','symlat','n_symm','vkl', things_to_read = ['n_k','bmat','symlat','n_symm','vkl',
'n_orbitals', 'proj_mat', 'hopping'] '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) subgrp=self.fs_data, things_to_read=things_to_read)
if not value_read: if len(values_not_read) > 0 and mpi.is_master_node:
return value_read 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: 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" 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', things_to_read = ['n_k', 'n_orbitals', 'proj_mat',
'hopping', 'n_parproj', 'proj_mat_all'] '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) subgrp=self.bands_data, things_to_read=things_to_read)
if not value_read: if len(values_not_read) > 0 and mpi.is_master_node:
return value_read 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: if ishell is not None:
things_to_read = ['rot_mat_all', 'rot_mat_all_time_inv'] 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) subgrp=self.parproj_data, things_to_read=things_to_read)
if not value_read: if len(values_not_read) > 0 and mpi.is_master_node:
return value_read 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: if mu is None:
mu = self.chemical_potential mu = self.chemical_potential
@ -966,10 +972,11 @@ class SumkDFTTools(SumkDFT):
things_to_read = ['dens_mat_below', 'n_parproj', things_to_read = ['dens_mat_below', 'n_parproj',
'proj_mat_all', 'rot_mat_all', 'rot_mat_all_time_inv'] '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) subgrp=self.parproj_data, things_to_read=things_to_read)
if not value_read: if len(values_not_read) > 0 and mpi.is_master_node:
return value_read 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: if self.symm_op:
self.symmpar = Symmetry(self.hdf_file, subgroup=self.symmpar_data) self.symmpar = Symmetry(self.hdf_file, subgroup=self.symmpar_data)