Skip to content

Commit c54228e

Browse files
committed
fix add error
1 parent 10f97cf commit c54228e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/module_ri/Exx_LRI.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void Exx_LRI<Tdata>::cal_exx_ions(const UnitCell& ucell,
103103
list_As_Vs.first, list_As_Vs.second[0],
104104
{{"writable_Vws",true}});
105105
this->exx_objs[settings_list.first].cv.Vws = LRI_CV_Tools::get_CVws(ucell,Vs_temp);
106-
Vs = LRI_CV_Tools::add(Vs, Vs_temp);
106+
Vs = Vs.empty() ? Vs_temp : LRI_CV_Tools::add(Vs, Vs_temp);
107107

108108
if(PARAM.inp.cal_force || PARAM.inp.cal_stress)
109109
{
@@ -112,7 +112,7 @@ void Exx_LRI<Tdata>::cal_exx_ions(const UnitCell& ucell,
112112
list_As_Vs.first, list_As_Vs.second[0],
113113
{{"writable_dVws",true}});
114114
this->exx_objs[settings_list.first].cv.dVws = LRI_CV_Tools::get_dCVws(ucell,dVs_temp);
115-
dVs = LRI_CV_Tools::add(dVs, dVs_temp);
115+
dVs = dVs.empty() ? dVs_temp : LRI_CV_Tools::add(dVs, dVs_temp);
116116
}
117117

118118
}
@@ -151,13 +151,13 @@ void Exx_LRI<Tdata>::cal_exx_ions(const UnitCell& ucell,
151151
{"writable_Cws",true}, {"writable_dCws",true}, {"writable_Vws",false}, {"writable_dVws",false}});
152152
std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> &Cs_temp = std::get<0>(Cs_dCs);
153153
this->exx_objs[settings_list.first].cv.Cws = LRI_CV_Tools::get_CVws(ucell,Cs_temp);
154-
Cs = LRI_CV_Tools::add(Cs, Cs_temp);
154+
Cs = Cs.empty() ? Cs_temp : LRI_CV_Tools::add(Cs, Cs_temp);
155155

156156
if(PARAM.inp.cal_force || PARAM.inp.cal_stress)
157157
{
158158
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>> &dCs_temp = std::get<1>(Cs_dCs);
159159
this->exx_objs[settings_list.first].cv.dCws = LRI_CV_Tools::get_dCVws(ucell,dCs_temp);
160-
dCs = LRI_CV_Tools::add(dCs, dCs_temp);
160+
dCs = dCs.empty() ? dCs_temp : LRI_CV_Tools::add(dCs, dCs_temp);
161161
}
162162
}
163163
}

0 commit comments

Comments
 (0)