Skip to content

Commit

Permalink
make nk non-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 committed Oct 16, 2024
1 parent 1c2e28c commit 68158c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions source/module_elecstate/module_dm/density_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class DensityMatrix
* (usually {nspin_global -> nspin_dm} = {1->1, 2->2, 4->1}, but sometimes 2->1 like in LR-TDDFT)
* @param kvec_d direct coordinates of kpoints
* @param nk number of k-points, not always equal to K_Vectors::get_nks()/nspin_dm.
* if remains default or large than kvec_d.size(), it will be set to kvec_d.size()
* it will be set to kvec_d.size() if the value is invalid
*/
DensityMatrix(const Parallel_Orbitals* _paraV, const int nspin, const std::vector<ModuleBase::Vector3<double>>& kvec_d, const int nk = -1);
DensityMatrix(const Parallel_Orbitals* _paraV, const int nspin, const std::vector<ModuleBase::Vector3<double>>& kvec_d, const int nk);

/**
* @brief Constructor of class DensityMatrix for gamma-only calculation, where kvector is not required
Expand Down
4 changes: 2 additions & 2 deletions source/module_elecstate/module_dm/test/test_dm_R_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ TEST_F(DMTest, DMInit1)
// construct DM
std::cout << "dim0: " << paraV->dim0 << " dim1:" << paraV->dim1 << std::endl;
std::cout << "nrow: " << paraV->nrow << " ncol:" << paraV->ncol << std::endl;
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d);
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d, nks);
// initialize this->_DMR
Grid_Driver gd(0,0);
DM.init_DMR(&gd, &ucell);
Expand All @@ -145,7 +145,7 @@ TEST_F(DMTest, DMInit2)
// construct DM
std::cout << "dim0: " << paraV->dim0 << " dim1:" << paraV->dim1 << std::endl;
std::cout << "nrow: " << paraV->nrow << " ncol:" << paraV->ncol << std::endl;
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d);
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d, nks);
// initialize Record_adj using Grid_Driver
Grid_Driver gd(0,0);
Record_adj ra;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ TEST_F(DMTest, DMConstructor_nspin1)
std::cout << "dim0: " << paraV->dim0 << " dim1:" << paraV->dim1 << std::endl;
std::cout << "nrow: " << paraV->nrow << " ncol:" << paraV->ncol << std::endl;
int nspin = 1;
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d);
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d, nks);
// compare
EXPECT_EQ(DM.get_DMK_nks(), kv->get_nks());
EXPECT_EQ(DM.get_DMK_nrow(), paraV->nrow);
Expand Down
4 changes: 2 additions & 2 deletions source/module_elecstate/module_dm/test/test_dm_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST_F(DMTest, DMConstructor1)
int nspin = 1;
// construct DM
std::cout << paraV->nrow << paraV->ncol << std::endl;
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d);
elecstate::DensityMatrix<double, double> DM(paraV, nspin, kv->kvec_d, kv->get_nks());
// read DMK
std::string directory = "./support/";
for (int is = 1; is <= nspin; ++is)
Expand All @@ -162,7 +162,7 @@ TEST_F(DMTest, DMConstructor1)
}
}
// construct a new DM
elecstate::DensityMatrix<double, double> DM1(paraV, nspin, kv->kvec_d);
elecstate::DensityMatrix<double, double> DM1(paraV, nspin, kv->kvec_d, kv->get_nks());
directory = "./support/output";
for (int is = 1; is <= nspin; ++is)
{
Expand Down

0 comments on commit 68158c9

Please sign in to comment.