3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-18 03:53:48 +01:00

fix: add backward compatibility layer for dft_code flag

This commit is contained in:
Alexander Hampel 2023-01-23 15:00:47 -05:00
parent c202286341
commit 1c3e88fcfe
2 changed files with 10 additions and 3 deletions

View File

@ -26,6 +26,7 @@ calculation. The default name of this group is `dft_input`. Its contents are
Name Type Meaning Name Type Meaning
================= ====================================================================== ===================================================================================== ================= ====================================================================== =====================================================================================
energy_unit numpy.float Unit of energy used for the calculation. energy_unit numpy.float Unit of energy used for the calculation.
dft_code string DFT code used to generate input data.
n_k numpy.int Number of k-points used for the BZ integration. n_k numpy.int Number of k-points used for the BZ integration.
k_dep_projection numpy.int 1 if the dimension of the projection operators depend on the k-point, k_dep_projection numpy.int 1 if the dimension of the projection operators depend on the k-point,
0 otherwise. 0 otherwise.

View File

@ -126,18 +126,24 @@ class SumkDFT(object):
req_things_to_read = ['energy_unit', 'n_k', 'k_dep_projection', 'SP', 'SO', 'charge_below', 'density_required', req_things_to_read = ['energy_unit', 'n_k', 'k_dep_projection', 'SP', 'SO', 'charge_below', 'density_required',
'symm_op', 'n_shells', 'shells', 'n_corr_shells', 'corr_shells', 'use_rotations', 'rot_mat', 'symm_op', 'n_shells', 'shells', 'n_corr_shells', 'corr_shells', 'use_rotations', 'rot_mat',
'rot_mat_time_inv', 'n_reps', 'dim_reps', 'T', 'n_orbitals', 'proj_mat', 'bz_weights', 'hopping', 'rot_mat_time_inv', 'n_reps', 'dim_reps', 'T', 'n_orbitals', 'proj_mat', 'bz_weights', 'hopping',
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr', 'dft_code'] 'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
self.subgroup_present, self.values_not_read = self.read_input_from_hdf( self.subgroup_present, self.values_not_read = self.read_input_from_hdf(
subgrp=self.dft_data, things_to_read=req_things_to_read) subgrp=self.dft_data, things_to_read=req_things_to_read)
# test if all required properties have been found # test if all required properties have been found
if len(self.values_not_read) > 0 and mpi.is_master_node: if len(self.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) raise ValueError('ERROR: One or more necessary SumK input properties have not been found in the given h5 archive:', self.values_not_read)
# optional properties to load # optional properties to load
# soon bz_weights is depraced and replaced by kpt_weights, kpts_basis and kpts will become required to read soon # soon bz_weights is depraced and replaced by kpt_weights, kpts_basis and kpts will become required to read soon
optional_things_to_read = ['proj_mat_csc', 'proj_or_hk', 'kpt_basis','kpts','kpt_weights'] optional_things_to_read = ['proj_mat_csc', 'proj_or_hk', 'kpt_basis', 'kpts', 'kpt_weights', 'dft_code']
subgroup_present, self.optional_values_not_read = self.read_input_from_hdf(subgrp=self.dft_data, things_to_read=optional_things_to_read) subgroup_present, self.optional_values_not_read = self.read_input_from_hdf(subgrp=self.dft_data, things_to_read=optional_things_to_read)
# warning if dft_code was not read (old h5 structure)
if 'dft_code' in self.optional_values_not_read:
self.dft_code = None
mpi.report('\nWarning: old h5 archive without dft_code input flag detected. Please specify sumk.dft_code manually!\n')
if self.symm_op: if self.symm_op:
self.symmcorr = Symmetry(hdf_file, subgroup=self.symmcorr_data) self.symmcorr = Symmetry(hdf_file, subgroup=self.symmcorr_data)