Skip to content
Merged
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: 0 additions & 1 deletion source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ OBJS_IO=input_conv.o\
output.o\
print_info.o\
read_cube.o\
read_rho.o\
rhog_io.o\
read_exit_file.o\
read_wfc_pw.o\
Expand Down
62 changes: 29 additions & 33 deletions source/module_elecstate/module_charge/charge_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "module_elecstate/magnetism.h"
#include "module_hamilt_pw/hamilt_pwdft/global.h"
#include "module_hamilt_pw/hamilt_pwdft/parallel_grid.h"
#include "module_io/rho_io.h"
#include "module_io/cube_io.h"
#include "module_io/rhog_io.h"
#include "module_io/read_wfc_to_rho.h"
#ifdef USE_PAW
Expand Down Expand Up @@ -54,24 +54,22 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
std::stringstream ssc;
ssc << PARAM.globalv.global_readin_dir << "SPIN" << is + 1 << "_CHG.cube";
double& ef_tmp = eferm_iout.get_ef(is);
if (ModuleIO::read_rho(
if (ModuleIO::read_cube(
#ifdef __MPI
&(GlobalC::Pgrid),
& (GlobalC::Pgrid),
#endif
GlobalV::MY_RANK,
PARAM.inp.esolver_type,
GlobalV::RANK_IN_STOGROUP,
is,
GlobalV::ofs_running,
PARAM.inp.nspin,
ssc.str(),
this->rho[is],
this->rhopw->nx,
this->rhopw->ny,
this->rhopw->nz,
ef_tmp,
&(GlobalC::ucell),
this->prenspin))
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_STOGROUP : GlobalV::MY_RANK),
is,
GlobalV::ofs_running,
PARAM.inp.nspin,
ssc.str(),
this->rho[is],
this->rhopw->nx,
this->rhopw->ny,
this->rhopw->nz,
ef_tmp,
& (GlobalC::ucell),
this->prenspin))
{
GlobalV::ofs_running << " Read in the charge density: " << ssc.str() << std::endl;
}
Expand Down Expand Up @@ -129,24 +127,22 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
GlobalV::ofs_running << " try to read kinetic energy density from file : " << ssc.str()
<< std::endl;
// mohan update 2012-02-10, sunliang update 2023-03-09
if (ModuleIO::read_rho(
if (ModuleIO::read_cube(
#ifdef __MPI
&(GlobalC::Pgrid),
& (GlobalC::Pgrid),
#endif
GlobalV::MY_RANK,
PARAM.inp.esolver_type,
GlobalV::RANK_IN_STOGROUP,
is,
GlobalV::ofs_running,
PARAM.inp.nspin,
ssc.str(),
this->kin_r[is],
this->rhopw->nx,
this->rhopw->ny,
this->rhopw->nz,
eferm_iout.ef,
&(GlobalC::ucell),
this->prenspin))
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_STOGROUP : GlobalV::MY_RANK),
is,
GlobalV::ofs_running,
PARAM.inp.nspin,
ssc.str(),
this->kin_r[is],
this->rhopw->nx,
this->rhopw->ny,
this->rhopw->nz,
eferm_iout.ef,
& (GlobalC::ucell),
this->prenspin))
{
GlobalV::ofs_running << " Read in the kinetic energy density: " << ssc.str() << std::endl;
}
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/cal_edm_tddft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "module_io/cal_r_overlap_R.h"
#include "module_io/dipole_io.h"
#include "module_io/rho_io.h"
#include "module_io/td_current_io.h"
#include "module_io/write_HS.h"
#include "module_io/write_HS_R.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/esolver_ks_lcao_tddft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "module_io/cal_r_overlap_R.h"
#include "module_io/dipole_io.h"
#include "module_io/rho_io.h"
#include "module_io/td_current_io.h"
#include "module_io/write_HS.h"
#include "module_io/write_HS_R.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/esolver_ks_lcaopw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "module_io/berryphase.h"
#include "module_io/numerical_basis.h"
#include "module_io/numerical_descriptor.h"
#include "module_io/rho_io.h"
#include "module_io/to_wannier90_pw.h"
#include "module_io/winput.h"
#include "module_io/write_elecstat_pot.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/lcao_gets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.h"
#include "module_hamilt_lcao/module_deltaspin/spin_constrain.h"
#include "module_io/read_wfc_nao.h"
#include "module_io/rho_io.h"
#include "module_io/write_elecstat_pot.h"
#include "module_io/write_wfc_nao.h"
#ifdef __EXX
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/lcao_nscf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.h"
#include "module_hamilt_lcao/module_deltaspin/spin_constrain.h"
#include "module_io/read_wfc_nao.h"
#include "module_io/rho_io.h"
#include "module_io/write_elecstat_pot.h"
#include "module_io/write_wfc_nao.h"
#ifdef __EXX
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/lcao_others.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.h"
#include "module_hamilt_lcao/module_deltaspin/spin_constrain.h"
#include "module_io/read_wfc_nao.h"
#include "module_io/rho_io.h"
#include "module_io/write_elecstat_pot.h"
#include "module_io/write_wfc_nao.h"
#ifdef __EXX
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/pw_fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "module_io/berryphase.h"
#include "module_io/numerical_basis.h"
#include "module_io/numerical_descriptor.h"
#include "module_io/rho_io.h"
#include "module_io/to_wannier90_pw.h"
#include "module_io/winput.h"
#include "module_io/write_elecstat_pot.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/pw_init_after_vc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "module_io/berryphase.h"
#include "module_io/numerical_basis.h"
#include "module_io/numerical_descriptor.h"
#include "module_io/rho_io.h"
#include "module_io/to_wannier90_pw.h"
#include "module_io/winput.h"
#include "module_io/write_elecstat_pot.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/pw_init_globalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "module_io/berryphase.h"
#include "module_io/numerical_basis.h"
#include "module_io/numerical_descriptor.h"
#include "module_io/rho_io.h"
#include "module_io/to_wannier90_pw.h"
#include "module_io/winput.h"
#include "module_io/write_elecstat_pot.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/pw_nscf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "module_io/berryphase.h"
#include "module_io/numerical_basis.h"
#include "module_io/numerical_descriptor.h"
#include "module_io/rho_io.h"
#include "module_io/to_wannier90_pw.h"
#include "module_io/winput.h"
#include "module_io/write_elecstat_pot.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/pw_others.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "module_io/berryphase.h"
#include "module_io/numerical_basis.h"
#include "module_io/numerical_descriptor.h"
#include "module_io/rho_io.h"
#include "module_io/to_wannier90_pw.h"
#include "module_io/winput.h"
#include "module_io/write_elecstat_pot.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_esolver/set_matrix_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.h"
#include "module_hamilt_pw/hamilt_pwdft/global.h"
#include "module_io/read_wfc_nao.h"
#include "module_io/rho_io.h"
#include "module_io/write_elecstat_pot.h"
#include "module_io/write_wfc_nao.h"
#include "module_parameter/parameter.h"
Expand Down
1 change: 0 additions & 1 deletion source/module_io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ list(APPEND objects
output.cpp
print_info.cpp
read_cube.cpp
read_rho.cpp
rhog_io.cpp
read_exit_file.cpp
read_wfc_pw.cpp
Expand Down
2 changes: 0 additions & 2 deletions source/module_io/cube_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ bool read_cube(
const Parallel_Grid*const Pgrid,
#endif
const int my_rank,
const std::string esolver_type,
const int rank_in_stogroup,
const int is,
std::ofstream& ofs_running,
const int nspin,
Expand Down
7 changes: 2 additions & 5 deletions source/module_io/read_cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ bool ModuleIO::read_cube(
const Parallel_Grid*const Pgrid,
#endif
const int my_rank,
const std::string esolver_type,
const int rank_in_stogroup,
const int is,
std::ofstream& ofs_running,
const int nspin,
Expand Down Expand Up @@ -112,12 +110,11 @@ bool ModuleIO::read_cube(
}
}

const bool flag_read_rank = (my_rank == 0 || (esolver_type == "sdft" && rank_in_stogroup == 0));
#ifdef __MPI
if(nx == nx_read && ny == ny_read && nz == nz_read)
ModuleIO::read_cube_core_match(ifs, Pgrid, flag_read_rank, data, nx*ny, nz);
ModuleIO::read_cube_core_match(ifs, Pgrid, (my_rank == 0), data, nx * ny, nz);
else
ModuleIO::read_cube_core_mismatch(ifs, Pgrid, flag_read_rank, data, nx, ny, nz, nx_read, ny_read, nz_read);
ModuleIO::read_cube_core_mismatch(ifs, Pgrid, (my_rank == 0), data, nx, ny, nz, nx_read, ny_read, nz_read);
#else
ofs_running << " Read SPIN = " << is + 1 << " charge now." << std::endl;
if(nx == nx_read && ny == ny_read && nz == nz_read)
Expand Down
42 changes: 0 additions & 42 deletions source/module_io/read_rho.cpp

This file was deleted.

31 changes: 0 additions & 31 deletions source/module_io/rho_io.h

This file was deleted.

2 changes: 1 addition & 1 deletion source/module_io/test_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ AddTest(
AddTest(
TARGET io_rho_io
LIBS parameter ${math_libs} base device cell_info
SOURCES rho_io_test.cpp ../read_cube.cpp ../write_cube.cpp ../read_rho.cpp ../output.cpp
SOURCES rho_io_test.cpp ../read_cube.cpp ../write_cube.cpp ../output.cpp
)

AddTest(
Expand Down
6 changes: 2 additions & 4 deletions source/module_io/test_serial/rho_io_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "module_io/rho_io.h"
#include "module_io/cube_io.h"

#include "gmock/gmock.h"
#include "gtest/gtest.h"
Expand Down Expand Up @@ -59,8 +59,6 @@ class RhoIOTest : public ::testing::Test
UnitCell* ucell;

int my_rank = 0;
std::string esolver_type = "ksdft";
int rank_in_stogroup = 0;
std::ofstream ofs_running = std::ofstream("unittest.log");

void SetUp()
Expand Down Expand Up @@ -93,7 +91,7 @@ TEST_F(RhoIOTest, Read)
double ef;
UcellTestPrepare utp = UcellTestLib["Si"];
ucell = utp.SetUcellInfo();
ModuleIO::read_rho(my_rank, esolver_type, rank_in_stogroup, is, ofs_running, nspin, fn, rho[is], nx, ny, nz, ef, ucell, prenspin);
ModuleIO::read_cube(my_rank, is, ofs_running, nspin, fn, rho[is], nx, ny, nz, ef, ucell, prenspin);
EXPECT_DOUBLE_EQ(ef, 0.461002);
EXPECT_DOUBLE_EQ(rho[0][0], 1.27020863940e-03);
EXPECT_DOUBLE_EQ(rho[0][46655], 1.33581335706e-02);
Expand Down
6 changes: 2 additions & 4 deletions source/module_lr/esolver_lrtd_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <memory>
#include "module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.h"
#include "module_io/read_wfc_nao.h"
#include "module_io/rho_io.h"
#include "module_io/cube_io.h"
#include "module_io/print_info.h"
#include "module_cell/module_neighbor/sltk_atom_arrange.h"
#include "module_lr/utils/lr_util_print.h"
Expand Down Expand Up @@ -596,13 +596,11 @@ void LR::ESolver_LR<T, TR>::read_ks_chg(Charge& chg_gs)
ssc << PARAM.globalv.global_readin_dir << "SPIN" << is + 1 << "_CHG.cube";
GlobalV::ofs_running << ssc.str() << std::endl;
double ef;
if (ModuleIO::read_rho(
if (ModuleIO::read_cube(
#ifdef __MPI
& (GlobalC::Pgrid),
#endif
GlobalV::MY_RANK,
PARAM.inp.esolver_type,
GlobalV::RANK_IN_STOGROUP,
is,
GlobalV::ofs_running,
this->nspin,
Expand Down
Loading