|
12 | 12 | #include "../source_lcao/module_ri/exx_opt_orb.h" |
13 | 13 | #endif |
14 | 14 | #include "source_lcao/module_rdmft/rdmft.h" |
15 | | -#include "source_estate/module_charge/chgmixing.h" // use charge mixing, mohan add 20251006 |
| 15 | +#include "source_estate/module_charge/chgmixing.h" // use charge mixing, mohan add 20251006 |
16 | 16 | #include "source_estate/module_dm/init_dm.h" // init dm from electronic wave functions |
17 | | -#include "source_io/ctrl_runner_lcao.h" // use ctrl_runner_lcao() |
18 | | -#include "source_io/ctrl_iter_lcao.h" // use ctrl_iter_lcao() |
| 17 | +#include "source_io/ctrl_runner_lcao.h" // use ctrl_runner_lcao() |
| 18 | +#include "source_io/ctrl_iter_lcao.h" // use ctrl_iter_lcao() |
19 | 19 | #include "source_io/ctrl_scf_lcao.h" // use ctrl_scf_lcao() |
20 | 20 | #include "source_io/print_info.h" |
21 | 21 | #include "source_lcao/rho_tau_lcao.h" // mohan add 20251024 |
22 | 22 | #include "source_lcao/LCAO_set.h" // mohan add 20251111 |
| 23 | +#include "source_lcao/module_operator_lcao/overlap_new.h" |
23 | 24 |
|
24 | 25 | namespace ModuleESolver |
25 | 26 | { |
@@ -557,7 +558,34 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep, const |
557 | 558 | this->rdmft_solver, this->deepks, this->exx_nao, |
558 | 559 | this->conv_esolver, this->scf_nmax_flag, istep); |
559 | 560 |
|
560 | | - //! 3) Clean up RA, which is used to serach for adjacent atoms |
| 561 | + //! 3) Calculate and output asynchronous overlap matrix for Hefei-NAMD |
| 562 | + if (PARAM.inp.cal_syns && (istep > 0 || PARAM.inp.init_vel)) |
| 563 | + { |
| 564 | + // Create a new OverlapNew instance specifically for SR_async calculation |
| 565 | + // This allows SR_async to be initialized with velocity-shifted dtau |
| 566 | + hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>* overlap_async = |
| 567 | + new hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>( |
| 568 | + nullptr, // hsk_in: not needed for SR_async calculation |
| 569 | + this->kv.kvec_d, |
| 570 | + nullptr, // hR_in: not needed for SR_async calculation |
| 571 | + nullptr, // SR_in: not needed for SR_async calculation |
| 572 | + &ucell, |
| 573 | + this->orb_.cutoffs(), |
| 574 | + &this->gd, |
| 575 | + this->two_center_bundle_.overlap_orb.get()); |
| 576 | + |
| 577 | + // Use same precision as DMR output (default 8 if not specified) |
| 578 | + const int precision = PARAM.inp.out_dmr[0] > 0 ? PARAM.inp.out_dmr[1] : 8; |
| 579 | + const Parallel_Orbitals* paraV = hamilt_lcao->getSR()->get_paraV(); |
| 580 | + hamilt::HContainer<TR>* SR_async = overlap_async->calculate_SR_async(ucell, PARAM.mdp.md_dt, paraV); |
| 581 | + overlap_async->output_SR_async_csr(istep, SR_async, precision); |
| 582 | + |
| 583 | + // Clean up |
| 584 | + delete SR_async; |
| 585 | + delete overlap_async; |
| 586 | + } |
| 587 | + |
| 588 | + //! 4) Clean up RA, which is used to serach for adjacent atoms |
561 | 589 | if (!PARAM.inp.cal_force && !PARAM.inp.cal_stress) |
562 | 590 | { |
563 | 591 | this->RA.delete_grid(); |
|
0 commit comments