Skip to content

Commit

Permalink
fix a possible bug when dir is auto (#4948)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qianruipku authored Aug 11, 2024
1 parent b1b03fe commit b71534f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 34 deletions.
38 changes: 6 additions & 32 deletions source/module_io/read_input_item_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,58 +605,32 @@ void ReadInput::item_system()
Input_Item item("pseudo_dir");
item.annotation = "the directory containing pseudo files";
item.read_value = [](const Input_Item& item, Parameter& para) {
para.input.pseudo_dir = strvalue;
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
if(para.input.pseudo_dir == "auto")
if(item.get_size() == 0)
{
para.input.pseudo_dir = "";
}
else
{
para.input.pseudo_dir = to_dir(para.input.pseudo_dir);
}
};
item.get_final_value = [](Input_Item& item, const Parameter& para) {
if (para.input.pseudo_dir == "")
{
item.final_value << "auto";
}
else
{
item.final_value << para.input.pseudo_dir;
para.input.pseudo_dir = to_dir(strvalue);
}
};
add_string_bcast(input.pseudo_dir);
sync_string(input.pseudo_dir);
this->add_item(item);
}
{
Input_Item item("orbital_dir");
item.annotation = "the directory containing orbital files";
item.read_value = [](const Input_Item& item, Parameter& para) {
para.input.orbital_dir = strvalue;
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
if(para.input.orbital_dir == "auto")
if(item.get_size() == 0)
{
para.input.orbital_dir = "";
}
else
{
para.input.orbital_dir = to_dir(para.input.orbital_dir);
}
};
item.get_final_value = [](Input_Item& item, const Parameter& para) {
if (para.input.orbital_dir == "")
{
item.final_value << "auto";
}
else
{
item.final_value << para.input.orbital_dir;
para.input.orbital_dir = to_dir(strvalue);
}
};
add_string_bcast(input.orbital_dir);
sync_string(input.orbital_dir);
this->add_item(item);
}
{
Expand Down
4 changes: 2 additions & 2 deletions source/module_parameter/input_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ struct Input_para
std::string stru_file = "STRU"; ///< file contains atomic positions --
///< xiaohui modify 2015-02-01
std::string kpoint_file = "KPT"; ///< file contains k-points -- xiaohui modify 2015-02-01
std::string pseudo_dir = "auto"; ///< directory of pseudopotential
std::string orbital_dir = "auto"; ///< directory of orbital file
std::string pseudo_dir = ""; ///< directory of pseudopotential
std::string orbital_dir = ""; ///< directory of orbital file
std::string read_file_dir = "auto"; ///< directory of files for reading
bool restart_load = false;
std::string wannier_card = "none"; ///< input card for wannier functions.
Expand Down

0 comments on commit b71534f

Please sign in to comment.