Skip to content

Commit e67b42f

Browse files
committed
Merge branch 'TDDFT_GPU_phase_1' of github.com:AsTonyshment/abacus-develop into TDDFT_GPU_phase_1
2 parents ac4e737 + 8ed6407 commit e67b42f

Some content is hidden

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

70 files changed

+491
-399
lines changed

docs/quick_start/input.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ The `INPUT` file contains parameters that control the type of calculation as wel
88

99
Below is an example `INPUT` file with some of the most important parameters that need to be set:
1010

11-
```
11+
```plaintext
1212
INPUT_PARAMETERS
1313
suffix MgO
1414
ntype 2
1515
pseudo_dir ./
16-
orbital_dir ./
17-
ecutwfc 100 # Rydberg
18-
scf_thr 1e-4 # Rydberg
19-
basis_type lcao
20-
calculation scf # this is the key parameter telling abacus to do a scf calculation
21-
out_chg True
16+
orbital_dir ./
17+
ecutwfc 100 # in Rydberg
18+
scf_thr 1e-4 # Rydberg
19+
basis_type lcao
20+
calculation scf # this is the key parameter telling abacus to do a scf calculation
21+
out_chg True
2222
```
2323

2424
The parameter list always starts with key word `INPUT_PARAMETERS`. Any content before `INPUT_PARAMETERS` will be ignored.
@@ -40,22 +40,23 @@ In the above example, the meanings of the parameters are:
4040
- `ntype` : how many types of elements in the unit cell
4141
- `pseudo_dir` : the directory where pseudopotential files are provided
4242
- `orbital_dir` : the directory where orbital files are provided
43-
- `ecutwfc` : the plane-wave energy cutoff for the wave function expansion (UNIT: Rydberg)
44-
- `scf_thr` : the threshold for the convergence of charge density (UNIT: Rydberg)
43+
- `ecutwfc` : the plane-wave energy cutoff for the wave function expansion (UNIT: Rydberg)
44+
- `scf_thr` : the threshold for the convergence of charge density (UNIT: Rydberg)
4545
- `basis_type` : the type of basis set for expanding the electronic wave functions
4646
- `calculation` : the type of calculation to be performed by ABACUS
47-
- `out_chg` : if true, output thee charge density oon real space grid
47+
- `out_chg` : if true, output the charge density on real space grid
4848

4949
For a complete list of input parameters, please consult this [instruction](../advanced/input_files/input-main.md).
5050

51-
> **Note:** Users cannot change the filename “INPUT” to other names. Boolean paramerters such as `out_chg` can be set by using `True` and `False`, `1` and `0`, or `T` and `F`. It is case insensitive so that other preferences such as `true` and `false`, `TRUE` and `FALSE`, and `t` and `f` for setting boolean values are also supported.
51+
> **Note:** Users cannot change the filename “INPUT” to other names. Boolean paramerters such as `out_chg` can be set by using `True` and `False`, `1` and `0`, or `T` and `F`. It is case insensitive so that other preferences such as `true` and `false`, `TRUE` and `FALSE`, and `t` and `f` for setting boolean values are also supported. Specifically for the `out_chg`, `-1` option is also available, which means turn off the checkpoint of charge density in binary (always dumped in `OUT.{suffix}`, whose name ends with `CHARGE-DENSITY.restart`). Some parameters controlling the output also support a second option to control the output precision, e.g., `out_chg True 8` will output the charge density on realspace grid with 8 digits after the decimal point.
5252
5353
## *STRU*
5454

55-
The structure file contains structural information about the system, e.g., lattice constant, lattice vectors, and positions of the atoms within a unit cell. The positions can be given either in direct or Cartesian coordinates.
55+
The structure file contains structural information about the system, e.g., lattice constant, lattice vectors, and positions of the atoms within a unit cell. The positions can be given either in direct or Cartesian coordinates.
5656

5757
An example of the `STRU` file is given as follows :
58-
```
58+
59+
```plaintext
5960
#This is the atom file containing all the information
6061
#about the lattice structure.
6162
@@ -68,7 +69,7 @@ Mg_gga_8au_100Ry_4s2p1d.orb
6869
O_gga_8au_100Ry_2s2p1d.orb
6970
7071
LATTICE_CONSTANT
71-
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
72+
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
7273
7374
LATTICE_VECTORS
7475
4.25648 0.00000 0.00000
@@ -100,9 +101,10 @@ For a more detailed description of STRU file, please consult [here](../advanced/
100101
## *KPT*
101102

102103
This file contains information of the kpoint grid setting for the Brillouin zone sampling.
103-
104+
104105
An example of the `KPT` file is given below:
105-
```
106+
107+
```plaintext
106108
K_POINTS
107109
0
108110
Gamma
@@ -111,7 +113,6 @@ Gamma
111113

112114
> **Note:** users may choose a different name for their k-point file using keyword `kpoint_file`
113115
114-
115116
For a more detailed description, please consult [here](../advanced/input_files/kpt.md).
116117

117118
- The pseudopotential files

source/module_base/intarray.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,14 @@ class IntArray
141141
}
142142

143143
private:
144-
int size;
145-
int dim;
146-
int bound1, bound2, bound3, bound4, bound5, bound6;
144+
int size=0;
145+
int dim=0;
146+
int bound1=0;
147+
int bound2=0;
148+
int bound3=0;
149+
int bound4=0;
150+
int bound5=0;
151+
int bound6=0;
147152
static int arrayCount;
148153
void freemem();
149154
};

source/module_base/inverse_matrix.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class Inverse_Matrix_Complex
2020
void init( const int &dim_in);
2121

2222
private:
23-
int dim;
24-
double *e;
25-
int lwork;
26-
std::complex<double> *work2;
27-
double* rwork;
28-
int info;
29-
bool allocate; //mohan add 2012-04-02
23+
int dim=0;
24+
double *e=nullptr;
25+
int lwork=0;
26+
std::complex<double> *work2=nullptr;
27+
double* rwork=nullptr;
28+
int info=0;
29+
bool allocate=false; //mohan add 2012-04-02
3030

3131
ModuleBase::ComplexMatrix EA;
3232
};

source/module_base/memory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ void Memory::print_all(std::ofstream &ofs)
436436
#if defined(__CUDA) || defined(__ROCM)
437437
if(!init_flag_gpu)
438438
{
439+
delete[] print_flag;
439440
return;
440441
}
441442

source/module_base/parallel_2d.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,24 @@ bool Parallel_2D::in_this_processor(const int iw1_all, const int iw2_all) const
1212

1313
int Parallel_2D::get_global_row_size() const
1414
{
15+
if (!is_serial)
16+
{
1517
#ifdef __MPI
16-
return desc[2];
17-
#else
18-
return nrow;
18+
return desc[2];
1919
#endif
20+
}
21+
return nrow;
2022
}
2123

2224
int Parallel_2D::get_global_col_size() const
2325
{
26+
if (!is_serial)
27+
{
2428
#ifdef __MPI
25-
return desc[3];
26-
#else
27-
return ncol;
29+
return desc[3];
2830
#endif
31+
}
32+
return ncol;
2933
}
3034

3135
#ifdef __MPI
@@ -133,6 +137,7 @@ void Parallel_2D::set_serial(const int mg, const int ng)
133137
std::iota(local2global_col_.begin(), local2global_col_.end(), 0);
134138
global2local_row_ = local2global_row_;
135139
global2local_col_ = local2global_col_;
140+
is_serial = true;
136141
#ifdef __MPI
137142
blacs_ctxt = -1;
138143
#endif

source/module_base/parallel_2d.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ class Parallel_2D
129129
/// process coordinate in the BLACS grid
130130
int coord[2] = {-1, -1};
131131

132+
/// whether to use the serial mode
133+
bool is_serial = false;
134+
132135
protected:
133136
/// map from global index to local index
134137
std::vector<int> global2local_row_;

source/module_basis/module_ao/ORB_nonlocal.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Numerical_Nonlocal::Numerical_Nonlocal()
77
//question remains
88
this->type = 0;
99
this->lmax = 0;
10+
this->rcut_max = 0.0;
1011
this->Proj = new Numerical_Nonlocal_Lm[1];
1112
this->nproj = -1;
1213
//zhengdy-soc, for optimize nonlocal part
@@ -49,6 +50,7 @@ void Numerical_Nonlocal::set_type_info
4950
//----------------------------------------------------------
5051
//only store radial function
5152
delete[] Proj;
53+
this->Proj = nullptr;
5254
this->Proj = new Numerical_Nonlocal_Lm[this->nproj];
5355

5456
for (int p1=0; p1<nproj; p1++)

source/module_basis/module_ao/ORB_nonlocal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ class Numerical_Nonlocal
4444

4545
Numerical_Nonlocal_Lm* Proj; ///< length: nproj(only store radial function )
4646

47-
const double& get_rcut_max(void) const { return rcut_max; }
47+
const double& get_rcut_max() const { return rcut_max; }
4848
const int& get_nproj() const { return nproj; }
4949

5050
private:
5151

52-
std::string label; /// <element label
52+
std::string label=""; /// <element label
5353

5454
int type; ///< element index
5555

5656
int lmax; ///< max value of L angular momentum
5757

58-
double rcut_max;
58+
double rcut_max=0.0;
5959

60-
std::string type_ps; ///<local or nonlocal
60+
std::string type_ps=""; ///<local or nonlocal
6161

6262
int nproj;
6363

source/module_basis/module_ao/ORB_nonlocal_lm.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Numerical_Nonlocal_Lm::Numerical_Nonlocal_Lm()
1616
label = "";
1717
index_atom_type = 0;
1818
angular_momentum_l = 0;
19+
index_proj = 0;
1920

2021
nr = 1;
2122
nk = 1;
@@ -34,7 +35,7 @@ Numerical_Nonlocal_Lm::~Numerical_Nonlocal_Lm()
3435
this->freemem();
3536
}
3637

37-
void Numerical_Nonlocal_Lm::renew(void)
38+
void Numerical_Nonlocal_Lm::renew()
3839
{
3940
assert(nr_uniform>0);
4041
assert(nr>0);
@@ -55,7 +56,7 @@ void Numerical_Nonlocal_Lm::renew(void)
5556
ModuleBase::GlobalFunc::ZEROS(beta_k, nk);
5657
}
5758

58-
void Numerical_Nonlocal_Lm::freemem(void)
59+
void Numerical_Nonlocal_Lm::freemem()
5960
{
6061
delete[] this->r_radial;
6162
delete[] this->rab;
@@ -246,7 +247,7 @@ void Numerical_Nonlocal_Lm::extra_uniform(const double &dr_uniform_in)
246247
}
247248
*/
248249

249-
void Numerical_Nonlocal_Lm::get_kradial(void)
250+
void Numerical_Nonlocal_Lm::get_kradial()
250251
{
251252
//ModuleBase::TITLE("Numerical_Nonlocal_Lm","get_kradial");
252253
double *jl = new double[nr];

source/module_basis/module_ao/parallel_orbitals.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@
66

77
Parallel_Orbitals::Parallel_Orbitals()
88
{
9-
loc_sizes = nullptr;
10-
9+
this->loc_sizes = nullptr;
1110
// in multi-k, 2D-block-division variables for FT (R<->k)
12-
nnr = 1;
13-
nlocdim = nullptr;
14-
nlocstart = nullptr;
11+
this->nlocdim = nullptr;
12+
this->nlocstart = nullptr;
13+
this->nnr = 1;
14+
this->ncol_bands = 0;
15+
this->nrow_bands=0;
16+
this->nloc_wfc=0;
17+
this->nloc_Eij=0;
18+
this->lastband_in_proc=0;
19+
this->lastband_number=0;
20+
this->loc_size=0;
21+
this->nbands = 0;
22+
1523
}
1624

1725
Parallel_Orbitals::~Parallel_Orbitals()

0 commit comments

Comments
 (0)