Skip to content

Commit 87bfe1d

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into develop
2 parents 786868c + 30b51e4 commit 87bfe1d

38 files changed

+3721
-1276
lines changed

source/Makefile.Objects

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ run_lcao.o\
2121

2222
OBJS_PW=xc_type.o \
2323
xc_functional.o\
24-
xc_1.o\
25-
xc_2.o\
2624
xc_3.o \
2725
vdwd2.o\
2826
vdwd2_parameters.o\

source/module_base/complexmatrix.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@ class ComplexMatrix
4848
ComplexMatrix& operator*=(const std::complex<double> &s);
4949
ComplexMatrix& operator+=(const ComplexMatrix &m);
5050
ComplexMatrix& operator-=(const ComplexMatrix &m);
51+
//return a matrix whose element is the real part of element of the ComplexMatrix.
5152
matrix real() const; // Peize Lin add 2017-03-29
5253

5354
//==================
5455
// member function:
5556
//==================
57+
//set all elements to be complex<double> {0.0,0.0}
5658
void zero_out(void);
59+
//set to be a unit matrix,
5760
void set_as_identity_matrix(void);
5861

5962
std::ostream & print( std::ostream & os, const double threshold_abs=0.0, const double threshold_imag=0.0 ) const; // Peize Lin add 2021.09.08
6063

64+
// check if all the elements are real
6165
bool checkreal(void);
6266
};
6367

@@ -68,35 +72,47 @@ ComplexMatrix operator*(const std::complex<double> &s, const ComplexMatrix &m);
6872
ComplexMatrix operator*(const ComplexMatrix &m, const std::complex<double> &s);
6973
ComplexMatrix operator*(const double &s, const ComplexMatrix &m);
7074
ComplexMatrix operator*(const ComplexMatrix &m, const double &s);
71-
75+
76+
//calculate the trace
7277
std::complex<double> trace(const ComplexMatrix &m);
7378

74-
double abs2_row(const ComplexMatrix &m,const int ir); // mohan add 2008-7-1
75-
double abs2_column(const ComplexMatrix &m,const int ic); // mohan add 2008-7-1
79+
//calculate the sum of the square of the modulus of the elements in ir row.
80+
double abs2_row(const ComplexMatrix &m,const int ir); // mohan add 2008-7-1
81+
82+
//calculate the sum of the square of the modulus of the elements in ic-th column.
83+
double abs2_column(const ComplexMatrix &m,const int ic); // mohan add 2008-7-1
84+
85+
// calculate the sum of the square of the modulus of all elements.
7686
double abs2(const ComplexMatrix &m);
87+
88+
// calculate the sum of the square of the modulus of all elements of an array of ComplexMatrix.
7789
double abs2(const int nmat, ComplexMatrix **m);
7890

7991
ComplexMatrix transpose(const ComplexMatrix &m, const bool &conjugate);
8092
ComplexMatrix conj(const ComplexMatrix &m); // Peize Lin add 2019-05-13
8193

94+
//do mout += s*min
8295
void scale_accumulate(
8396
const std::complex<double> &s,
8497
const ComplexMatrix &min,
8598
ComplexMatrix &mout);
8699

100+
//do (*mout[i]) += s * (*min[i]); int i<nmat
87101
void scale_accumulate(
88102
const int &nmat,
89103
const std::complex<double> &s,
90104
ComplexMatrix **min,
91105
ComplexMatrix **mout);
92106

107+
// Do mout = s1*m1 + s2*m2
93108
void scaled_sum(
94109
const std::complex<double> &s1,
95110
const ComplexMatrix &m1,
96111
const std::complex<double> &s2,
97112
const ComplexMatrix &m2,
98113
ComplexMatrix &mout);
99114

115+
// Do (*mout[i]) = s1 * (*m1[i]) + s2 * (*m2[i])
100116
void scaled_sum(
101117
const int &nmat,
102118
const std::complex<double> &s1,

source/module_base/math_integral.h

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,72 @@ class Integral
1313
Integral();
1414
~Integral();
1515

16-
// Peize Lin accelerate 2017-10-02
17-
static void Simpson_Integral
18-
(
16+
/**
17+
* @brief simpson integral.
18+
*
19+
* @param mesh [in] number of grid points (should be odd)
20+
* @param func [in] function to be integrated
21+
* @param rab [in] a list of interval
22+
* @param asum [out] the final integral value
23+
* @author Peize Lin
24+
* @date 2017-10-02
25+
*/
26+
static void Simpson_Integral
27+
(
1928
const int mesh,
2029
const double * const func,
2130
const double * const rab,
2231
double &asum
2332
);
2433

25-
// Peize Lin accelerate 2017-10-02
26-
static void Simpson_Integral
34+
/**
35+
* @brief simpson integral.
36+
*
37+
* @param mesh [in] number of grid points (should be odd)
38+
* @param func [in] function to be integrated
39+
* @param dr [in] interval
40+
* @param asum [out] the final integral value
41+
* @author Peize Lin
42+
* @date 2017-10-02
43+
*/
44+
static void Simpson_Integral
2745
(
2846
const int mesh,
2947
const double * const func,
3048
const double dr,
3149
double &asum
3250
);
3351

34-
// Peize Lin add 2016-02-14
35-
static void Simpson_Integral_0toall
52+
/**
53+
* @brief simpson integral.
54+
*
55+
*
56+
* @param mesh [in] number of grid points
57+
* @param func [in] function to be integrated
58+
* @param rab [in] a list of interval
59+
* @param asum [out] a list of integral value. asum[i] = integral from 0 to i. The max index of asum is an even (mesh-1 or mesh).
60+
* @author Peize Lin
61+
* @date 2016-02-14
62+
*/
63+
static void Simpson_Integral_0toall
3664
(
3765
const int mesh,
3866
const double * const func,
3967
const double * const rab,
4068
double * const asum
4169
);
4270

43-
// Peize Lin add 2016-02-14
44-
static void Simpson_Integral_alltoinf
71+
/**
72+
* @brief simpson integral.
73+
*
74+
* @param mesh [in] number of grid points
75+
* @param func [in] function to be integrated
76+
* @param rab [in] r(i) * dr(i)/di * di or (b-a)/2n
77+
* @param asum [out] a list of integral value. sum[i] = integral from i to mesh-1.
78+
* @author Peize Lin
79+
* @date 2016-02-14
80+
*/
81+
static void Simpson_Integral_alltoinf
4582
(
4683
const int mesh,
4784
const double * const func,

0 commit comments

Comments
 (0)