Skip to content

Commit

Permalink
Merge pull request deepmodeling#2 from abacusmodeling/develop
Browse files Browse the repository at this point in the history
merge from abacusmodeling/abacus-develop branch develop
  • Loading branch information
1041176461 authored Aug 22, 2021
2 parents dbf01b4 + c1dd1ac commit 6e2e6a5
Show file tree
Hide file tree
Showing 430 changed files with 19,485 additions and 6,207 deletions.
56 changes: 39 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ project(ABACUS
)

option(ENABLE_DEEPKS "Enable DeePKS functionality" OFF)
option(ENABLE_LIBXC "Enable LibXC functionality" OFF)

option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
option(BUILD_TESTING "Build ABACUS unit tests" ON)
option(BUILD_UNIT_TESTS "Build ABACUS unit tests" ON)
option(GENERATE_TEST_REPORTS "Enable test report generation" OFF)


if(ENABLE_DEEPKS)
set(CMAKE_CXX_STANDARD 14)
else()
set(CMAKE_CXX_STANDARD 11)
endif()

if(ENABLE_ASAN)
add_compile_options(
-O1
Expand All @@ -44,7 +48,6 @@ set(ABACUS_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ABACUS_BIN_NAME})

include_directories(${ABACUS_SOURCE_DIR})

find_package(Boost REQUIRED)
find_package(Cereal REQUIRED)
find_package(ELPA REQUIRED)
find_package(MPI REQUIRED)
Expand All @@ -59,7 +62,6 @@ include(FetchContent)

