Skip to content

Commit

Permalink
Fixed an issue in reading the kpoint field.
Browse files Browse the repository at this point in the history
Ignore whitespaces after the KPMODE.
  • Loading branch information
ttadano committed Feb 21, 2016
1 parent 1a41931 commit 72e2a7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion anphon/parsephon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ void Input::parse_kpoints()
error->exit("parse_kpoints", "KPMODE = 3 is valid only when FSTATE_K is true.");
}

ifs_input.ignore();
ifs_input.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

while (std::getline(ifs_input, line)) {

Expand All @@ -571,6 +571,8 @@ void Input::parse_kpoints()

std::istringstream is(line);

std::cout << "line = " << line << std::endl;

while (1) {
str_tmp.clear();
is >> str_tmp;
Expand All @@ -579,6 +581,7 @@ void Input::parse_kpoints()
}
kpelem.push_back(str_tmp);
}
std::cout << "kpelem.size = " << kpelem.size() << std::endl;

if (kpmode == 0 && kpelem.size() != 3) {
error->exit("parse_kpoints", "The number of entries has to be 3 when KPMODE = 0");
Expand Down

0 comments on commit 72e2a7e

Please sign in to comment.