Skip to content

Commit 1158136

Browse files
committed
clang-format change.
1 parent dbb8ebd commit 1158136

File tree

12 files changed

+312
-323
lines changed

12 files changed

+312
-323
lines changed

source/source_lcao/module_deepks/LCAO_deepks.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class LCAO_Deepks
6868
// private variables
6969
//-------------------
7070
// private:
71-
public: // change to public to reconstuct the code, 2024-07-22 by mohan
72-
DeePKS_Param deepks_param; // parameters for DeePKS
71+
public: // change to public to reconstuct the code, 2024-07-22 by mohan
72+
DeePKS_Param deepks_param; // parameters for DeePKS
7373

7474
bool init_pdm = false; // for DeePKS NSCF calculation, set init_pdm to skip the calculation of pdm in SCF iteration
7575

source/source_lcao/module_deepks/LCAO_deepks_interface.cpp

Lines changed: 131 additions & 151 deletions
Large diffs are not rendered by default.

source/source_lcao/module_deepks/LCAO_deepks_interface.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
#ifdef __MLALGO
55
#include "LCAO_deepks.h"
6-
#include "source_lcao/hamilt_lcao.h"
76
#include "source_base/complexmatrix.h"
87
#include "source_base/matrix.h"
8+
#include "source_lcao/hamilt_lcao.h"
99

1010
#include <memory>
1111

@@ -47,18 +47,16 @@ class LCAO_Deepks_Interface
4747
const elecstate::DensityMatrix<TK, double>* dm,
4848
hamilt::HamiltLCAO<TK, TR>* p_ham,
4949
const int& iter,
50-
const bool& conv_esolver,
50+
const bool& conv_esolver,
5151
const int rank,
5252
std::ostream& ofs_running);
53-
53+
5454
/// @brief Get the filename for deepks output files
5555
/// @param file_type Type of the file (e.g., "etot", "ftot", etc.)
5656
/// @param label_type Type of the label (from PARAM.inp.deepks_out_labels)
5757
/// @param iter Iteration number (e.g., -1 for after_scf, or specific iteration number)
5858
/// @return The full path to the output file
59-
std::string get_filename(const std::string& file_type,
60-
const int& label_type,
61-
const int& iter);
59+
std::string get_filename(const std::string& file_type, const int& label_type, const int& iter);
6260

6361
private:
6462
std::shared_ptr<LCAO_Deepks<TK>> ld;

