Skip to content

Commit

Permalink
Merged in atomicWfc_bugFix (pull request #584)
Browse files Browse the repository at this point in the history
Reading atomic wfc from scratch folder

Approved-by: Sambit Das
Approved-by: Phani Motamarri
  • Loading branch information
kartickr authored and phanimotamarri committed Apr 19, 2024
2 parents d14b6e0 + 83fd23c commit e7e9774
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 30 deletions.
29 changes: 23 additions & 6 deletions pseudoConverters/pseudoPotentialToDftfeConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,12 @@ namespace dftfe
}
void
xmltoOrbitalFile(std::string file_path_in, std::string file_path_out)
{
// Extracting radial coordinates
{ // Extracting radial coordinates
std::vector<double> radial_coord;
std::vector<std::string> radial_tag;
radial_tag.push_back("PP_MESH");
radial_tag.push_back("PP_R");
radial_coord = XmlTagReaderMain(radial_tag, file_path_in);

std::vector<std::string> pswfc_tag;
pswfc_tag.push_back("PP_PSWFC");
for (int i = 1; i <= xmlNodeChildCount(pswfc_tag, file_path_in); i++)
Expand All @@ -640,13 +638,32 @@ namespace dftfe
{
index = std::distance(attr_type.begin(), it);
}
std::string orbital_string = attr_value[index];
for (auto &w : orbital_string)
std::string orbital_string_nl = attr_value[index];
for (auto &w : orbital_string_nl)
{
w = tolower(w);
}
char n = orbital_string_nl[0];
char l;
if (orbital_string_nl[1] == 's')
{
l = '0';
}
if (orbital_string_nl[1] == 'p')
{
l = '1';
}
if (orbital_string_nl[1] == 'd')
{
l = '2';
}
if (orbital_string_nl[1] == 'f')
{
l = '3';
}
std::string orbital_string = "psi";
std::fstream file;
file.open(file_path_out + "/" + orbital_string + ".dat",
file.open(file_path_out + "/" + orbital_string + n + l + ".inp",
std::ios::out);
file << std::setprecision(12);
if (file.is_open())
Expand Down
44 changes: 22 additions & 22 deletions src/dft/dft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,29 @@ namespace dftfe
<< std::endl;
}
}
// convert pseudopotential files in upf format to dftfe format
if (d_dftParamsPtr->verbosity >= 1)
{
pcout
<< std::endl
<< "Reading Pseudo-potential data for each atom from the list given in : "
<< d_dftParamsPtr->pseudoPotentialFile << std::endl;
}

int nlccFlag = 0;
std::vector<int> pspFlags(2, 0);
if (dealii::Utilities::MPI::this_mpi_process(d_mpiCommParent) == 0 &&
d_dftParamsPtr->isPseudopotential == true)
pspFlags = pseudoUtils::convert(d_dftParamsPtr->pseudoPotentialFile,
d_dftfeScratchFolderName,
d_dftParamsPtr->verbosity,
d_dftParamsPtr->natomTypes,
d_dftParamsPtr->pseudoTestsFlag);

nlccFlag = pspFlags[0];
nlccFlag = dealii::Utilities::MPI::sum(nlccFlag, d_mpiCommParent);
if (nlccFlag > 0 && d_dftParamsPtr->isPseudopotential == true)
d_dftParamsPtr->nonLinearCoreCorrection = true;
// estimate total number of wave functions from atomic orbital filling
if (d_dftParamsPtr->startingWFCType == "ATOMIC")
determineOrbitalFilling();
Expand Down Expand Up @@ -803,29 +825,7 @@ namespace dftfe
d_numEigenValuesRR);
}

// convert pseudopotential files in upf format to dftfe format
if (d_dftParamsPtr->verbosity >= 1)
{
pcout
<< std::endl
<< "Reading Pseudo-potential data for each atom from the list given in : "
<< d_dftParamsPtr->pseudoPotentialFile << std::endl;
}

int nlccFlag = 0;
std::vector<int> pspFlags(2, 0);
if (dealii::Utilities::MPI::this_mpi_process(d_mpiCommParent) == 0 &&
d_dftParamsPtr->isPseudopotential == true)
pspFlags = pseudoUtils::convert(d_dftParamsPtr->pseudoPotentialFile,
d_dftfeScratchFolderName,
d_dftParamsPtr->verbosity,
d_dftParamsPtr->natomTypes,
d_dftParamsPtr->pseudoTestsFlag);

nlccFlag = pspFlags[0];
nlccFlag = dealii::Utilities::MPI::sum(nlccFlag, d_mpiCommParent);
if (nlccFlag > 0 && d_dftParamsPtr->isPseudopotential == true)
d_dftParamsPtr->nonLinearCoreCorrection = true;
if (d_dftParamsPtr->isPseudopotential == true)
{
// pcout<<"dft.cc 827 ONCV Number of cells DEBUG:
Expand Down
9 changes: 7 additions & 2 deletions src/dft/psiInitialGuess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace dftfe
//
char psiFile[256];

if (d_dftParamsPtr->isPseudopotential)
if (d_dftParamsPtr->isPseudopotential && d_dftParamsPtr->pseudoTestsFlag)
// if(d_dftParamsPtr->pseudoProjector==2)
// sprintf(psiFile,
// "%s/data/electronicStructure/pseudoPotential/z%u/oncv/singleAtomData/psi%u%u.inp",
Expand All @@ -65,7 +65,12 @@ namespace dftfe
Z,
n,
l);

else if (d_dftParamsPtr->isPseudopotential &&
!d_dftParamsPtr->pseudoTestsFlag)
strcpy(psiFile,
(d_dftfeScratchFolderName + "/z" + std::to_string(Z) + "/" +
"psi" + std::to_string(n) + std::to_string(l) + ".inp")
.c_str());
else
sprintf(
psiFile,
Expand Down

0 comments on commit e7e9774

Please sign in to comment.