Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ OBJS_SRCPW=h_ewald_pw.o\
update_cell_pw.o\
dftu_base.o\
dftu_base_io.o\
dftu_base_io_read.o\
dftu_pw.o\
dftu_pw_tools.o\
yukawa_screening.o\
Expand Down
2 changes: 1 addition & 1 deletion source/source_io/module_parameter/read_inp_exx_dftu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ void ReadInput::item_dftu()
* 1: The first SCF step will use an initial density matrix read from a file, but for later steps, the onsite density matrix will be updated.
* 2: The same onsite density matrix read from the file will be used throughout the entire calculation.

[NOTE] The occupation-matrix file is read from the directory specified by read_file_dir. The search order is dm_onsite_ini.txt -> occ_mat.txt -> dm_onsite.txt, so a previously output occ_mat.txt can be reused directly without renaming. The easiest way to obtain such a file is to run a DFT+U calculation with out_occ_mat=1 (the default); the resulting occ_mat.txt in the OUT.prefix directory (which always holds the occupation matrix of the latest electronic step) can be placed in read_file_dir as-is. When out_freq_ion is positive, separate occ_matg{geom_step}.txt files are also written, one per output ionic step; they may contain several electronic-step sections separated by comment headers. The format of the file is rather straight-forward.)";
[NOTE] The occupation-matrix file is read from the directory specified by read_file_dir. The search order is dm_onsite_ini.txt -> occ_mat.txt. Input must use the current compact format written by ABACUS; legacy Atom=/L=/spin= files such as dm_onsite.txt are not supported. The easiest way to obtain a valid file is to run a DFT+U calculation with out_occ_mat=1 (the default); the resulting occ_mat.txt in the OUT.prefix directory (which always holds the occupation matrix of the latest electronic step) can be placed in read_file_dir as-is. When out_freq_ion is positive, separate occ_matg{geom_step}.txt files are also written, one per output ionic step; they may contain several electronic-step sections separated by comment headers.)";
item.default_value = "0";
item.unit = "";
read_sync_int(input.init_occ_mat);
Expand Down
2 changes: 2 additions & 0 deletions source/source_lcao/module_dftu/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ AddTest(
../../../source_estate/module_dm/dmr_full.cpp
../../../source_pw/module_pwdft/dftu_base.cpp
../../../source_pw/module_pwdft/dftu_base_io.cpp
../../../source_pw/module_pwdft/dftu_base_io_read.cpp
../../../source_pw/module_pwdft/yukawa_screening.cpp
../../../source_estate/occ_matrix.cpp
../../../source_estate/occ_mixer.cpp
Expand Down Expand Up @@ -136,6 +137,7 @@ AddTest(
../../../source_estate/module_dm/dmr_full.cpp
../../../source_pw/module_pwdft/dftu_base.cpp
../../../source_pw/module_pwdft/dftu_base_io.cpp
../../../source_pw/module_pwdft/dftu_base_io_read.cpp
../../../source_pw/module_pwdft/yukawa_screening.cpp
../../../source_estate/occ_matrix.cpp
../../../source_estate/occ_mixer.cpp
Expand Down
1 change: 1 addition & 0 deletions source/source_pw/module_pwdft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ endif()
list(APPEND objects
dftu_base.cpp
dftu_base_io.cpp
dftu_base_io_read.cpp
dftu_pw.cpp
dftu_pw_tools.cpp
yukawa_screening.cpp
Expand Down
25 changes: 11 additions & 14 deletions source/source_pw/module_pwdft/dftu_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,20 @@ void Plus_U_Base::init_base(UnitCell& cell,
else
{
// Try the user-prepared dm_onsite_ini.txt first, then fall back to
// the occupation-matrix snapshot written by a previous run
// (occ_mat.txt), and finally to the legacy dm_onsite.txt name.
// the compact occupation-matrix snapshot written by a previous
// run (occ_mat.txt). Legacy dm_onsite.txt input is not supported.
const std::vector<std::string> candidates = {"dm_onsite_ini.txt",
"occ_mat.txt",
"dm_onsite.txt"};
"occ_mat.txt"};
const std::string readin_fn = DFTU_BASE::find_first_existing_file(global_readin_dir, candidates);
if (readin_fn.empty())
{
ModuleBase::WARNING_QUIT("Plus_U_Base::init_base",
"init_occ_mat is set but no occupation-matrix file found in "
+ global_readin_dir
+ ". Tried: dm_onsite_ini.txt, occ_mat.txt, dm_onsite.txt");
+ ". Tried: dm_onsite_ini.txt, occ_mat.txt");
}
DFTU_BASE::read_occup_m(cell, this->occmat_, this->l_channel, this->init_occ_mat,
readin_fn, init_chg, nspin, npol, soc_layout);
DFTU_BASE::read_occup_m(cell, this->occmat_, this->l_channel,
readin_fn, nspin, npol, soc_layout);
#ifdef __MPI
DFTU_BASE::local_occup_bcast(cell, this->occmat_, this->l_channel, nspin, npol);
#endif
Expand All @@ -202,22 +201,20 @@ void Plus_U_Base::init_base(UnitCell& cell,
{
if (init_chg == "file")
{
// occ_mat.txt is the current output name; fall back to the
// legacy dm_onsite.txt so that output directories written by
// older versions can still be used for restarts.
const std::vector<std::string> candidates = {"occ_mat.txt", "dm_onsite.txt"};
// Only the current compact restart output is supported.
const std::vector<std::string> candidates = {"occ_mat.txt"};
const std::string readin_fn = DFTU_BASE::find_first_existing_file(global_readin_dir, candidates);
if (readin_fn.empty())
{
ModuleBase::WARNING_QUIT("Plus_U_Base::init_base",
"init_chg is set to file but no occupation-matrix file "
"found in "
+ global_readin_dir
+ ". Tried: occ_mat.txt, dm_onsite.txt. Please do an scf "
+ ". Tried: occ_mat.txt. Please do an scf "
"calculation first.");
}
DFTU_BASE::read_occup_m(cell, this->occmat_, this->l_channel, this->init_occ_mat,
readin_fn, init_chg, nspin, npol, soc_layout);
DFTU_BASE::read_occup_m(cell, this->occmat_, this->l_channel,
readin_fn, nspin, npol, soc_layout);
#ifdef __MPI
DFTU_BASE::local_occup_bcast(cell, this->occmat_, this->l_channel, nspin, npol);
#endif
Expand Down
Loading
Loading