Skip to content

Commit 4891b2e

Browse files
Refactor: add const for Grid_Driver (#5725)
* Refactor: add const for Grid_Driver * add const for Find_atom() in unittests * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 1f9779d commit 4891b2e

File tree

98 files changed

+693
-685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+693
-685
lines changed

source/module_cell/module_neighbor/sltk_grid_driver.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ Grid_Driver::~Grid_Driver()
2121
{
2222
}
2323

24-
25-
void Grid_Driver::Find_atom(
26-
const UnitCell &ucell,
27-
const ModuleBase::Vector3<double> &cartesian_pos,
28-
const int &ntype,
29-
const int &nnumber,
30-
AdjacentAtomInfo *adjs)
24+
void Grid_Driver::Find_atom(const UnitCell& ucell,
25+
const ModuleBase::Vector3<double>& cartesian_pos,
26+
const int& ntype,
27+
const int& nnumber,
28+
AdjacentAtomInfo* adjs) const
3129
{
3230
ModuleBase::timer::tick("Grid_Driver","Find_atom");
3331
// std::cout << "lenght in Find atom = " << atomlink[offset].fatom.getAdjacentSet()->getLength() << std::endl;

source/module_cell/module_neighbor/sltk_grid_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Grid_Driver : public Grid
7070
const ModuleBase::Vector3<double>& cartesian_posi,
7171
const int& ntype,
7272
const int& nnumber,
73-
AdjacentAtomInfo* adjs = nullptr);
73+
AdjacentAtomInfo* adjs = nullptr) const;
7474

7575
//==========================================================
7676
// EXPLAIN : The adjacent information for the input

source/module_elecstate/module_dm/density_matrix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class DensityMatrix
6666
* @param GridD_in pointer of Grid_Driver object (used to find ajacent atoms)
6767
* @param ucell pointer of UnitCell object
6868
*/
69-
void init_DMR(Grid_Driver* GridD_in, const UnitCell* ucell);
69+
void init_DMR(const Grid_Driver* GridD_in, const UnitCell* ucell);
7070

7171
/**
7272
* @brief initialize density matrix DMR from UnitCell and RA

source/module_elecstate/module_dm/density_matrix_io.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace elecstate
1212

1313
// initialize density matrix DMR from UnitCell (mainly used in UnitTest)
1414
template <typename TK, typename TR>
15-
void DensityMatrix<TK, TR>::init_DMR(Grid_Driver* GridD_in, const UnitCell* ucell)
15+
void DensityMatrix<TK, TR>::init_DMR(const Grid_Driver* GridD_in, const UnitCell* ucell)
1616
{
1717
ModuleBase::TITLE("DensityMatrix", "init_DMR");
1818
// ensure _DMR is empty

source/module_elecstate/module_dm/test/test_dm_io.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void Grid_Driver::Find_atom(const UnitCell& ucell,
4848
const ModuleBase::Vector3<double>& tau,
4949
const int& T,
5050
const int& I,
51-
AdjacentAtomInfo* adjs)
51+
AdjacentAtomInfo* adjs) const
5252
{
5353
}
5454
Grid::Grid(const int& test_grid_in) : test_grid(test_grid_in)

source/module_elecstate/module_dm/test/tmp_mocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void Grid_Driver::Find_atom(const UnitCell& ucell,
7878
const ModuleBase::Vector3<double>& tau,
7979
const int& T,
8080
const int& I,
81-
AdjacentAtomInfo* adjs)
81+
AdjacentAtomInfo* adjs) const
8282
{
8383
adjs->adj_num = ucell.nat - 1;
8484
adjs->adjacent_tau.resize(ucell.nat);

source/module_hamilt_lcao/hamilt_lcaodft/FORCE.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Force_LCAO
5151
const bool isstress,
5252
ForceStressArrays& fsr, // mohan add 2024-06-16
5353
const UnitCell& ucell,
54-
Grid_Driver& gd,
54+
const Grid_Driver& gd,
5555
const psi::Psi<T>* psi,
5656
const elecstate::ElecState* pelec,
5757
ModuleBase::matrix& foverlap,
@@ -74,7 +74,7 @@ class Force_LCAO
7474

7575
// get the ds, dt, dvnl.
7676
void allocate(const UnitCell& ucell,
77-
Grid_Driver& gd,
77+
const Grid_Driver& gd,
7878
const Parallel_Orbitals& pv,
7979
ForceStressArrays& fsr, // mohan add 2024-06-15
8080
const TwoCenterBundle& two_center_bundle,

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void Force_Stress_LCAO<T>::getForceStress(const bool isforce,
3636
const bool istestf,
3737
const bool istests,
3838
const UnitCell& ucell,
39-
Grid_Driver& gd,
39+
const Grid_Driver& gd,
4040
Parallel_Orbitals& pv,
4141
const elecstate::ElecState* pelec,
4242
const psi::Psi<T>* psi,
@@ -870,7 +870,7 @@ void Force_Stress_LCAO<double>::integral_part(const bool isGammaOnly,
870870
const bool isforce,
871871
const bool isstress,
872872
const UnitCell& ucell,
873-
Grid_Driver& gd,
873+
const Grid_Driver& gd,
874874
ForceStressArrays& fsr, // mohan add 2024-06-15
875875
const elecstate::ElecState* pelec,
876876
const psi::Psi<double>* psi,
@@ -923,7 +923,7 @@ void Force_Stress_LCAO<std::complex<double>>::integral_part(const bool isGammaOn
923923
const bool isforce,
924924
const bool isstress,
925925
const UnitCell& ucell,
926-
Grid_Driver& gd,
926+
const Grid_Driver& gd,
927927
ForceStressArrays& fsr, // mohan add 2024-06-15
928928
const elecstate::ElecState* pelec,
929929
const psi::Psi<std::complex<double>>* psi,

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Force_Stress_LCAO
3434
const bool istestf,
3535
const bool istests,
3636
const UnitCell& ucell,
37-
Grid_Driver& gd,
37+
const Grid_Driver& gd,
3838
Parallel_Orbitals& pv,
3939
const elecstate::ElecState* pelec,
4040
const psi::Psi<T>* psi,
@@ -82,7 +82,7 @@ class Force_Stress_LCAO
8282
const bool isforce,
8383
const bool isstress,
8484
const UnitCell& ucell,
85-
Grid_Driver& gd,
85+
const Grid_Driver& gd,
8686
ForceStressArrays& fsr, // mohan add 2024-06-15
8787
const elecstate::ElecState* pelec,
8888
const psi::Psi<T>* psi,

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
template <>
1919
void Force_LCAO<double>::allocate(const UnitCell& ucell,
20-
Grid_Driver& gd,
20+
const Grid_Driver& gd,
2121
const Parallel_Orbitals& pv,
2222
ForceStressArrays& fsr, // mohan add 2024-06-15
2323
const TwoCenterBundle& two_center_bundle,
@@ -176,7 +176,7 @@ void Force_LCAO<double>::ftable(const bool isforce,
176176
const bool isstress,
177177
ForceStressArrays& fsr, // mohan add 2024-06-16
178178
const UnitCell& ucell,
179-
Grid_Driver& gd,
179+
const Grid_Driver& gd,
180180
const psi::Psi<double>* psi,
181181
const elecstate::ElecState* pelec,
182182
ModuleBase::matrix& foverlap,

0 commit comments

Comments
 (0)