Skip to content

Commit 4c5f29b

Browse files
committed
Merge branch 'develop' into refactor_libxc
2 parents 2948a80 + 732c2b8 commit 4c5f29b

File tree

219 files changed

+3831
-2749
lines changed

Some content is hidden

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

219 files changed

+3831
-2749
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ time.json
2323
__pycache__
2424
abacus.json
2525
*.npy
26-

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,10 @@ if (ENABLE_CNPY)
492492
include_directories(${cnpy_INCLUDE_DIR})
493493
endif()
494494
include_directories(${cnpy_SOURCE_DIR})
495-
target_link_libraries(${ABACUS_BIN_NAME} cnpy)
495+
496+
# find ZLIB and link
497+
find_package(ZLIB REQUIRED)
498+
target_link_libraries(${ABACUS_BIN_NAME} cnpy ZLIB::ZLIB)
496499
add_compile_definitions(__USECNPY)
497500
endif()
498501

docs/advanced/acceleration/cuda.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ To compile and use ABACUS in CUDA mode, you currently need to have an NVIDIA GPU
2929

3030
Check the [Advanced Installation Options](https://abacus-rtd.readthedocs.io/en/latest/advanced/install.html#build-with-cuda-support) for the installation of CUDA version support.
3131

32+
When the compilation parameter USE_ELPA is ON (which is the default value) and USE_CUDA is also set to ON, the ELPA library needs to [enable GPU support](https://github.com/marekandreas/elpa/blob/master/documentation/INSTALL.md) at compile time.
33+
3234
## Run with the GPU support by editing the INPUT script:
3335

3436
In `INPUT` file we need to set the input parameter [device](../input_files/input-main.md#device) to `gpu`. If this parameter is not set, ABACUS will try to determine if there are available GPUs.
35-
- Set `ks_solver`: For the PW basis, CG, BPCG and Davidson methods are supported on GPU; set the input parameter [ks_solver](../input_files/input-main.md#ks_solver) to `cg`, `bpcg` or `dav`. For the LCAO basis, `cusolver` is supported on GPU.
36-
- **multi-card**: ABACUS allows for multi-GPU acceleration. If you have multiple GPU cards, you can run ABACUS with several MPI processes, and each process will utilize one GPU card. For example, the command `mpirun -n 2 abacus` will by default launch two GPUs for computation. If you only have one card, this command will only start one GPU.
37+
- Set `ks_solver`: For the PW basis, CG, BPCG and Davidson methods are supported on GPU; set the input parameter [ks_solver](../input_files/input-main.md#ks_solver) to `cg`, `bpcg` or `dav`. For the LCAO basis, `cusolver` and `elpa` is supported on GPU.
38+
- **multi-card**: ABACUS allows for multi-GPU acceleration. If you have multiple GPU cards, you can run ABACUS with several MPI processes, and each process will utilize one GPU card. For example, the command `mpirun -n 2 abacus` will by default launch two GPUs for computation. If you only have one card, this command will only start one GPU.
3739

3840
## Examples
3941
We provides [examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/gpu) of gpu calculations.
@@ -42,3 +44,6 @@ We provides [examples](https://github.com/deepmodeling/abacus-develop/tree/devel
4244
PW basis:
4345
- Only k point parallelization is supported, so the input keyword `kpar` will be set to match the number of MPI tasks automatically.
4446
- By default, CUDA architectures 60, 70, 75, 80, 86, and 89 are compiled (if supported). It can be overriden using the CMake variable [`CMAKE_CUDA_ARCHITECTURES`](https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_ARCHITECTURES.html) or the environmental variable [`CUDAARCHS`](https://cmake.org/cmake/help/latest/envvar/CUDAARCHS.html).
47+
LCAO basis:
48+
- Unless there is a specific reason, avoid using multiple GPUs, as it can be slower than using a single GPU. This is because the generalized eigenvalue solution of the LCAO basis set will incur additional communication overhead when calculated on multiple cards. When the memory limit of a GPU card makes it insufficient to complete the task, it is recommended to use multiple cards for calculation.
49+
- When using elpa on GPUs, some ELPA internal logs will be output.

docs/advanced/input_files/input-main.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,17 +1515,17 @@ These variables are used to control the output of properties.
15151515

15161516
- **Type**: Integer \[Integer\](optional)
15171517
- **Description**:
1518-
15191518
The first integer controls whether to output the charge density on real space grids:
15201519
- 1. Output the charge density (in Bohr^-3) on real space grids into the density files in the folder `OUT.${suffix}`. The files are named as:
15211520
- nspin = 1: SPIN1_CHG.cube;
15221521
- nspin = 2: SPIN1_CHG.cube, and SPIN2_CHG.cube;
15231522
- nspin = 4: SPIN1_CHG.cube, SPIN2_CHG.cube, SPIN3_CHG.cube, and SPIN4_CHG.cube.
1524-
- 2. On top of 1, also output the initial charge density. The files are named as:
1523+
- 2: On top of 1, also output the initial charge density. The files are named as:
15251524
- nspin = 1: SPIN1_CHG_INI.cube
15261525
- nspin = 2: SPIN1_CHG_INI.cube, and SPIN2_CHG_INI.cube;
15271526
- nspin = 4: SPIN1_CHG_INI.cube, SPIN2_CHG_INI.cube, SPIN3_CHG_INI.cube, and SPIN4_CHG_INI.cube.
1528-
1527+
- -1: disable the charge density auto-back-up file `{suffix}-CHARGE-DENSITY.restart`, useful for large systems.
1528+
15291529
The second integer controls the precision of the charge density output, if not given, will use `3` as default. For purpose restarting from this file and other high-precision involved calculation, recommend to use `10`.
15301530

15311531
---
@@ -2658,6 +2658,27 @@ These variables are used to control molecular dynamics calculations. For more in
26582658
- **Description**: The filename of DP potential files, see [md.md](../md.md#dpmd) in detail.
26592659
- **Default**: graph.pb
26602660

2661+
### dp_rescaling
2662+
2663+
- **Type**: Real
2664+
- **Availability**: [esolver_type](#esolver_type) = `dp`.
2665+
- **Description**: Rescaling factor to use a temperature-dependent DP. Energy, stress and force calculated by DP will be multiplied by this factor.
2666+
- **Default**: 1.0
2667+
2668+
### dp_fparam
2669+
2670+
- **Type**: Real
2671+
- **Availability**: [esolver_type](#esolver_type) = `dp`.
2672+
- **Description**: The frame parameter for dp potential. The array size is dim_fparam, then all frames are assumed to be provided with the same fparam.
2673+
- **Default**: {}
2674+
2675+
### dp_aparam
2676+
2677+
- **Type**: Real
2678+
- **Availability**: [esolver_type](#esolver_type) = `dp`.
2679+
- **Description**: The atomic parameter for dp potential. The array size can be (1) natoms x dim_aparam, then all frames are assumed to be provided with the same aparam; (2) dim_aparam, then all frames and atoms are assumed to be provided with the same aparam.
2680+
- **Default**: {}
2681+
26612682
### msst_direction
26622683

26632684
- **Type**: Integer

docs/advanced/md.md

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -87,53 +87,4 @@ ABACUS performs the [Multi-Scale Shock Technique (MSST) integration](https://jou
8787
Compiling ABACUS with [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit), MD calculations based on machine learning DP model is enabled.
8888

8989
To employ DPMD calculations, [esolver_type](./input_files/input-main.md#esolver_type) should be set to `dp`.
90-
And the filename of DP model is specified by keyword [pot_file](./input_files/input-main.md#pot_file).
91-
92-
First, we can find whether contains keyword `type_map` in the DP model through the shell command:
93-
```bash
94-
strings Al-SCAN.pb | grep type_map
95-
```
96-
97-
```json
98-
{"model": {"type_map": ["Al"], "descriptor": {"type": "se_e2_a", "sel": [150], "rcut_smth": 0.5, "rcut": 6.0, "neuron": [25, 50, 100], "resnet_dt": false, "axis_neuron": 16, "seed": 1, "activation_function": "tanh", "type_one_side": false, "precision": "default", "trainable": true, "exclude_types": [], "set_davg_zero": false}, "fitting_net": {"neuron": [240, 240, 240], "resnet_dt": true, "seed": 1, "type": "ener", "numb_fparam": 0, "numb_aparam": 0, "activation_function": "tanh", "precision": "default", "trainable": true, "rcond": 0.001, "atom_ener": []}, "data_stat_nbatch": 10, "data_stat_protect": 0.01}, "learning_rate": {"type": "exp", "decay_steps": 5000, "start_lr": 0.001, "stop_lr": 3.51e-08, "scale_by_worker": "linear"}, "loss": {"type": "ener", "start_pref_e": 0.02, "limit_pref_e": 1, "start_pref_f": 1000, "limit_pref_f": 1, "start_pref_v": 0, "limit_pref_v": 0, "start_pref_ae": 0.0, "limit_pref_ae": 0.0, "start_pref_pf": 0.0, "limit_pref_pf": 0.0, "enable_atom_ener_coeff": false}, "training": {"training_data": {"systems": ["../deepmd_data/"], "batch_size": "auto", "set_prefix": "set", "auto_prob": "prob_sys_size", "sys_probs": null}, "validation_data": {"systems": ["../deepmd_validation"], "batch_size": 1, "numb_btch": 3, "set_prefix": "set", "auto_prob": "prob_sys_size", "sys_probs": null}, "numb_steps": 1000000, "seed": 10, "disp_file": "lcurve.out", "disp_freq": 100, "save_freq": 1000, "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, "profiling_file": "timeline.json", "enable_profiler": false, "tensorboard": false, "tensorboard_log_dir": "log", "tensorboard_freq": 1}}
99-
```
100-
101-
If the keyword `type_map` is found, ABACUS will match the atom types between `STRU` and DP model.
102-
103-
Otherwise, all atom types must be specified in the `STRU` in the order consistent with that of the DP model, even if the number of atoms is zero!
104-
105-
For example, there is a Al-Cu-Mg ternary-alloy DP model, but the simulated cell is a Al-Cu binary alloy. Then the `STRU` should be written as follows:
106-
107-
```
108-
ATOMIC_SPECIES
109-
Al 26.982
110-
Cu 63.546
111-
Mg 24.305
112-
113-
LATTICE_CONSTANT
114-
1.889727000000
115-
116-
LATTICE_VECTORS
117-
4.0 0.0 0.0
118-
0.0 4.0 0.0
119-
0.0 0.0 4.0
120-
121-
ATOMIC_POSITIONS
122-
Cartesian
123-
124-
Al
125-
0
126-
2
127-
0.0 0.0 0.0
128-
0.5 0.5 0.0
129-
130-
Cu
131-
0
132-
2
133-
0.5 0.0 0.5
134-
0.0 0.5 0.5
135-
136-
Mg
137-
0
138-
0
139-
```
90+
And the filename of DP model is specified by keyword [pot_file](./input_files/input-main.md#pot_file).

source/Makefile.Objects

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ OBJS_CELL=atom_pseudo.o\
183183
klist.o\
184184
cell_index.o\
185185
check_atomic_stru.o\
186-
print_cif.o\
187186

188187
OBJS_DEEPKS=LCAO_deepks.o\
189188
deepks_fgamma.o\
@@ -347,6 +346,7 @@ OBJS_HSOLVER_LCAO=hsolver_lcao.o\
347346
diago_scalapack.o\
348347
diago_lapack.o\
349348
diago_elpa.o\
349+
diago_elpa_native.o\
350350
elpa_new.o\
351351
elpa_new_real.o\
352352
elpa_new_complex.o\
@@ -468,6 +468,7 @@ OBJS_IO=input_conv.o\
468468
write_dos_pw.o\
469469
nscf_band.o\
470470
cal_dos.o\
471+
cif_io.o\
471472
dos_nao.o\
472473
numerical_descriptor.o\
473474
numerical_basis.o\
@@ -476,7 +477,7 @@ OBJS_IO=input_conv.o\
476477
print_info.o\
477478
read_cube.o\
478479
read_rho.o\
479-
read_rhog.o\
480+
rhog_io.o\
480481
read_exit_file.o\
481482
read_wfc_pw.o\
482483
restart.o\

source/driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void Driver::init()
4444
Print_Info::print_time(time_start, time_finish);
4545

4646
// (4) close all of the running logs
47-
ModuleBase::Global_File::close_all_log(GlobalV::MY_RANK, PARAM.inp.out_alllog);
47+
ModuleBase::Global_File::close_all_log(GlobalV::MY_RANK, PARAM.inp.out_alllog,PARAM.inp.calculation);
4848

4949
// (5) output the json file
5050
// Json::create_Json(&GlobalC::ucell.symm,GlobalC::ucell.atoms,&INPUT);

source/driver_run.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void Driver::driver_run() {
3232

3333
// this warning should not be here, mohan 2024-05-22
3434
#ifndef __LCAO
35-
if (GlobalV::BASIS_TYPE == "lcao_in_pw" || GlobalV::BASIS_TYPE == "lcao") {
35+
if (PARAM.inp.basis_type == "lcao_in_pw" || PARAM.inp.basis_type == "lcao") {
3636
ModuleBase::WARNING_QUIT("driver",
3737
"to use LCAO basis, compile with __LCAO");
3838
}
@@ -55,7 +55,7 @@ void Driver::driver_run() {
5555
Json::gen_stru_wrapper(&GlobalC::ucell);
5656
#endif
5757

58-
const std::string cal_type = GlobalV::CALCULATION;
58+
const std::string cal_type = PARAM.inp.calculation;
5959

6060
//! 4: different types of calculations
6161
if (cal_type == "md")

source/module_base/global_file.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void ModuleBase::Global_File::close_log( std::ofstream &ofs,const std::string &f
243243
return;
244244
}
245245

246-
void ModuleBase::Global_File::close_all_log(const int rank, const bool out_alllog)
246+
void ModuleBase::Global_File::close_all_log(const int rank, const bool out_alllog,const std::string &calculation)
247247
{
248248
//----------------------------------------------------------
249249
// USE GLOBAL VARIABLES :
@@ -258,7 +258,7 @@ void ModuleBase::Global_File::close_all_log(const int rank, const bool out_alllo
258258
std::stringstream ss;
259259
if(out_alllog)
260260
{
261-
ss << "running_" << GlobalV::CALCULATION << "_cpu" << rank << ".log";
261+
ss << "running_" << calculation << "_cpu" << rank << ".log";
262262
close_log(GlobalV::ofs_running,ss.str());
263263
#if defined(__CUDA) || defined(__ROCM)
264264
close_log(GlobalV::ofs_device, "device" + std::to_string(rank));
@@ -268,7 +268,7 @@ void ModuleBase::Global_File::close_all_log(const int rank, const bool out_alllo
268268
{
269269
if(rank==0)
270270
{
271-
ss << "running_" << GlobalV::CALCULATION << ".log";
271+
ss << "running_" << calculation << ".log";
272272
close_log(GlobalV::ofs_running,ss.str());
273273
#if defined(__CUDA) || defined(__ROCM)
274274
close_log(GlobalV::ofs_device, "device");

source/module_base/global_file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace Global_File
3030
void make_dir_atom(const std::string &label);
3131
void open_log ( std::ofstream &ofs, const std::string &fn, const std::string &calculation, const bool &restart);
3232
void close_log( std::ofstream &ofs, const std::string &fn);
33-
void close_all_log(const int rank, const bool out_alllog = false);
33+
void close_all_log(const int rank, const bool out_alllog = false,const std::string &calculation = "md");
3434

3535
/**
3636
* @brief delete tmperary files

0 commit comments

Comments
 (0)