Skip to content

Commit

Permalink
More conversions to go from real-complex to complex-complex...EJB
Browse files Browse the repository at this point in the history
  • Loading branch information
ebylaska committed Dec 4, 2023
1 parent 236e7f4 commit a349b28
Show file tree
Hide file tree
Showing 8 changed files with 830 additions and 766 deletions.
12 changes: 6 additions & 6 deletions Nwpw/band/lib/cpsi/cpsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ void cpsi_get_header(Parallel *myparall, int *version, int nfft[],
if (myparall->is_master())
{
// char *fname = control_input_movecs_filename();
std::cout << "filename=" << filename << std::endl;
openfile(4, filename, "r");
iread(4, version, 1);
iread(4, nfft, 3);
Expand All @@ -207,7 +206,6 @@ void cpsi_get_header(Parallel *myparall, int *version, int nfft[],
iread(4, ne, 2);
iread(4, nbrillouin, 1);
closefile(4);
std::cout << "version=" << *version << std::endl;
}
myparall->Brdcst_iValue(0, 0, version);
myparall->Brdcst_iValues(0, 0, 3, nfft);
Expand All @@ -230,9 +228,6 @@ static bool cpsi_check_convert(Cneb *mycneb, char *filename, std::ostream &coutp
bool converted = false;

cpsi_get_header(myparall, &version0, nfft0, unita0, &ispin0, ne0, &nbrillouin0, filename);
std::cout << " nibrillouin0=" << nbrillouin0 << std::endl;
std::cout << " NFFT0=" << nfft0[0] << " " << nfft0[1] << " " << nfft0[2] << std::endl;
std::cout << " nx,ny,nz=" << mycneb->nx << " " <<mycneb->ny << " " << mycneb->nz << std::endl;
if ((nfft0[0] != mycneb->nx) || (nfft0[1] != mycneb->ny) || (nfft0[2] != mycneb->nz))
{
if (myparall->base_stdio_print)
Expand Down Expand Up @@ -287,7 +282,7 @@ void cpsi_read0(Cneb *mycneb, int *version, int nfft[], double unita[],

/* reads in c format and automatically packs the result to g format */
//mycneb->g_read(4,ispin,psi);
mycneb->g_read_ne(4,ne,psi);
mycneb->g_read_ne(4,ne,*nbrillouin,psi);


if (myparall->is_master())
Expand Down Expand Up @@ -353,6 +348,7 @@ bool cpsi_read(Cneb *mycneb, char *filename, bool wvfnc_initialize, double *psi2
/* ortho check */
double sum2 = mycneb->gg_traceall(psi2, psi2);
double sum1 = mycneb->ne[0] + mycneb->ne[1];
std::cout << "sum1,sum2=" << sum1 << " " << sum2 << std::endl;

if ((mycneb->ispin) == 1)
sum1 *= 2;
Expand All @@ -367,6 +363,10 @@ bool cpsi_read(Cneb *mycneb, char *filename, bool wvfnc_initialize, double *psi2
coutput << " - exact norm = " << sum1 << " norm=" << sum2
<< " corrected norm=" << sum3
<< " (error=" << std::abs(sum2 - sum1) << ")" << std::endl;

mycneb->g_ortho(psi2);
double sum4 = mycneb->gg_traceall(psi2, psi2);
std::cout << "sum4=" << sum4 << std::endl;
}

return newpsi;
Expand Down
Loading

0 comments on commit a349b28

Please sign in to comment.