Skip to content

Commit 6d97982

Browse files
committed
Make: Update Makefile, and compile documents.
1 parent 39f07bb commit 6d97982

File tree

3 files changed

+53
-23
lines changed

3 files changed

+53
-23
lines changed

docs/CITATIONS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ The following references are required to be cited when using ABACUS. Specificall
3333
Peize Lin, Xinguo Ren, and Lixin He. "Efficient Hybrid Density Functional Calculations for Large Periodic Systems Using Numerical Atomic Orbitals." Journal of Chemical Theory and Computation 2021, 17(1), 222–239.
3434

3535
Peize Lin, Xinguo Ren, and Lixin He. "Accuracy of Localized Resolution of the Identity in Periodic Hybrid Functional Calculations with Numerical Atomic Orbitals." Journal of Physical Chemistry Letters 2020, 11, 3082-3088.
36+
37+
- **If ML-KEDF is used:**
38+
39+
Sun, Liang, and Mohan Chen. "Machine learning based nonlocal kinetic energy density functional for simple metals and alloys." Physical Review B 109.11 (2024): 115135.
40+
41+
Sun, Liang, and Mohan Chen. "Multi-channel machine learning based nonlocal kinetic energy density functional for semiconductors." Electronic Structure 6.4 (2024): 045006.

docs/advanced/install.md

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ cmake -B build -DENABLE_DEEPKS=1 -DTorch_DIR=~/libtorch/share/cmake/Torch/ -Dlib
3131

