@@ -51,15 +51,18 @@ namespace LR
5151 *this ->DM_trans , gint, pot, ucell, orb_cutoff, gd, kv, pX, pc, pmat,
5252 { 0 }, -2.0 , ATYPE::CXC);
5353 // 2. $H_{ia}[T]$, equals to $2K_{ab}[T]$ when $T$ is symmetrized
54- OperatorLRHxc <T>* op_ht = new OperatorLRHxc<T>(nspin, naos, nocc, nvirt, psi_ks,
54+ hamilt::Operator <T>* op_ht = new OperatorLRHxc<T>(nspin, naos, nocc, nvirt, psi_ks,
5555 *this ->DM_diff , gint, pot_hxc_gs, ucell, orb_cutoff, gd, kv, pX, pc, pmat,
56- { 0 }, T (-2.0 ), ATYPE::CC_vo);
56+ { 0 }, T (-2.0 ), ATYPE::CC_vo, hamilt::calculation_type::lr_dmdiff_vo );
5757 this ->ops ->add (op_ht);
5858 // 3. $2\sum_{jb,kc} g^{xc}_{ia, jb, kc}X_{jb}X_{kc}$
5959 this ->pot_grad = std::make_shared<PotGradXCLR>(pot.lock ()->xc_kernel_components , pot.lock ()->get_rho_basis (), ucell, pot.lock ()->nrxx );
60- OperatorLRHxc<T>* op_gxc = new OperatorLRHxc<T>(nspin, naos, nocc, nvirt, psi_ks,
60+ // !!op_gxc has some bug
61+ hamilt::Operator<T>* op_gxc = new OperatorLRHxc<T>(nspin, naos, nocc, nvirt, psi_ks,
6162 *this ->DM_trans , gint, this ->pot_grad , ucell, orb_cutoff, gd, kv, pX, pc, pmat,
62- { 0 }, T (-2.0 ), ATYPE::CC_vo);
63+ { 0 }, T (-2.0 ), ATYPE::CC_vo, hamilt::calculation_type::lr_dmtrans_vo);
64+ assert (op_gxc != nullptr );
65+ std::cout << " op_gxc=" << op_ht << std::endl;
6366 this ->ops ->add (op_gxc);
6467 // // test: op_ht only
6568 // delete this->ops;
@@ -87,8 +90,10 @@ namespace LR
8790 const auto psi_ks_is = LR_Util::get_psi_spin (psi_ks, is, this ->nk );
8891#ifdef __MPI
8992 std::vector<ct::Tensor> dm_diff_2d = cal_dm_diff_pblas (X, this ->pX [is], psi_ks_is, pc, naos, nocc[is], nvirt[is], pmat);
93+ for (auto & t : dm_diff_2d) LR_Util::matsym (t.data <T>(), naos, pmat);
9094#else
9195 std::vector<ct::Tensor> dm_diff_2d = cal_dm_diff_blas (X, psi_ks_is, naos, nocc[is], nvirt[is]);
96+ for (auto & t : dm_diff_2d) LR_Util::matsym (t.data <T>(), naos);
9297#endif
9398 for (int ik = 0 ;ik < this ->nk ;++ik) { this ->DM_diff ->set_DMK_pointer (ik, dm_diff_2d[ik].data <T>()); }
9499 // std::cout << "difference density matrix" << std::endl;
@@ -103,7 +108,7 @@ namespace LR
103108 for (int ib = 0 ;ib < nband;++ib)
104109 {
105110 const int offset = ib * ld_psi;
106- // this->cal_dm_trans(0, psi + offset); // transition density matrix, only for test
111+ this ->cal_dm_trans (0 , psi + offset); // transition density matrix, only for test
107112 this ->cal_dm_diff (0 , psi + offset); // difference density matrix
108113 hamilt::Operator<T>* node (this ->ops );
109114 while (node != nullptr )
0 commit comments