Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ void XC_Functional::gradcorr(double &etxc, double &vtxc, ModuleBase::matrix &v,
if(arho > epsr)
{
grho2a = gdr1[ir].norm2();


//normally values in rhotmp can either be >= 0 or < 0.
if( rhotmp1[ir] >= 0.0 ) segno = 1.0;
if( rhotmp1[ir] < 0.0 ) segno = -1.0;
else segno = -1.0;
if (use_libxc && is_stress)
{
#ifdef USE_LIBXC
Expand Down
16 changes: 9 additions & 7 deletions source/module_hamilt_pw/hamilt_pwdft/wavefunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,23 +779,24 @@ int wavefunc::get_R(int ix, int iy, int iz) // pengfei 2016-11-23
}


int wavefunc::iw2it( int iw) // pengfei 2016-11-23
int wavefunc::iw2it(int iw) // pengfei 2016-11-23
{
int ic, type;
ic =0;
for(int it =0; it<GlobalC::ucell.ntype; it++)
ic = 0;
type = 0;
for(int it = 0; it<GlobalC::ucell.ntype; it++)
{
for(int ia = 0; ia<GlobalC::ucell.atoms[it].na; ia++)
{
for(int L=0; L<GlobalC::ucell.atoms[it].nwl+1; L++)
for(int L = 0; L<GlobalC::ucell.atoms[it].nwl+1; L++)
{
for(int N=0; N<GlobalC::ucell.atoms[it].l_nchi[L]; N++)
for(int N = 0; N<GlobalC::ucell.atoms[it].l_nchi[L]; N++)
{
for(int i=0; i<(2*L+1); i++)
{
if(ic == iw)
{
type = it;
type = it;
}
ic++;
}
Expand All @@ -809,7 +810,8 @@ int wavefunc::iw2it( int iw) // pengfei 2016-11-23
int wavefunc::iw2ia( int iw) // pengfei 2016-11-23
{
int ic, na;
ic =0;
ic = 0;
na = 0;
for(int it =0; it<GlobalC::ucell.ntype; it++)
{
for(int ia = 0; ia<GlobalC::ucell.atoms[it].na; ia++)
Expand Down
25 changes: 16 additions & 9 deletions source/module_io/unk_overlap_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,13 @@ void unkOverlap_lcao::init(const Grid_Technique& gt, std::complex<double>*** wfc
return;
}

//REMARK: the code next seemed to duplicate with those in
//module_hamilt_pw/hamilt/pwdft/wavefunc.cpp.
int unkOverlap_lcao::iw2it(int iw)
{
int ic, type;
ic = 0;
type = 0;
for(int it = 0; it < GlobalC::ucell.ntype; it++)
{
for(int ia = 0; ia < GlobalC::ucell.atoms[it].na; ia++)
Expand All @@ -255,7 +258,7 @@ int unkOverlap_lcao::iw2it(int iw)
{
if(ic == iw)
{
type = it;
type = it;
}
ic++;
}
Expand All @@ -270,9 +273,10 @@ int unkOverlap_lcao::iw2ia(int iw)
{
int ic, na;
ic = 0;
na = 0;
for(int it = 0; it < GlobalC::ucell.ntype; it++)
{
for(int ia = 0; ia< GlobalC::ucell.atoms[it].na; ia++)
for(int ia = 0; ia < GlobalC::ucell.atoms[it].na; ia++)
{
for(int L = 0; L < GlobalC::ucell.atoms[it].nwl+1; L++)
{
Expand All @@ -282,7 +286,7 @@ int unkOverlap_lcao::iw2ia(int iw)
{
if(ic == iw)
{
na = ia;
na = ia;
}
ic++;
}
Expand All @@ -297,9 +301,10 @@ int unkOverlap_lcao::iw2iL(int iw)
{
int ic, iL;
ic = 0;
iL = 0;
for(int it = 0; it < GlobalC::ucell.ntype; it++)
{
for(int ia = 0; ia< GlobalC::ucell.atoms[it].na; ia++)
for(int ia = 0; ia < GlobalC::ucell.atoms[it].na; ia++)
{
for(int L = 0; L < GlobalC::ucell.atoms[it].nwl+1; L++)
{
Expand All @@ -309,7 +314,7 @@ int unkOverlap_lcao::iw2iL(int iw)
{
if(ic == iw)
{
iL = L;
iL = L;
}
ic++;
}
Expand All @@ -324,9 +329,10 @@ int unkOverlap_lcao::iw2iN(int iw)
{
int ic, iN;
ic = 0;
iN = 0;
for(int it = 0; it < GlobalC::ucell.ntype; it++)
{
for(int ia = 0; ia< GlobalC::ucell.atoms[it].na; ia++)
for(int ia = 0; ia < GlobalC::ucell.atoms[it].na; ia++)
{
for(int L = 0; L < GlobalC::ucell.atoms[it].nwl+1; L++)
{
Expand All @@ -336,7 +342,7 @@ int unkOverlap_lcao::iw2iN(int iw)
{
if(ic == iw)
{
iN = N;
iN = N;
}
ic++;
}
Expand All @@ -351,9 +357,10 @@ int unkOverlap_lcao::iw2im(int iw)
{
int ic, im;
ic = 0;
im = 0;
for(int it = 0; it < GlobalC::ucell.ntype; it++)
{
for(int ia = 0; ia< GlobalC::ucell.atoms[it].na; ia++)
for(int ia = 0; ia < GlobalC::ucell.atoms[it].na; ia++)
{
for(int L = 0; L < GlobalC::ucell.atoms[it].nwl+1; L++)
{
Expand All @@ -363,7 +370,7 @@ int unkOverlap_lcao::iw2im(int iw)
{
if(ic == iw)
{
im = i;
im = i;
}
ic++;
}
Expand Down
3 changes: 2 additions & 1 deletion source/module_relax/relax_new/relax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ void Relax::new_direction()
//prepare for line search
bool restart = true;
double x=0, y=etot;
double xnew, yd;
//TODO: add a certain threshold for the progress.
double xnew, yd = 1e-8;
Comment thread
OldDriver233 marked this conversation as resolved.

this->ls.line_search(restart, x, y, f, xnew, yd);

Expand Down