source/source_lcao/module_deepks/LCAO_deepks_io.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ void LCAO_deepks_io::save_npy_d(const int nat,
102102
npy_des.push_back(accessor[im]);
103103
}
104104
}
105-
const long unsigned dshape[] = {static_cast<unsigned long>(nat), static_cast<unsigned long>(deepks_param.des_per_atom)};
105+
const long unsigned dshape[]
106+
= {static_cast<unsigned long>(nat), static_cast<unsigned long>(deepks_param.des_per_atom)};
106107
if (rank == 0)
107108
{
108109
npy::SaveArrayAsNumpy(dm_eig_file, false, 2, dshape, npy_des);
@@ -120,7 +121,8 @@ void LCAO_deepks_io::save_npy_d(const int nat,
120121
npy_des.push_back(accessor[i]);
121122
}
122123
}
123-
const long unsigned dshape[] = {static_cast<unsigned long>(nat), static_cast<unsigned long>(deepks_param.des_per_atom)};
124+
const long unsigned dshape[]
125+
= {static_cast<unsigned long>(nat), static_cast<unsigned long>(deepks_param.des_per_atom)};
124126
if (rank == 0)
125127
{
126128
npy::SaveArrayAsNumpy(dm_eig_file, false, 2, dshape, npy_des);

source/source_lcao/module_deepks/deepks_basic.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,7 @@ void DeePKS_domain::cal_edelta_gedm_equiv(const int nat,
144144
ModuleBase::timer::tick("DeePKS_domain", "cal_edelta_gedm_equiv");
145145

146146
const std::string file_d = PARAM.globalv.global_out_dir + "deepks_dm_eig.npy";
147-
LCAO_deepks_io::save_npy_d(nat,
148-
PARAM.inp.deepks_equiv,
149-
deepks_param,
150-
descriptor,
151-
file_d,
147+
LCAO_deepks_io::save_npy_d(nat, PARAM.inp.deepks_equiv, deepks_param, descriptor, file_d,
152148
rank); // libnpy needed
153149

154150
if (rank == 0)

source/source_lcao/module_deepks/deepks_check.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ void DeePKS_domain::check_tensor(const torch::Tensor& tensor, const std::string&
5656
ofs.close();
5757
}
5858

59-
60-
61-
template void DeePKS_domain::check_tensor<int>(const torch::Tensor& tensor, const std::string& filename, const int rank);
62-
template void DeePKS_domain::check_tensor<double>(const torch::Tensor& tensor, const std::string& filename, const int rank);
63-
template void DeePKS_domain::check_tensor<std::complex<double>>(const torch::Tensor& tensor, const std::string& filename, const int rank);
59+
template void DeePKS_domain::check_tensor<int>(const torch::Tensor& tensor,
60+
const std::string& filename,
61+
const int rank);
62+
template void DeePKS_domain::check_tensor<double>(const torch::Tensor& tensor,
63+
const std::string& filename,
64+
const int rank);
65+
template void DeePKS_domain::check_tensor<std::complex<double>>(const torch::Tensor& tensor,
66+
const std::string& filename,
67+
const int rank);
6468

6569
#endif

source/source_lcao/module_deepks/deepks_fpre.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "source_base/parallel_reduce.h"
99
#include "source_base/timer.h"
1010
#include "source_base/vector3.h"
11-
#include "source_lcao/module_hcontainer/atom_pair.h"
1211
#include "source_io/module_parameter/parameter.h"
12+
#include "source_lcao/module_hcontainer/atom_pair.h"
1313

1414
/// this subroutine calculates the gradient of projected density matrices
1515
/// gdmx_m,m = d/dX sum_{mu,nu} rho_{mu,nu} <chi_mu|alpha_m><alpha_m'|chi_nu>
@@ -161,8 +161,10 @@ void DeePKS_domain::cal_gvx(const int nat,
161161
for (int nl = 0; nl < nlmax; ++nl)
162162
{
163163
int nm = 2 * deepks_param.inl2l[nl] + 1;
164-
torch::Tensor gdmx_sliced
165-
= gdmx.slice(2, nl, deepks_param.inlmax, nlmax).slice(3, 0, nm, 1).slice(4, 0, nm, 1).permute({1, 0, 2, 3, 4});
164+
torch::Tensor gdmx_sliced = gdmx.slice(2, nl, deepks_param.inlmax, nlmax)
165+
.slice(3, 0, nm, 1)
166+
.slice(4, 0, nm, 1)
167+
.permute({1, 0, 2, 3, 4});
166168
gdmr.push_back(gdmx_sliced);
167169
}
168170

source/source_lcao/module_deepks/deepks_param.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
#define LCAO_DEEPKS_PARAM
33

44
#include <vector>
5-
namespace ModuleBase { struct IntArray; }
5+
namespace ModuleBase
6+
{
7+
struct IntArray;
8+
}
69

710
struct DeePKS_Param
811
{

source/source_lcao/module_deepks/deepks_spre.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ void DeePKS_domain::cal_gvepsl(const int nat,
172172
for (int nl = 0; nl < nlmax; ++nl)
173173
{
174174
int nm = 2 * deepks_param.inl2l[nl] + 1;
175-
torch::Tensor gdmepsl_sliced = gdmepsl.slice(1, nl, deepks_param.inlmax, nlmax).slice(2, 0, nm, 1).slice(3, 0, nm, 1);
175+
torch::Tensor gdmepsl_sliced
176+
= gdmepsl.slice(1, nl, deepks_param.inlmax, nlmax).slice(2, 0, nm, 1).slice(3, 0, nm, 1);
176177
gdmepsl_vector.push_back(gdmepsl_sliced);
177178
}
178179
assert(gdmepsl_vector.size() == nlmax);

source/source_lcao/module_deepks/deepks_spre.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@ namespace DeePKS_domain
3232
// calculate the gradient of pdm with regard to atomic virial stress tensor
3333
// d/d\epsilon D_{Inl,mm'}
3434
template <typename TK>
35-
void cal_gdmepsl(
36-
const int nks,
37-
const DeePKS_Param& deepks_param,
38-
const std::vector<ModuleBase::Vector3<double>>& kvec_d,
39-
std::vector<hamilt::HContainer<double>*> phialpha,
40-
const hamilt::HContainer<double>* dmr,
41-
const UnitCell& ucell,
42-
const LCAO_Orbitals& orb,
43-
const Parallel_Orbitals& pv,
44-
const Grid_Driver& GridD,
45-
torch::Tensor& gdmepsl);
35+
void cal_gdmepsl(const int nks,
36+
const DeePKS_Param& deepks_param,
37+
const std::vector<ModuleBase::Vector3<double>>& kvec_d,
38+
std::vector<hamilt::HContainer<double>*> phialpha,
39+
const hamilt::HContainer<double>* dmr,
40+
const UnitCell& ucell,
41+
const LCAO_Orbitals& orb,
42+
const Parallel_Orbitals& pv,
43+
const Grid_Driver& GridD,
44+
torch::Tensor& gdmepsl);
4645

4746
void cal_gvepsl(const int nat,
4847
const DeePKS_Param& deepks_param,

0 commit comments

Comments
 (0)