Skip to content

Commit e7e9774

Browse files
kartickrphanimotamarri
authored andcommitted
Merged in atomicWfc_bugFix (pull request #584)
Reading atomic wfc from scratch folder Approved-by: Sambit Das Approved-by: Phani Motamarri
2 parents d14b6e0 + 83fd23c commit e7e9774

File tree

3 files changed

+52
-30
lines changed

3 files changed

+52
-30
lines changed

pseudoConverters/pseudoPotentialToDftfeConverter.cc

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -606,14 +606,12 @@ namespace dftfe
606606
}
607607
void
608608
xmltoOrbitalFile(std::string file_path_in, std::string file_path_out)
609-
{
610-
// Extracting radial coordinates
609+
{ // Extracting radial coordinates
611610
std::vector<double> radial_coord;
612611
std::vector<std::string> radial_tag;
613612
radial_tag.push_back("PP_MESH");
614613
radial_tag.push_back("PP_R");
615614
radial_coord = XmlTagReaderMain(radial_tag, file_path_in);
616-
617615
std::vector<std::string> pswfc_tag;
618616
pswfc_tag.push_back("PP_PSWFC");
619617
for (int i = 1; i <= xmlNodeChildCount(pswfc_tag, file_path_in); i++)
@@ -640,13 +638,32 @@ namespace dftfe
640638
{
641639
index = std::distance(attr_type.begin(), it);
642640
}
643-
std::string orbital_string = attr_value[index];
644-
for (auto &w : orbital_string)
641+
std::string orbital_string_nl = attr_value[index];
642+
for (auto &w : orbital_string_nl)
645643
{
646644
w = tolower(w);
647645
}
646+
char n = orbital_string_nl[0];
647+
char l;
648+
if (orbital_string_nl[1] == 's')
649+
{
650+
l = '0';
651+
}
652+
if (orbital_string_nl[1] == 'p')
653+
{
654+
l = '1';
655+
}
656+
if (orbital_string_nl[1] == 'd')
657+
{
658+
l = '2';
659+
}
660+
if (orbital_string_nl[1] == 'f')
661+
{
662+
l = '3';
663+
}
664+
std::string orbital_string = "psi";
648665
std::fstream file;
649-
file.open(file_path_out + "/" + orbital_string + ".dat",
666+
file.open(file_path_out + "/" + orbital_string + n + l + ".inp",
650667
std::ios::out);
651668
file << std::setprecision(12);
652669
if (file.is_open())

src/dft/dft.cc

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,29 @@ namespace dftfe
743743
<< std::endl;
744744
}
745745
}
746+
// convert pseudopotential files in upf format to dftfe format
747+
if (d_dftParamsPtr->verbosity >= 1)
748+
{
749+
pcout
750+
<< std::endl
751+
<< "Reading Pseudo-potential data for each atom from the list given in : "
752+
<< d_dftParamsPtr->pseudoPotentialFile << std::endl;
753+
}
754+
755+
int nlccFlag = 0;
756+
std::vector<int> pspFlags(2, 0);
757+
if (dealii::Utilities::MPI::this_mpi_process(d_mpiCommParent) == 0 &&
758+
d_dftParamsPtr->isPseudopotential == true)
759+
pspFlags = pseudoUtils::convert(d_dftParamsPtr->pseudoPotentialFile,
760+
d_dftfeScratchFolderName,
761+
d_dftParamsPtr->verbosity,
762+
d_dftParamsPtr->natomTypes,
763+
d_dftParamsPtr->pseudoTestsFlag);
746764

765+
nlccFlag = pspFlags[0];
766+
nlccFlag = dealii::Utilities::MPI::sum(nlccFlag, d_mpiCommParent);
767+
if (nlccFlag > 0 && d_dftParamsPtr->isPseudopotential == true)
768+
d_dftParamsPtr->nonLinearCoreCorrection = true;
747769
// estimate total number of wave functions from atomic orbital filling
748770
if (d_dftParamsPtr->startingWFCType == "ATOMIC")
749771
determineOrbitalFilling();
@@ -803,29 +825,7 @@ namespace dftfe
803825
d_numEigenValuesRR);
804826
}
805827

806-
// convert pseudopotential files in upf format to dftfe format
807-
if (d_dftParamsPtr->verbosity >= 1)
808-
{
809-
pcout
810-
<< std::endl
811-
<< "Reading Pseudo-potential data for each atom from the list given in : "
812-
<< d_dftParamsPtr->pseudoPotentialFile << std::endl;
813-
}
814-
815-
int nlccFlag = 0;
816-
std::vector<int> pspFlags(2, 0);
817-
if (dealii::Utilities::MPI::this_mpi_process(d_mpiCommParent) == 0 &&
818-
d_dftParamsPtr->isPseudopotential == true)
819-
pspFlags = pseudoUtils::convert(d_dftParamsPtr->pseudoPotentialFile,
820-
d_dftfeScratchFolderName,
821-
d_dftParamsPtr->verbosity,
822-
d_dftParamsPtr->natomTypes,
823-
d_dftParamsPtr->pseudoTestsFlag);
824828

825-
nlccFlag = pspFlags[0];
826-
nlccFlag = dealii::Utilities::MPI::sum(nlccFlag, d_mpiCommParent);
827-
if (nlccFlag > 0 && d_dftParamsPtr->isPseudopotential == true)
828-
d_dftParamsPtr->nonLinearCoreCorrection = true;
829829
if (d_dftParamsPtr->isPseudopotential == true)
830830
{
831831
// pcout<<"dft.cc 827 ONCV Number of cells DEBUG:

src/dft/psiInitialGuess.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace dftfe
5353
//
5454
char psiFile[256];
5555

56-
if (d_dftParamsPtr->isPseudopotential)
56+
if (d_dftParamsPtr->isPseudopotential && d_dftParamsPtr->pseudoTestsFlag)
5757
// if(d_dftParamsPtr->pseudoProjector==2)
5858
// sprintf(psiFile,
5959
// "%s/data/electronicStructure/pseudoPotential/z%u/oncv/singleAtomData/psi%u%u.inp",
@@ -65,7 +65,12 @@ namespace dftfe
6565
Z,
6666
n,
6767
l);
68-
68+
else if (d_dftParamsPtr->isPseudopotential &&
69+
!d_dftParamsPtr->pseudoTestsFlag)
70+
strcpy(psiFile,
71+
(d_dftfeScratchFolderName + "/z" + std::to_string(Z) + "/" +
72+
"psi" + std::to_string(n) + std::to_string(l) + ".inp")
73+
.c_str());
6974
else
7075
sprintf(
7176
psiFile,

0 commit comments

Comments
 (0)