3232
> CMake will try to download Libnpy if it cannot be found locally.
3333
34+
## Build with ML-KEDF
35+
36+
If machine learning based kinetic energy density functional (ML-KEDF) is required for OFDFT calculation, the following prerequisites and steps are needed:
37+
38+
- C++ compiler, supporting **C++14** (GCC >= 5 is sufficient)
39+
- CMake >= 3.18
40+
- [LibTorch](https://pytorch.org/) with cxx11 ABI supporting CPU or GPU
41+
- [Libnpy](https://github.com/llohse/libnpy/)
42+
43+
```bash
44+
cmake -B build -DENABLE_MLKEDF=1 -DTorch_DIR=~/libtorch/share/cmake/Torch/ -Dlibnpy_INCLUDE_DIR=~/libnpy/include
45+
```
46+
47+
> CMake will try to download Libnpy if it cannot be found locally.
48+
3449
## Build with DeePMD-kit
3550

3651
> Note: This part is only required if you want to load a trained DeeP Potential and run molecular dynamics with that. To train the DeeP Potential with DP-GEN, no extra prerequisite is needed and please refer to [this page](http://abacus.deepmodeling.com/en/latest/advanced/interface/dpgen.html) for ABACUS interface with DP-GEN.
@@ -141,7 +156,7 @@ CXX = mpiicpc
141156
# icpc: compile intel sequential version
142157
# make: ELPA_DIR, ELPA_INCLUDE_DIR, CEREAL_DIR must also be set.
143158
# make pw: nothing need to be set except LIBXC_DIR
144-
#
159+
#
145160
# mpicxx: compile gnu parallel version
146161
# g++: compile gnu sequential version
147162
# make: FFTW_DIR, OPENBLAS_LIB_DIR, SCALAPACK_LIB_DIR, ELPA_DIR, ELPA_INCLUDE_DIR, CEREAL_DIR must also be set.
@@ -150,6 +165,10 @@ CXX = mpiicpc
150165
# GPU = OFF #We do not support GPU yet
151166
# OFF: do not use GPU
152167
# CUDA: use CUDA
168+
OPENMP = OFF
169+
# the default is not to use OPENMP to accelerate.
170+
# Change OPENMP to ON to use OPENMP.
171+
153172
#======================================================================
154173

155174

@@ -167,7 +186,7 @@ CEREAL_DIR = /usr/local/include/cereal
167186

168187
##------------------- FOR GNU COMPILER ------------------------------
169188
## FFTW_DIR should contain lib/libfftw3.a.
170-
## OPENBLAS_LIB_DIR should contain libopenblas.a.
189+
## OPENBLAS_LIB_DIR should contain libopenblas.a.
171190
## SCALAPACK_LIB_DIR should contain libscalapack.a
172191
## All three above will only be used when CXX=mpicxx or g++
173192
## ELPA_DIR should contain an include folder and lib/libelpa.a
@@ -185,14 +204,18 @@ CEREAL_DIR = /usr/local/include/cereal
185204

186205

187206
##------------------- OPTIONAL LIBS ---------------------------------
188-
## To use DEEPKS: set LIBTORCH_DIR and LIBNPY_DIR
207+
## To use DEEPKS: set ENABLE_DEEPKS = ON, and set LIBTORCH_DIR and LIBNPY_DIR
208+
## To use MLKEDF: set ENABLE_MLKEDF = ON, and set LIBTORCH_DIR and LIBNPY_DIR
189209
## To use LIBXC: set LIBXC_DIR which contains include and lib/libxc.a (>5.1.7)
190-
## To use DeePMD: set DeePMD_DIR and TensorFlow_DIR
210+
## To use DeePMD: set DeePMD_DIR LIBTORCH_DIR and TensorFlow_DIR
191211
## To use LibRI: set LIBRI_DIR and LIBCOMM_DIR
212+
## To use PEXSI: set PEXSI_DIR DSUPERLU_DIR and PARMETIS_DIR
192213
##---------------------------------------------------------------------
193214

194215
# LIBTORCH_DIR = /usr/local
195216
# LIBNPY_DIR = /usr/local
217+
ENABLE_DEEPKS = OFF
218+
ENABLE_MLKEDF = OFF
196219

197220
# LIBXC_DIR = /public/soft/libxc
198221

@@ -202,6 +225,10 @@ CEREAL_DIR = /usr/local/include/cereal
202225
# LIBRI_DIR = /public/software/LibRI
203226
# LIBCOMM_DIR = /public/software/LibComm
204227

228+
# PEXSI_DIR = /public/software/pexsi
229+
# DSUPERLU_DIR = /public/software/superlu_dist
230+
# PARMETIS_DIR = /public/software/parmetis
231+
205232
##---------------------------------------------------------------------
206233
# NP = 14 # It is not supported. use make -j14 or make -j to parallelly compile
207234
# DEBUG = OFF
@@ -247,20 +274,6 @@ CEREAL_DIR=/public/soft/cereal
247274

248275
ABACUS now support full version and pw version. Use `make` or `make abacus` to compile full version which supports LCAO calculations. Use `make pw` to compile pw version which only supports pw calculations. For pw version, `make pw CXX=mpiicpc`, you do not need to provide any libs. For `make pw CXX=mpicxx`, you need provide `FFTW_DIR` and `OPENBLAS_LIB_DIR`.
249276

250-
Besides, libxc and deepks are optional libs to compile abacus.
251-
They will be used when `LIBXC_DIR` is defined like
252-
253-
```makefile
254-
LIBXC_DIR = /public/soft/libxc
255-
```
256-
257-
or `LIBTORCH_DIR` and `LIBNPY_DIR` like
258-
259-
```makefile
260-
LIBTORCH_DIR = /usr/local
261-
LIBNPY_DIR = /usr/local
262-
```
263-
264277
After modifying the `Makefile.vars` file, execute `make` or `make -j12` to build the program.
265278

266279
After the compilation finishes without error messages (except perhaps for some warnings), an executable program `ABACUS.mpi` will be created in directory `bin/`.
@@ -279,10 +292,20 @@ directly.
279292

280293
### Add DeePKS Support
281294

282-
To compile ABACUS with DEEPKS, you need to define `LIBTORCH_DIR` and `LIBNPY_DIR` in the file `Makefile.vars` or use
295+
To compile ABACUS with DEEPKS, you need to set `ENABLE_DEEPKS = ON`, and define `LIBTORCH_DIR` and `LIBNPY_DIR` in the file `Makefile.vars` or use
296+
297+
```makefile
298+
make ENABLE_DEEPKS=ON LIBTORCH_DIR=/opt/libtorch/ LIBNPY_DIR=/opt/libnpy/
299+
```
300+
301+
directly.
302+
303+
### Add ML-KEDF Support
304+
305+
To compile ABACUS with ML-KEDF, you need to set `ENABLE_MLKEDF = ON`, and define `LIBTORCH_DIR` and `LIBNPY_DIR` in the file `Makefile.vars` or use
283306

284307
```makefile
285-
make LIBTORCH_DIR=/opt/libtorch/ LIBNPY_DIR=/opt/libnpy/
308+
make ENABLE_MLKEDF=ON LIBTORCH_DIR=/opt/libtorch/ LIBNPY_DIR=/opt/libnpy/
286309
```
287310

288311
directly.

source/Makefile.vars

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ CEREAL_DIR = /usr/local/include/cereal
5555

5656

5757
##------------------- OPTIONAL LIBS ---------------------------------
58-
## To use DEEPKS: set LIBTORCH_DIR and LIBNPY_DIR
58+
## To use DEEPKS: set ENABLE_DEEPKS = ON, and define LIBTORCH_DIR and LIBNPY_DIR
59+
## To use MLKEDF: set ENABLE_MLKEDF = ON, and define LIBTORCH_DIR and LIBNPY_DIR
5960
## To use LIBXC: set LIBXC_DIR which contains include and lib/libxc.a (>5.1.7)
6061
## To use DeePMD: set DeePMD_DIR LIBTORCH_DIR and TensorFlow_DIR
6162
## To use LibRI: set LIBRI_DIR and LIBCOMM_DIR
@@ -64,8 +65,8 @@ CEREAL_DIR = /usr/local/include/cereal
6465

6566
# LIBTORCH_DIR = /usr/local
6667
# LIBNPY_DIR = /usr/local
67-
ENABLE_DEEPKS = OFF
68-
ENABLE_MLKEDF = OFF
68+
ENABLE_DEEPKS ?= OFF
69+
ENABLE_MLKEDF ?= OFF
6970

7071
# LIBXC_DIR = /public/soft/libxc
7172

0 commit comments

Comments
 (0)