From e8547819b4b2558f3a71bc1f24560fdb14d20cad Mon Sep 17 00:00:00 2001 From: lcrippa Date: Thu, 13 Jun 2024 17:34:06 +0200 Subject: [PATCH] BUGFIX: case Real-space DMFT and mpi_lanc=F: in ed_solve_single, check_MPI() is T but fmpi_=mpi_lanc=F. So the MPI communicator is not set (as it should be). However the following condition if(MpiMaster) is true for every core, and every core writes on the used.input file, rendering it unreadable if not dangerous. Cases in which binary blobs - probably coming from cores writing at the same time- are present have been reported. If one uses this file as input for a new run, the program either doesn't run or behaves erratically. Fix for now: if fmpi_ is F, don't print to used.input in ed_solve_single. Only the master (not the same master of ed_solve_single's MpiComm) in ed_solve_lattice will print, before ed_solve_single is called. Fix for the future: Enable in the lattice case the possibility of having different input files for different atoms; this could expose the case where ULOC is different per atom, which is now not accessible without specific coding in the driver. --- src/ED_MAIN.f90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ED_MAIN.f90 b/src/ED_MAIN.f90 index 0460b4d9..3d102816 100644 --- a/src/ED_MAIN.f90 +++ b/src/ED_MAIN.f90 @@ -203,8 +203,8 @@ subroutine ed_solve_single(bath,sflag,fmpi) ! check = check_bath_dimension(bath) if(.not.check)stop "ED_SOLVE_SINGLE Error: wrong bath dimensions" - ! - if(MpiMaster)call save_input_file(str(ed_input_file)) + ! + if(MpiMaster.and.fmpi_)call save_input_file(str(ed_input_file)) ! call allocate_dmft_bath(dmft_bath) call set_dmft_bath(bath,dmft_bath) @@ -345,6 +345,9 @@ subroutine ed_solve_lattice(bath,mpi_lanc,Uloc_ii,Ust_ii,Jh_ii,Jp_ii,Jx_ii,iflag lanc_nstates_total = neigen_total_ineq(ilat) ! call ed_set_Hloc(Hloc_ineq(ilat,:,:,:,:)) + ! + if(MPI_MASTER)call save_input_file(str(ed_input_file)) + ! call ed_solve_single(bath(ilat,:),sflag=iflag_,fmpi=mpi_lanc_) ! neigen_sectortmp(ilat,:) = neigen_sector(:)