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
1 change: 1 addition & 0 deletions ABACUS.develop/source/src_global/sph_bessel_recursive.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define SPH_BESSEL_RECURSIVE_H

#include<vector>
#include"stddef.h"

class Sph_Bessel_Recursive
{
Expand Down
40 changes: 20 additions & 20 deletions ABACUS.develop/source/src_pw/diago_cg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ void Diago_CG::schmit_orth
//qianrui replace 2021-3-15
char trans2='N';
zgemv_(&trans2,&dim,&m,&NEG_ONE,psi.c,&dmx,lagrange,&inc,&ONE,psi_m,&inc);
psi_norm -= ddot_real(m,lagrange,lagrange);
psi_norm -= ddot_real(m,lagrange,lagrange,false);
//======================================================================
/*for (int j = 0; j < m; j++)
{
Expand Down Expand Up @@ -486,23 +486,8 @@ double Diago_CG::ddot_real
(
const int &dim,
const complex<double>* psi_L,
const complex<double>* psi_R
)
{
complex<double> result(0,0);
for (int i=0;i<dim;i++)
{
result += conj( psi_L[i] ) * psi_R[i];
}
Parallel_Reduce::reduce_complex_double_pool( result );
return result.real();
}

complex<double> Diago_CG::ddot
(
const int & dim,
const complex<double> * psi_L,
const complex<double> * psi_R
const complex<double>* psi_R,
const bool reduce
)
{
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Expand All @@ -513,7 +498,7 @@ complex<double> Diago_CG::ddot
pL=(double *)psi_L;
pR=(double *)psi_R;
double result=LapackConnector::dot(dim2,pL,1,pR,1);
Parallel_Reduce::reduce_double_pool( result );
if(reduce) Parallel_Reduce::reduce_double_pool( result );
return result;
//======================================================================
/*complex<double> result(0,0);
Expand All @@ -524,8 +509,23 @@ complex<double> Diago_CG::ddot
Parallel_Reduce::reduce_complex_double_pool( result );
return result.real();*/
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
} // end of ddot
}

complex<double> Diago_CG::ddot
(
const int & dim,
const complex<double> * psi_L,
const complex<double> * psi_R
)
{
complex<double> result(0, 0);
for (int i = 0; i < dim ; i++)
{
result += conj(psi_L[i]) * psi_R[i] ;
}
Parallel_Reduce::reduce_complex_double_pool( result );
return result;
} // end of ddot

// this return <psi(m)|psik>
complex<double> Diago_CG::ddot
Expand Down
4 changes: 3 additions & 1 deletion ABACUS.develop/source/src_pw/diago_cg.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ class Diago_CG
static double ddot_real(
const int & dim,
const complex<double>* psi_L,
const complex<double>* psi_R) ;
const complex<double>* psi_R,
const bool reduce = true) ;

static complex<double> ddot(
const int & dim,
const complex<double>* psi_L,
const complex<double>* psi_R ) ;


static complex<double> ddot(
const int & dim,
const ComplexMatrix &psi,
Expand Down
Loading