Skip to content

Commit

Permalink
Merged in Bands_PR (pull request #549)
Browse files Browse the repository at this point in the history
Bands.out changes

Approved-by: Sambit Das
Approved-by: Phani Motamarri
  • Loading branch information
kartickr authored and dsambit committed Dec 21, 2023
2 parents 0e1e8f5 + 64a0802 commit 7e469ef
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/manual/parameters.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ \subsection{Parameters in section \tt Post-processing Options}
{\it Default:} false


{\it Description:} [Standard] Write bands for every k-point to an outputfile called 'bands.out' in the units of Ha. This can be used after GS (Ground-state) or NSCF (Non-Self consistent field iteration) modes of solve. This option is by default on for NSCF mode of solve. Outputs a file name 'bands.out'. The first line has 2 entries with first one denoting the number of k-points and second entry denoting the number of eigenvalues(bands) for each k-point. Subsequent lines have 3 columns with first column indicating the k-point index, second column indicating band index and third column indicating corresponding eigenvalue.
{\it Description:} [Standard] Write bands for every k-point to an outputfile called 'bands.out' in the units of Ha. This can be used after GS (Ground-state) or NSCF (Non-Self consistent field iteration) modes of solve. This option is by default on for NSCF mode of solve. Outputs a file name 'bands.out'. The first line has 3 entries with first one denoting the number of k-points and second entry denoting the number of eigenvalues(bands) for each k-point and third the fermi energy in Ha. Subsequent lines have 4 columns with first column indicating the k-point index, second column indicating band index, third column indicating corresponding eigenvalue and fourth column indicating the corresponding occupation number.


{\it Possible values:} A boolean value (true or false)
Expand Down
48 changes: 40 additions & 8 deletions src/dft/dft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4472,7 +4472,7 @@ namespace dftfe
{
FILE *pFile;
pFile = fopen("bands.out", "w");
fprintf(pFile, "%d %d\n", totkPoints, numberEigenValues);
fprintf(pFile, "%d %d %.14g\n", totkPoints, numberEigenValues, FE);
for (unsigned int kPoint = 0;
kPoint < totkPoints / (1 + d_dftParamsPtr->spinPolarized);
++kPoint)
Expand All @@ -4481,16 +4481,33 @@ namespace dftfe
{
if (d_dftParamsPtr->spinPolarized)
{
double occupancyUp = dftUtils::getPartialOccupancy(
eigenValuesFlattenedGlobal[2 * kPoint * d_numEigenValues +
iWave],
FE,
C_kb,
d_dftParamsPtr->TVal);

double occupancyDown = dftUtils::getPartialOccupancy(
eigenValuesFlattenedGlobal[(2 * kPoint + 1) *
d_numEigenValues +
iWave],
FE,
C_kb,
d_dftParamsPtr->TVal);

fprintf(
pFile,
"%d %d %.14g %.14g\n",
"%d %d %.14g %.14g %.14g %.14g\n",
kPoint,
iWave,
eigenValuesFlattenedGlobal[2 * kPoint * d_numEigenValues +
iWave],
eigenValuesFlattenedGlobal[(2 * kPoint + 1) *
d_numEigenValues +
iWave]);
iWave],
occupancyUp,
occupancyDown);
if (d_dftParamsPtr->reproducible_output &&
d_dftParamsPtr->verbosity == 0)
{
Expand All @@ -4506,20 +4523,33 @@ namespace dftfe
(eigenValuesFlattenedGlobal
[(2 * kPoint + 1) * d_numEigenValues + iWave])) /
1000000000.0;
double occupancyUpTrunc =
std::floor(1000000000 * (occupancyUp)) / 1000000000.0;
double occupancyDownTrunc =
std::floor(1000000000 * (occupancyDown)) /
1000000000.0;
pcout << kPoint << " " << iWave << " " << std::fixed
<< std::setprecision(8) << eigenUpTrunc << " "
<< eigenDownTrunc << std::endl;
<< eigenDownTrunc << " " << occupancyUpTrunc
<< " " << occupancyDownTrunc << std::endl;
}
}
else
{
double occupancy = dftUtils::getPartialOccupancy(
eigenValuesFlattenedGlobal[kPoint * d_numEigenValues +
iWave],
FE,
C_kb,
d_dftParamsPtr->TVal);
fprintf(
pFile,
"%d %d %.14g\n",
"%d %d %.14g %.14g\n",
kPoint,
iWave,
eigenValuesFlattenedGlobal[kPoint * d_numEigenValues +
iWave]);
iWave],
occupancy);
if (d_dftParamsPtr->reproducible_output &&
d_dftParamsPtr->verbosity == 0)
{
Expand All @@ -4528,9 +4558,11 @@ namespace dftfe
(eigenValuesFlattenedGlobal
[kPoint * d_numEigenValues + iWave])) /
1000000000.0;
double occupancyTrunc =
std::floor(1000000000 * (occupancy)) / 1000000000.0;
pcout << kPoint << " " << iWave << " " << std::fixed
<< std::setprecision(8) << eigenTrunc
<< std::endl;
<< std::setprecision(8) << eigenTrunc << " "
<< occupancyTrunc << std::endl;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion utils/dftParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace dftfe
"WRITE BANDS",
"false",
dealii::Patterns::Bool(),
"[Standard] Write bands for every k-point to an outputfile called 'bands.out' in the units of Ha. This can be used after GS (Ground-state) or NSCF (Non-Self consistent field iteration) modes of solve. This option is by default on for NSCF mode of solve. Outputs a file name 'bands.out'. The first line has 2 entries with first one denoting the number of k-points and second entry denoting the number of eigenvalues(bands) for each k-point. Subsequent lines have 3 columns with first column indicating the k-point index, second column indicating band index and third column indicating corresponding eigenvalue.");
"[Standard] Write bands for every k-point to an outputfile called 'bands.out' in the units of Ha. This can be used after GS (Ground-state) or NSCF (Non-Self consistent field iteration) modes of solve. This option is by default on for NSCF mode of solve. Outputs a file name 'bands.out'. The first line has 3 entries with first one denoting the number of k-points and second entry denoting the number of eigenvalues(bands) for each k-point and third the fermi energy in Ha. Subsequent lines have 4 columns with first column indicating the k-point index, second column indicating band index, third column indicating corresponding eigenvalue and fourth column indicating the corresponding occupation number.");
}
prm.leave_subsection();

Expand Down

0 comments on commit 7e469ef

Please sign in to comment.