include_directories(
${Cereal_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${MPI_CXX_INCLUDE_PATH}
)

Expand All @@ -78,6 +80,22 @@ if(ENABLE_DEEPKS)
add_definitions(-D__DEEPKS)
endif()

if(DEFINED Libxc_DIR)
set(ENABLE_LIBXC ON)
endif()
if(ENABLE_LIBXC)
find_package(Libxc)
if(${Libxc_FOUND})
message("Using Libxc.")
add_compile_definitions(USE_LIBXC)
# applying -DUSING_Libxc definition
# target_compile_definitions(${ABACUS_BIN_NAME} PRIVATE $<TARGET_PROPERTY:Libxc::xc,INTERFACE_COMPILE_DEFINITIONS>)
include_directories(${Libxc_INCLUDE_DIRS})
else()
message(WARNING "Will not use Libxc.")
endif()
endif()

if(DEFINED MKL_DIR_CACHE)
find_package(IntelMKL REQUIRED)
add_definitions(-D__MKL -DMKL_ILP64)
Expand All @@ -89,20 +107,20 @@ else()
include_directories(${FFTW3_INCLUDE_DIRS})
endif()

add_definitions(
-D__EXX
-D__FFTW3
-D__FP
-D__MPI
-D__OPENMP
-D__SELINV
-D__LCAO
-DMETIS
-DEXX_DM=3
-DEXX_H_COMM=2
-DTEST_EXX_LCAO=0
-DTEST_EXX_RADIAL=1
-DUSE_CEREAL_SERIALIZATION
add_compile_definitions(
__EXX
__FFTW3
__FP
__MPI
__OPENMP
__SELINV
__LCAO
METIS
EXX_DM=3
EXX_H_COMM=2
TEST_EXX_LCAO=0
TEST_EXX_RADIAL=1
USE_CEREAL_SERIALIZATION
)

add_subdirectory(source)
Expand Down Expand Up @@ -162,6 +180,10 @@ if(ENABLE_DEEPKS)
)
endif()

if(${Libxc_FOUND})
target_link_libraries(${ABACUS_BIN_NAME} Libxc::xc)
endif()

install(PROGRAMS ${ABACUS_BIN_PATH}
TYPE BIN
#DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
33 changes: 25 additions & 8 deletions doc/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
- [List of keywords](#list-of-keywords)
- [System variables](#system-variables)

[suffix](#suffix) | [ntype](#ntype) | [calculation](#calculation) | [dft_functional](#dft-functional) | [pseudo_type](#pseudo-type) | [npool](#npool) | [symmetry](#symmetry) | [pseudo_rcut](#pseudo-rcut) | [renormwithmesh](#renormwithmesh) | [nelec](#nelec) | [tot_magnetization](#tot-magnetization) | [mem_saver](#mem-saver) | [latname](#latname) | [start_wfc](#start-wfc) | [start_charge](#start-charge) | [start_pot](#start-pot) | [set_vel](#set_vel) | [diago_proc](#diago_proc)
[suffix](#suffix) | [ntype](#ntype) | [calculation](#calculation) | [dft_functional](#dft-functional) | [pseudo_type](#pseudo-type) | [npool](#npool) | [symmetry](#symmetry) | [pseudo_rcut](#pseudo-rcut) | [renormwithmesh](#renormwithmesh) | [nelec](#nelec) | [tot_magnetization](#tot-magnetization) | [mem_saver](#mem-saver) | [latname](#latname) | [start_wfc](#start-wfc) | [seed](#seed) | [start_charge](#start-charge) | [start_pot](#start-pot) | [set_vel](#set_vel) | [diago_proc](#diago_proc)

- [Variables related to input files](#variables-related-to-input-files)

[atom_file](#atom-file) | [kpoint_file](#kpoint-file) | [pseudo_dir](#pseudo-dir) | [read_file_dir](#read-file-dir)
[atom_file](#atom-file) | [kpoint_file](#kpoint-file) | [pseudo_dir](#pseudo-dir) | [orbital_dir](#orbital-dir) | [read_file_dir](#read-file-dir)

- [Plane wave related variables](#plane-wave-related-variables)

[ecutwfc](#ecutwfc)| [nx,ny,nz](#nx) | [ethr](#ethr) | [diago_cg_maxiter](#diago-cg-maxiter) | [diago_david_ndim](#diago-david-ndim)
[ecutwfc](#ecutwfc) | [nx,ny,nz](#nx) | [ethr](#ethr) | [diago_cg_maxiter](#diago-cg-maxiter) | [diago_david_ndim](#diago-david-ndim)

- [Numerical atomic orbitals related variables](#numerical-atomic-orbitals-related-variables)

Expand Down Expand Up @@ -249,10 +249,20 @@ This part of variables are used to control general system parameters.
- start_wfc<a id="start-wfc"></a>
- *Type*: String
- *Description*: Only useful for plane wave basis only now. It is the name of the starting wave functions. In the future we should also make this variable available for localized orbitals set.
- atomic:
- file:
- *Default*:atomic
- *Description*: Only useful for plane wave basis only now. It is the name of the starting wave functions. In the future we should also make this variable available for localized orbitals set.
Available options are:
- "atomic": from atomic pseudo wave functions. If they are not enough, other wave functions are initialized with random numbers.
- "atomic+random": add small random numbers on atomic pseudo-wavefunctions
- "file": from file
- "random": random numbers
- *Default*:"atomic"
[back to top](#input-file)
- seed<a id="seed"></a>
- *Type*: Integer
- *Description*: Only useful for plane wave basis only now. It is the random seed to initialize wave functions. Only positive integers are avilable.
- *Default*:0
[back to top](#input-file)
Expand Down Expand Up @@ -308,6 +318,13 @@ This part of variables are used to control input files related parameters.
[back to top](#input-file)
- orbital_dir<a id="orbital-dir"></a>
- *Type*: String
- *Description*: This parameter specifies orbital file directory.
- *Default*: ./
[back to top](#input-file)
- read_file_dir<a id="read-file-dir"></a>
- *Type*: String
- *Description*: when the program needs to read files such as electron density(`SPIN1_CHG`) as a starting point, this variables tells the location of the files. For example, './' means the file is located in the working directory.
Expand Down Expand Up @@ -737,7 +754,7 @@ This part of variables are used to control the output of properties.
[back to top](#input-file)
- out_wf<a id="out-wf"></a>
- *Type*: Integer
- *Description*: Only used in **planewave basis** set. When set this variable to 1, it outputs the coefficients of wave functions. The file names are WAVEFUNC.dat$K.txt, where $K is the index of k point.
- *Description*: Only used in **planewave basis** set. When set this variable to 1, it outputs the coefficients of wave functions into text files. The file names are WAVEFUNC$K.txt, where $K is the index of k point. When set this variable to 2, results are stored in binary files. The file names are WAVEFUNC$K.dat.
- *Default*: 0
[back to top](#input-file)
Expand Down
18 changes: 17 additions & 1 deletion doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ FFTW3;

### Build and install ABACUS with CMake

#### Configure

We recommend building ABACUS with `cmake` to avoid dependency issues.
ABACUS requires a minimum `cmake` version of `3.18`. Check the version of `cmake` on your machine with:

Expand All @@ -52,10 +54,24 @@ For example:
cmake -B build -DFFTW3_ROOT=/opt/fftw3 -DBOOST_INCLUDEDIR=/usr/include/boost
```

You can also choose to build with which components.

```bash
cmake -B build -DUSE_LIBXC=1
```

If Libxc is not installed in standard path (i.e. installed with a custom prefix path), you may add the installation prefix of `FindLibxc.cmake` to `CMAKE_MODULE_PATH` environment variable, or set `Libxc_DIR` to the directory containing the file.

```bash
cmake -B build -DLibxc_DIR=~/libxc
```

#### Build and Install

After configuring, start build and install by:

```bash
cmake --build build
cmake --build build -j9
cmake --install build
```

Expand Down
1 change: 1 addition & 0 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ diago_cg.o\
output.o \
run_md_classic.o\
LJ_potential.o\
cmd_neighbor.o\
dos.o \
inverse_matrix.o \
energy.o \
Expand Down
27 changes: 18 additions & 9 deletions source/driver.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#include "driver.h"
#include "run_pw.h"
#include "input.h"
#include "input_conv.h"
#include "run_pw.h"
#include "src_pw/global.h"
#ifdef __LCAO
#include "run_lcao.h"
#include "src_lcao/global_fp.h"
#endif
#include "src_pw/global.h"
#include "src_io/cal_test.h"
#include "src_io/winput.h"
#include "src_io/print_info.h"
#include "module_base/timer.h"

Driver::Driver(){}

Expand All @@ -20,13 +22,20 @@ void Driver::init()
{
TITLE("Driver","init");

time_t time_start = std::time(NULL);
timer::start();

// (1) read the input parameters.
this->reading();

// (2) welcome to the atomic world!
this->atomic_world();

// (3) close all of the running logs
// (3) output information
time_t time_finish= std::time(NULL);
Print_Info::print_time(time_start, time_finish);

// (4) close all of the running logs
INPUT.close_log();

return;
Expand All @@ -46,11 +55,11 @@ void Driver::reading(void)
// (3) define the 'DIAGONALIZATION' world in MPI
Parallel_Global::split_diag_world(GlobalV::DIAGO_PROC);
Parallel_Global::split_grid_world(GlobalV::DIAGO_PROC);
OUT(GlobalV::ofs_running,"DRANK",GlobalV::DRANK+1);
OUT(GlobalV::ofs_running,"DSIZE",GlobalV::DSIZE);
OUT(GlobalV::ofs_running,"DCOLOR",GlobalV::DCOLOR+1);
OUT(GlobalV::ofs_running,"GRANK",GlobalV::GRANK+1);
OUT(GlobalV::ofs_running,"GSIZE",GlobalV::GSIZE);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"DRANK",GlobalV::DRANK+1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"DSIZE",GlobalV::DSIZE);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"DCOLOR",GlobalV::DCOLOR+1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"GRANK",GlobalV::GRANK+1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"GSIZE",GlobalV::GSIZE);

#ifdef __MPI
// (4) divide the GlobalV::NPROC processors into GlobalV::NPOOL for k-points parallelization.
Expand All @@ -64,7 +73,7 @@ void Driver::reading(void)
std::stringstream ss1;
ss1 << GlobalV::global_out_dir << GlobalV::global_in_card;
INPUT.Print( ss1.str() );
//DONE(GlobalV::ofs_running,"READING CARDS");
//ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running,"READING CARDS");

timer::tick("Driver","reading");
return;
Expand Down
Loading

0 comments on commit 6e2e6a5

Please sign in to comment.