forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove init_basis_lcao from ESolver_LCAO to LCAO_domain (#4746)
* Build: manually link MKL scalapack in absence * add message output * set message type for finding elpa * Add scalapack setup for standard MKL config * move init_basis_lcao from ESolver_LCAO to LCAO_domain namespace * fix some remaining bugs * fix bug when compiling with exx --------- Co-authored-by: caic99 <[email protected]>
- Loading branch information
Showing
8 changed files
with
131 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
source/module_hamilt_lcao/hamilt_lcaodft/LCAO_init_basis.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#include "LCAO_domain.h" | ||
|
||
/// once the GlobalC::exx_info has been deleted, this include can be gone | ||
/// mohan note 2024-07-21 | ||
#ifdef __EXX | ||
#include "module_hamilt_pw/hamilt_pwdft/global.h" | ||
#endif | ||
|
||
namespace LCAO_domain | ||
{ | ||
|
||
void init_basis_lcao(Parallel_Orbitals& pv, | ||
const double &onsite_radius, | ||
const double &lcao_ecut, | ||
const double &lcao_dk, | ||
const double &lcao_dr, | ||
const double &lcao_rmax, | ||
UnitCell& ucell, | ||
TwoCenterBundle& two_center_bundle) | ||
{ | ||
ModuleBase::TITLE("ESolver_KS_LCAO", "init_basis_lcao"); | ||
|
||
const int nlocal = GlobalV::NLOCAL; | ||
|
||
// autoset NB2D first | ||
if (GlobalV::NB2D == 0) | ||
{ | ||
if (nlocal > 0) | ||
{ | ||
GlobalV::NB2D = (GlobalV::NSPIN == 4) ? 2 : 1; | ||
} | ||
if (nlocal > 500) | ||
{ | ||
GlobalV::NB2D = 32; | ||
} | ||
if (nlocal > 1000) | ||
{ | ||
GlobalV::NB2D = 64; | ||
} | ||
} | ||
|
||
// * reading the localized orbitals/projectors | ||
// * construct the interpolation tables. | ||
|
||
two_center_bundle.build_orb(ucell.ntype, ucell.orbital_fn); | ||
two_center_bundle.build_alpha(GlobalV::deepks_setorb, &ucell.descriptor_file); | ||
two_center_bundle.build_orb_onsite(onsite_radius); | ||
// currently deepks only use one descriptor file, so cast bool to int is | ||
// fine | ||
|
||
// TODO Due to the omnipresence of GlobalC::ORB, we still have to rely | ||
// on the old interface for now. | ||
two_center_bundle.to_LCAO_Orbitals(GlobalC::ORB, lcao_ecut, lcao_dk, lcao_dr, lcao_rmax); | ||
|
||
ucell.infoNL.setupNonlocal(ucell.ntype, ucell.atoms, GlobalV::ofs_running, GlobalC::ORB); | ||
|
||
two_center_bundle.build_beta(ucell.ntype, ucell.infoNL.Beta); | ||
|
||
int Lmax = 0; | ||
#ifdef __EXX | ||
Lmax = GlobalC::exx_info.info_ri.abfs_Lmax; | ||
#endif | ||
|
||
#ifdef USE_NEW_TWO_CENTER | ||
two_center_bundle.tabulate(); | ||
#else | ||
two_center_bundle.tabulate(lcao_ecut, lcao_dk, lcao_dr, lcao_rmax); | ||
#endif | ||
|
||
// setup_2d_division | ||
#ifdef __MPI | ||
// storage form of H and S matrices on each processor | ||
// is determined in 'divide_HS_2d' subroutine | ||
|
||
int try_nb = pv.init(nlocal, nlocal, GlobalV::NB2D, DIAG_WORLD); | ||
try_nb += pv.set_nloc_wfc_Eij(GlobalV::NBANDS, GlobalV::ofs_running, GlobalV::ofs_warning); | ||
if (try_nb != 0) | ||
{ | ||
pv.set(nlocal, nlocal, 1, pv.blacs_ctxt); | ||
try_nb = pv.set_nloc_wfc_Eij(GlobalV::NBANDS, GlobalV::ofs_running, GlobalV::ofs_warning); | ||
} | ||
|
||
// init blacs context for genelpa | ||
pv.set_desc_wfc_Eij(nlocal, GlobalV::NBANDS, pv.nrow); | ||
|
||
#else | ||
pv.set_serial(nlocal, nlocal); | ||
pv.nrow_bands = nlocal; | ||
pv.ncol_bands = GlobalV::NBANDS; | ||
// Zhang Xiaoyang enable the serial version of LCAO and recovered this function usage. 2024-07-06 | ||
#endif | ||
|
||
pv.set_atomic_trace(ucell.get_iat2iwt(), ucell.nat, nlocal); | ||
|
||
return; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters