Skip to content

Commit

Permalink
[fix] broken CSC routines after gw_embedding merge
Browse files Browse the repository at this point in the history
  • Loading branch information
the-hampel committed Jun 25, 2024
1 parent fd56cd1 commit 3d1a1e9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
8 changes: 5 additions & 3 deletions python/solid_dmft/csc_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _full_vasp_run(general_params, dft_params, initial_run, n_iter_dft=1, sum_k=


# Main CSC flow method
def csc_flow_control(general_params, solver_params, dft_params, advanced_params):
def csc_flow_control(general_params, solver_params, dft_params, gw_params, advanced_params):
"""
Function to run the csc cycle. It writes and removes the vasp.lock file to
start and stop Vasp, run the converter, run the dmft cycle and abort the job
Expand All @@ -241,6 +241,8 @@ def csc_flow_control(general_params, solver_params, dft_params, advanced_params)
solver parameters as a dict
dft_params : dict
dft parameters as a dict
gw_params : dict
gw parameters as a dict
advanced_params : dict
advanced parameters as a dict
"""
Expand Down Expand Up @@ -321,8 +323,8 @@ def csc_flow_control(general_params, solver_params, dft_params, advanced_params)

############################################################
# run the dmft_cycle
is_converged, sum_k = dmft_cycle(general_params, solver_params, advanced_params,
dft_params, iter_one_shot, irred_indices, dft_energy)
is_converged, sum_k = dmft_cycle(general_params, solver_params, advanced_params, dft_params,
gw_params, iter_one_shot, irred_indices, dft_energy)
############################################################

iter_dmft += iter_one_shot
Expand Down
20 changes: 10 additions & 10 deletions python/solid_dmft/dmft_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ def dmft_cycle(general_params, solver_params, advanced_params, dft_params,
mpi.report('#'*80)
mpi.report('Running iteration: {} / {}'.format(it, iteration_offset + n_iter))
(sum_k, solvers,
observables, is_converged) = _dmft_step(sum_k, solvers, it, general_params,
solver_params, advanced_params, dft_params, map_imp_solver, solver_type_per_imp,
observables, is_converged) = _dmft_step(sum_k, solvers, it, general_params, solver_params, gw_params,
advanced_params, dft_params, map_imp_solver, solver_type_per_imp,
h_int, archive, shell_multiplicity, E_kin_dft,
observables, conv_obs, ops_chi_measure, dft_irred_kpt_indices, dft_energy, broadening,
is_converged, is_sampling=False)
Expand All @@ -592,8 +592,8 @@ def dmft_cycle(general_params, solver_params, advanced_params, dft_params,
iteration_offset + 1 + general_params['sampling_iterations']):
mpi.report('#'*80)
mpi.report('Running iteration: {} / {}'.format(it, iteration_offset+general_params['sampling_iterations']))
sum_k, solvers, observables, _ = _dmft_step(sum_k, solvers, it, general_params,
solver_params, advanced_params, dft_params, map_imp_solver, solver_type_per_imp,
sum_k, solvers, observables, _ = _dmft_step(sum_k, solvers, it, general_params, solver_params, gw_params,
advanced_params, dft_params, map_imp_solver, solver_type_per_imp,
h_int, archive, shell_multiplicity, E_kin_dft,
observables, conv_obs, ops_chi_measure, dft_irred_kpt_indices, dft_energy, broadening,
is_converged=True, is_sampling=True)
Expand All @@ -610,10 +610,10 @@ def dmft_cycle(general_params, solver_params, advanced_params, dft_params,
return is_converged, sum_k


def _dmft_step(sum_k, solvers, it, general_params,
solver_params, advanced_params, dft_params, map_imp_solver, solver_type_per_imp,
h_int, archive, shell_multiplicity, E_kin_dft,
observables, conv_obs, ops_chi_measure, dft_irred_kpt_indices, dft_energy, broadening,
def _dmft_step(sum_k, solvers, it, general_params, solver_params, gw_params,
advanced_params, dft_params, map_imp_solver, solver_type_per_imp, h_int,
archive, shell_multiplicity, E_kin_dft, observables, conv_obs,
ops_chi_measure, dft_irred_kpt_indices, dft_energy, broadening,
is_converged, is_sampling):
"""
Contains the actual dmft steps when all the preparation is done
Expand Down Expand Up @@ -774,8 +774,8 @@ def _dmft_step(sum_k, solvers, it, general_params,
# calculate new DC
# for the hartree solver the DC potential will be formally set to zero as it is already present in the Sigma
if general_params['dc'] and general_params['dc_dmft']:
sum_k = initial_sigma.calculate_double_counting(sum_k, density_mat,
general_params, advanced_params,
sum_k = initial_sigma.calculate_double_counting(sum_k, density_mat, general_params,
gw_params, advanced_params,
solver_type_per_imp)

#The hartree solver computes the DC energy internally, set it in sum_k
Expand Down
4 changes: 3 additions & 1 deletion python/solid_dmft/dmft_tools/results_to_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ def write(archive, sum_k, general_params, solver_params, solvers, map_imp_solver
if dft_var in archive:
archive['DMFT_results/it_{}'.format(it)].create_group(dft_var)
for key, value in archive[dft_var].items():
archive['DMFT_results/it_{}'.format(it)][dft_var][key] = value
# do only store changing elements
if key not in ['symm_kpath', 'kpts_cart']:
archive['DMFT_results/it_{}'.format(it)][dft_var][key] = value
for band_elem in ['_bands.dat', '_bands.dat.gnu', '_bands.projwfc_up', '_band.dat']:
if os.path.isfile('./{}{}'.format(general_params['seedname'], band_elem)):
os.rename('./{}{}'.format(general_params['seedname'], band_elem),
Expand Down
2 changes: 1 addition & 1 deletion python/solid_dmft/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def run_dmft(params, config_file_name=None):
if general_params['csc']:
# Start CSC calculation, always in same folder as dmft_config
general_params['jobname'] = '.'
csc_flow_control(general_params, solver_params, dft_params, advanced_params)
csc_flow_control(general_params, solver_params, dft_params, gw_params, advanced_params)
elif general_params['gw_embedding']:
from solid_dmft.gw_embedding.gw_flow import embedding_driver
if mpi.is_master_node():
Expand Down

0 comments on commit 3d1a1e9

Please sign in to comment.