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
4 changes: 0 additions & 4 deletions ABACUS.develop/source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ dftd3_subroutine.o\
vdwd3.o\
vdwd3_parameters.o\
pseudopot_upf.o\
pseudo_h.o \
pseudo_atom.o \
pseudo_vl.o \
pseudo_nc.o \
pseudo_us.o \
pseudopot_cell_vl.o \
pseudopot_cell_vnl.o \
atom_pseudo.o\
Expand Down
19 changes: 9 additions & 10 deletions ABACUS.develop/source/src_io/read_pseudopot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@
void UnitCell_pseudo::read_pseudopot(const string &pp_dir)
{
TITLE("UnitCell_pseudo","read_pseudopot");
//----------------------------------------------------------
// EXPLAIN : setup reading log for pseudopot_upf
//----------------------------------------------------------
// setup reading log for pseudopot_upf
stringstream ss;
ss << global_out_dir << "atom_pseudo.log";

//----------------------------------------------------------
// EXPLAIN : Read in the atomic pseudo potential
//----------------------------------------------------------
// Read in the atomic pseudo potentials
string pp_address;
for (int i = 0;i < ntype;i++)
{
Pseudopot_upf upf;

// mohan update 2010-09-12
int error = 0, error_ap = 0;
int error = 0;
int error_ap = 0;

if(MY_RANK==0)
{
Expand All @@ -48,7 +45,10 @@ void UnitCell_pseudo::read_pseudopot(const string &pp_dir)
Parallel_Common::bcast_int(error_ap);
#endif

if(error_ap) WARNING_QUIT("UnitCell_pseudo::read_pseudopot","error when average the pseudopotential.");
if(error_ap)
{
WARNING_QUIT("UnitCell_pseudo::read_pseudopot","error when average the pseudopotential.");
}

if(error==1)
{
Expand All @@ -64,7 +64,6 @@ void UnitCell_pseudo::read_pseudopot(const string &pp_dir)
{
WARNING_QUIT("read_pseudopot","Check the reference states in pseudopotential .vwr file.\n Also the norm of the read in pseudo wave functions\n explicitly please check S, P and D channels.\n If the norm of the wave function is \n unreasonable large (should be near 1.0), ABACUS would quit. \n The solution is to turn off the wave functions \n and the corresponding non-local projectors together\n in .vwr pseudopotential file.");
}
// OUT(ofs_running,"PP_ERRROR",error);

//xiaohui add 2015-03-24
#ifdef __MPI
Expand All @@ -79,7 +78,7 @@ void UnitCell_pseudo::read_pseudopot(const string &pp_dir)
if(MY_RANK==0)
{
// upf.print_pseudo_upf( ofs );
atoms[i].set_pseudo_us( upf );
atoms[i].set_pseudo_nc( upf );

ofs_running << "\n Read in pseudopotential file is " << pseudo_fn[i] << endl;
OUT(ofs_running,"pseudopotential type",atoms[i].pp_type);
Expand Down
170 changes: 136 additions & 34 deletions ABACUS.develop/source/src_pdiag/pdiag_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ extern "C"

#include "src_external/src_test/test_function.h"

inline int cart2blacs(MPI_Comm comm_2D, int nprows, int npcols, int N, int nblk, int lld, int *desc, int &mpi_comm_rows, int &mpi_comm_cols)
inline int cart2blacs(
MPI_Comm comm_2D,
int nprows,
int npcols,
int N,
int nblk,
int lld,
int *desc,
int &mpi_comm_rows,
int &mpi_comm_cols)
{
#ifdef __MPI
int my_blacs_ctxt;
Expand Down Expand Up @@ -53,10 +62,18 @@ inline int cart2blacs(MPI_Comm comm_2D, int nprows, int npcols, int N, int nblk,
#endif
}

inline int q2ZLOC_WFC(int pos, int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
int loc_size,
double* work, double* ZLOC, double** WFC)
inline int q2ZLOC_WFC(
int pos,
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
int loc_size,
double* work,
double* ZLOC,
double** WFC)
{
//OUT(ofs_running,"start q2ZLOC_WFC");
for(int j=0; j<naroc[1]; ++j)
Expand All @@ -82,10 +99,19 @@ inline int q2ZLOC_WFC(int pos, int naroc[2], int nb,
return 0;
}

inline int q2ZLOC_WFC_WFCAUG(int pos, int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
int loc_size,
double* work, double* ZLOC, double** WFC, double** WFCAUG)
inline int q2ZLOC_WFC_WFCAUG(
int pos,
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
int loc_size,
double* work,
double* ZLOC,
double** WFC,
double** WFCAUG)
{

stringstream ss;
Expand Down Expand Up @@ -124,10 +150,20 @@ inline int q2ZLOC_WFC_WFCAUG(int pos, int naroc[2], int nb,
return 0;
}

inline int q2ZLOC_WFC_CTOT(int myid, int pos, int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
int loc_size,
double* work, double* ZLOC, double** WFC, double** CTOT)
inline int q2ZLOC_WFC_CTOT(
int myid,
int pos,
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
int loc_size,
double* work,
double* ZLOC,
double** WFC,
double** CTOT)
{
for(int j=0; j<naroc[1]; ++j)
{
Expand All @@ -152,10 +188,21 @@ inline int q2ZLOC_WFC_CTOT(int myid, int pos, int naroc[2], int nb,
return 0;
}

inline int q2ZLOC_WFC_WFCAUG_CTOT(int myid, int pos, int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
int loc_size,
double* work, double* ZLOC, double** WFC, double** WFCAUG, double** CTOT)
inline int q2ZLOC_WFC_WFCAUG_CTOT(
int myid,
int pos,
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
int loc_size,
double* work,
double* ZLOC,
double** WFC,
double** WFCAUG,
double** CTOT)
{
for(int j=0; j<naroc[1]; ++j)
{
Expand Down Expand Up @@ -185,9 +232,15 @@ inline int q2ZLOC_WFC_WFCAUG_CTOT(int myid, int pos, int naroc[2], int nb,
return 0;
}

inline int q2WFC_complex(int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
complex<double>* work, complex<double>** WFC)
inline int q2WFC_complex(
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
complex<double>* work,
complex<double>** WFC)
{
for(int j=0; j<naroc[1]; ++j)
{
Expand All @@ -206,9 +259,16 @@ inline int q2WFC_complex(int naroc[2], int nb,
return 0;
}

inline int q2WFC_WFCAUG_complex(int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
complex<double>* work, complex<double>** WFC, complex<double>** WFCAUG)
inline int q2WFC_WFCAUG_complex(
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
complex<double>* work,
complex<double>** WFC,
complex<double>** WFCAUG)
{
for(int j=0; j<naroc[1]; ++j)
{
Expand All @@ -232,9 +292,17 @@ inline int q2WFC_WFCAUG_complex(int naroc[2], int nb,
return 0;
}

inline int q2WFC_CTOT_complex(int myid, int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
complex<double>* work, complex<double>** WFC, complex<double>** CTOT)
inline int q2WFC_CTOT_complex(
int myid,
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
complex<double>* work,
complex<double>** WFC,
complex<double>** CTOT)
{
for(int j=0; j<naroc[1]; ++j)
{
Expand All @@ -254,9 +322,18 @@ inline int q2WFC_CTOT_complex(int myid, int naroc[2], int nb,
return 0;
}

inline int q2WFC_WFCAUG_CTOT_complex(int myid, int naroc[2], int nb,
int dim0, int dim1, int iprow, int ipcol,
complex<double>* work, complex<double>** WFC, complex<double>** WFCAUG, complex<double>** CTOT)
inline int q2WFC_WFCAUG_CTOT_complex(
int myid,
int naroc[2],
int nb,
int dim0,
int dim1,
int iprow,
int ipcol,
complex<double>* work,
complex<double>** WFC,
complex<double>** WFCAUG,
complex<double>** CTOT)
{
for(int j=0; j<naroc[1]; ++j)
{
Expand Down Expand Up @@ -769,7 +846,9 @@ void Pdiag_Double::diago_double_begin(
{
ofstream ofs("ekb_"+TO_STRING(istep)+"_"+TO_STRING(MY_RANK));
for(int ib=0; ib<NBANDS; ++ib)
{
ofs<<ekb[ib]<<endl;
}
}
{
ofstream ofs("wfc-C_"+TO_STRING(istep)+"_"+TO_STRING(MY_RANK));
Expand All @@ -787,8 +866,13 @@ void Pdiag_Double::diago_double_begin(
}


void Pdiag_Double::diago_complex_begin(const int &ik, complex<double> **wfc, ComplexMatrix &wfc_2d,
complex<double>* ch_mat, complex<double>* cs_mat, double *ekb)
void Pdiag_Double::diago_complex_begin(
const int &ik,
complex<double> **wfc,
ComplexMatrix &wfc_2d,
complex<double>* ch_mat,
complex<double>* cs_mat,
double *ekb)
{
#ifdef TEST_DIAG
{
Expand All @@ -804,12 +888,18 @@ void Pdiag_Double::diago_complex_begin(const int &ik, complex<double> **wfc, Com
if(std::norm(m[index])>1E-10)
{
if(std::imag(m[index])>1E-10)
{
ofs<<m[index]<<"\t";
}
else
{
ofs<<std::real(m[index])<<"\t";
}
}
else
{
ofs<<0<<"\t";
}
}
ofs<<endl;
}
Expand All @@ -825,12 +915,18 @@ void Pdiag_Double::diago_complex_begin(const int &ik, complex<double> **wfc, Com
if(std::norm(m[index])>1E-10)
{
if(std::imag(m[index])>1E-10)
{
ofs<<m[index]<<"\t";
}
else
{
ofs<<std::real(m[index])<<"\t";
}
}
else
{
ofs<<0<<"\t";
}
}
ofs<<endl;
}
Expand Down Expand Up @@ -1015,7 +1111,9 @@ void Pdiag_Double::diago_complex_begin(const int &ik, complex<double> **wfc, Com
&NLOCAL, h_tmp.c, &one, &one, desc, s_tmp.c, &one, &one, desc,
NULL, NULL, &il, &iu, &abstol,
&M, &NZ, ekb, &orfac, wfc_2d.c, &one, &one, desc,
work.data(), &lwork, rwork.data(), &lrwork, iwork.data(), &liwork, ifail.data(), iclustr.data(), gap.data(), &info);
work.data(), &lwork, rwork.data(), &lrwork,
iwork.data(), &liwork, ifail.data(), iclustr.data(), gap.data(), &info);

ofs_running<<"lwork="<<work[0]<<"\t"<<"liwork="<<iwork[0]<<endl;
lwork = work[0].real();
work.resize(lwork,0);
Expand Down Expand Up @@ -1118,7 +1216,12 @@ void Pdiag_Double::diago_complex_begin(const int &ik, complex<double> **wfc, Com


#ifdef __MPI
void Pdiag_Double::readin(const string &fa, const string &fb, const int &nlocal_tot, double *eigen, double *eigvr)
void Pdiag_Double::readin(
const string &fa,
const string &fb,
const int &nlocal_tot,
double *eigen,
double *eigvr)
{
TITLE("Pdiag_Double","readin");

Expand Down Expand Up @@ -1186,4 +1289,3 @@ void Pdiag_Double::readin(const string &fa, const string &fb, const int &nlocal_
delete[] Z;
}
#endif

Loading