Skip to content

Commit 9ad8356

Browse files
authored
Merge pull request #801 from maki49/develop
Merge TDDFT
2 parents f8a645f + 07c8101 commit 9ad8356

File tree

244 files changed

+6954
-7966
lines changed

Some content is hidden

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

244 files changed

+6954
-7966
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches:
66
- develop
77
- tryEigen
8+
- update_MD
9+
- ABACUS_2.2.0_beta
10+
- deepks
11+
- planewave
12+
- pw_refactor
13+
- TDDFT
814

915
jobs:
1016
test:

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ target_link_libraries(${ABACUS_BIN_NAME}
275275
ri
276276
driver
277277
xc
278+
esolver
278279
-lm
279280
)
280281

doc/input-main.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
- [Variables useful for debugging](#variables-useful-for-debugging)
6161

62-
[nurse](#nurse) | [t_in_h](#t-in-h) | [vl_in_h](#vl-in-h) | [vnl_in_h](#vnl-in-h) | [test_force](#test-force) | [test_stress](#test-stress) | [colour](#colour) | [new_dm](#new-dm) | [test_just_neighbor](#test-just-neighbor)
62+
[nurse](#nurse) | [t_in_h](#t-in-h) | [vl_in_h](#vl-in-h) | [vnl_in_h](#vnl-in-h) | [test_force](#test-force) | [test_stress](#test-stress) | [colour](#colour) | [test_just_neighbor](#test-just-neighbor)
6363
- [DeePKS](#deepks)
6464

6565
[deepks_out_labels](#out-descriptor) | [deepks_descriptor_lmax](#lmax-descriptor) | [deepks_scf](#deepks-scf) | [deepks_model](#model-file)
@@ -783,7 +783,13 @@ This part of variables are used to control the output of properties.
783783
[back to top](#input-file)
784784
- out_wf<a id="out-wf"></a>
785785
- *Type*: Integer
786-
- *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.
786+
- *Description*: Only used in **planewave basis** and **ienvelope calculation in localized orbitals** 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.
787+
- *Default*: 0
788+
789+
[back to top](#input-file)
790+
- out_wf_r<a id="out-wf-r"></a>
791+
- *Type*: Integer
792+
- *Description*: Only used in **planewave basis** and **ienvelope calculation in localized orbitals** set. When set this variable to 1, it outputs real-space wave functions into `OUT.suffix/wfc_realspace/`. The file names are wfc_realspace$K$B, where $K is the index of k point, $B is the index of band.
787793
- *Default*: 0
788794
789795
[back to top](#input-file)
@@ -1528,17 +1534,6 @@ This part of variables are used to control berry phase and wannier90 interfacae
15281534
15291535
[back to top](#input-file)
15301536
1531-
- new_dm<a id="new-dm"></a>
1532-
1533-
- *Type*: Integer
1534-
- *Description*: Controls output of some debug information related to our density matrix data-structures.
1535-
- 1: show no debug information
1536-
- 2: only show key debug information
1537-
- 3: show all detail debug information
1538-
- *Default*: 1
1539-
1540-
[back to top](#input-file)
1541-
15421537
- test_just_neighbor<a id="test-just-neighbor"></a>
15431538
- *Type*: Boolean
15441539
- *Description*: If set to 1, then only perform the neighboring atoms search.

source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_subdirectory(module_orbital)
66
add_subdirectory(module_md)
77
add_subdirectory(module_deepks)
88
add_subdirectory(module_xc)
9+
add_subdirectory(module_esolver)
910
add_subdirectory(src_io)
1011
add_subdirectory(src_ions)
1112
add_subdirectory(src_lcao)

source/Makefile

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ VPATH=./src_global\
1616
:./module_md\
1717
:./module_deepks\
1818
:./module_xc\
19+
:./module_esolver\
1920
:./src_pw\
2021
:./src_lcao\
2122
:./src_ions\
@@ -26,6 +27,7 @@ VPATH=./src_global\
2627
:./src_ri\
2728
:./\
2829

30+
2931
#==========================
3032
# Define HONG
3133
#==========================
@@ -46,8 +48,8 @@ HONG_MEM = ${HONG_FFTW} -D__FP -D_MCD_CHECK -DWIN32 -DMCD_VERBOSE
4648

4749
#!!!!!!!!!!!!!!!!!!!! CHANE HERE IF YOU LIKE !!!!!!!!!!!!!!
4850
#! change series version or parallel version~~~
49-
HONG=${HONG_MPI_SELINV_20210523}
50-
#HONG=${HONG_SER_SELINV}
51+
#HONG=${HONG_MPI_SELINV_20210523}
52+
HONG=${HONG_SER_SELINV}
5153
#!!!!!!!!!!!!!!!!!!!! CHANE HERE IF YOU LIKE !!!!!!!!!!!!!!
5254

5355
#==========================
@@ -69,6 +71,7 @@ $(OBJS_COMMON)\
6971
main.o\
7072

7173
FP_OBJS=$(patsubst %.o, ${OBJ_DIR}/%.o, ${FP_OBJS_0})
74+
FP_OBJS_serial=$(patsubst %.o, ${OBJ_DIR_serial}/%.o, ${FP_OBJS_0})
7275
PDIAG_OBJS=$(patsubst %.o, ${OBJ_DIR}/%.o, ${OBJS_PDIAG})
7376
PDIAG_MR=$(patsubst %.o, ${OBJ_DIR}/%.o, ${PDIAG_MR_0})
7477

@@ -80,7 +83,7 @@ fp_mpi :
8083
@ make -j $(NP) parallel
8184

8285
fp :
83-
@ make init
86+
@ make init_serial
8487
@ make -j $(NP) serial
8588

8689
fp_gbd :
@@ -100,11 +103,16 @@ init :
100103
@ if [ ! -d $(OBJ_DIR)/README ]; then echo "This directory contains all of the .o files" > $(OBJ_DIR)/README; fi
101104
@ if [ ! -d ../bin ]; then mkdir ../bin; fi
102105

106+
init_serial :
107+
@ if [ ! -d $(OBJ_DIR_serial) ]; then mkdir $(OBJ_DIR_serial); fi
108+
@ if [ ! -d $(OBJ_DIR_serial)/README ]; then echo "This directory contains all of the .o files" > $(OBJ_DIR_serial)/README; fi
109+
@ if [ ! -d ../bin ]; then mkdir ../bin; fi
110+
103111
parallel : ${FP_OBJS} ${PDIAG_OBJS} ${PDIAG_MR} ${HEADERS}
104112
${CPLUSPLUS_MPI} ${OPTS} ${OPTS_MPI} $(FP_OBJS) ${PDIAG_OBJS} ${PDIAG_MR} ${LIBS} -o ../bin/${VERSION}.mpi
105113

106-
serial : ${FP_OBJS} ${HEADERS}
107-
${CPLUSPLUS} ${OPTS} $(FP_OBJS) ${LIBS} -o ${VERSION}.fp.x
114+
serial : ${FP_OBJS_serial} ${HEADERS}
115+
${CPLUSPLUS} ${OPTS} $(FP_OBJS_serial) ${LIBS} -o ${VERSION}.fp.x
108116

109117
serial_gdb : ${FP_OBJS} ${HEADERS}
110118
${CPLUSPLUS} ${OPTS_GDB} $(FP_OBJS) ${LIBS} -o ${VERSION}.fp_gdb.x
@@ -123,8 +131,14 @@ ${OBJ_DIR}/%.o:%.cpp
123131
${OBJ_DIR}/%.o:%.f
124132
${FORTRAN} -c ${HONG} $< -o $@
125133

134+
${OBJ_DIR_serial}/%.o:%.cpp
135+
${CPLUSPLUS} ${OPTS} ${OPTS_MPI} -c ${HONG} $< -o $@
136+
${OBJ_DIR_serial}/%.o:%.f
137+
${FORTRAN} -c ${HONG} $< -o $@
138+
126139
.PHONY:clean
127140
clean:
128141
@ if [ -d $(OBJ_DIR) ]; then rm -rf $(OBJ_DIR); fi
142+
@ if [ -d $(OBJ_DIR_serial) ]; then rm -rf $(OBJ_DIR_serial); fi
129143
@ if [ -d ../bin ]; then rm -rf ../bin; fi
130144
@ cd src_pw; make clean

source/Makefile.Objects

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ input_conv.o\
1919
run_pw.o\
2020
run_lcao.o\
2121

22-
OBJS_PW=xc_functional.o\
23-
xc_3.o \
22+
OBJS_PW=xc_3.o \
2423
vdwd2.o\
2524
vdwd2_parameters.o\
2625
vdwd3.o\
@@ -175,7 +174,6 @@ FORCE_k.o\
175174
parallel_orbitals.o \
176175
global_fp.o \
177176
pdiag_double.o \
178-
pdiag_basic.o \
179177
pdiag_common.o \
180178
diag_scalapack_gvx.o \
181179
subgrid_oper.o \
@@ -212,7 +210,7 @@ exx_abfs-screen-cauchy.o \
212210
exx_lcao.o \
213211
exx_opt_orb.o \
214212
exx_opt_orb-print.o \
215-
wfc_dm_2d.o \
213+
dm_2d.o \
216214
unk_overlap_lcao.o \
217215
cal_r_overlap_R.o \
218216
bessel_basis.o\
@@ -228,19 +226,39 @@ parallel_pw.o\
228226
ft.o\
229227
parallel_grid.o\
230228

229+
OBJS_ESOLVER=esolver.o\
230+
esolver_ks.o\
231+
esolver_fp.o\
232+
esolver_ks_pw.o\
233+
esolver_ks_lcao.o\
234+
esolver_lj.o\
235+
esolver_dp.o\
236+
237+
OBJS_XC=xc_funct_corr_gga.o \
238+
xc_funct_corr_lda.o \
239+
xc_funct_exch_gga.o \
240+
xc_funct_exch_lda.o \
241+
xc_funct_hcth.o \
242+
xc_functional_gradcorr.o \
243+
xc_functional_vxc.o \
244+
xc_functional_wrapper_gcxc.o \
245+
xc_functional_wrapper_tauxc.o \
246+
xc_functional_wrapper_xc.o \
247+
xc_functional.o \
248+
231249
OBJS_FIRST_PRINCIPLES=$(OBJS_MAIN)\
232250
$(OBJS_PW)\
233251
$(OBJS_LCAO)\
252+
$(OBJS_ESOLVER)\
253+
$(OBJS_XC)\
234254
charge.o \
235255
charge_mixing.o \
236256
charge_pulay.o \
237257
charge_broyden.o \
238258
charge_extra.o \
239-
xc_gga_pw.o \
240259
potential.o \
241260
H_Ewald_pw.o\
242261
H_Hartree_pw.o\
243-
H_XC_pw.o \
244262
H_TDDFT_pw.o\
245263
read_rho.o\
246264
read_atoms.o\
@@ -264,7 +282,6 @@ write_HS.o\
264282
write_HS_R.o\
265283
write_dm.o\
266284
write_wfc_realspace.o\
267-
potential_libxc_meta.o \
268285
efield.o \
269286
magnetism.o\
270287
optical.o\

source/Makefile.vars

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,37 @@ CPLUSPLUS = icpc
66
CPLUSPLUS_MPI = mpiicpc
77
#CPLUSPLUS_MPI = /public/intel2017/impi/2017.1.132/intel64/bin/mpiicpc
88

9-
LAPACK_DIR = $(MKLROOT)
10-
#LAPACK_DIR = /public/intel2017/compilers_and_libraries_2017.1.132/linux/mkl
11-
#LAPACK_DIR = $(MKLROOT)
12-
#LAPACK_DIR = /public/intel2017/mkl
13-
14-
FFTW_DIR = /home/mohan/1_Software/impi_fftw-3.3.8
15-
#FFTW_DIR = /home/qianrui/intelcompile/impi_fftw
16-
#FFTW_DIR = /public/udata/xiaohui/software/fftw2
17-
#FFTW_DIR =/opt/fftw/3.3.6-p12/intel/2017.update4
18-
#FFTW_DIR = /public/fftw-3.3.8
19-
20-
BOOST_DIR = /home/mohan/1_Software/impi_boost-1.70.0
21-
#BOOST_DIR = /home/qianrui/intelcompile/impi_boost
22-
#BOOST_DIR = /public/udata/xiaohui/software/boost_1_39_0
23-
#BOOST_DIR = /opt/boost/1.64.0
24-
25-
ELPA_DIR = /home/mohan/1_Software/impi_elpa-16.05.005
26-
#ELPA_DIR = /home/qianrui/intelcompile/impi_elpa
27-
#ELPA_DIR = /public/udata/xiaohui/ELPA-2016.05.004
28-
#ELPA_DIR = /opt/elpa/intel_2017_update4
29-
30-
CEREAL_DIR = /home/mohan/1_Software/ABACUS_Github/cereal/cereal/
31-
#CEREAL_DIR = /home/qianrui/intelcompile/cereal/
32-
33-
#DeePKS
34-
LIBTORCH_DIR = /home/fortneu49/soft/libtorch
35-
LIBNPY_DIR = /home/fortneu49/soft/libnpy
36-
#\DeePKS
9+
#==========================
10+
# LIB and INCLUDE
11+
#==========================
12+
HONG_LAPACK = -D__MKL -DMKL_ILP64
13+
LAPACK_DIR = $(MKLROOT)
14+
LAPACK_INCLUDE = -I${LAPACK_DIR}/include
15+
LAPACK_LIB_DIR = ${LAPACK_DIR}/lib/intel64
16+
LAPACK_LIB = -L${LAPACK_LIB_DIR} -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -Wl,--end-group -Wl,-rpath=${LAPACK_LIB_DIR}
17+
18+
HONG_FFTW = -D__FFTW3
19+
FFTW_DIR = /home/liyuanbo/soft/fftw
20+
FFTW_INCLUDE = -I${FFTW_DIR}/include
21+
FFTW_LIB_DIR = ${FFTW_DIR}/lib
22+
FFTW_LIB = -L${FFTW_LIB_DIR} -lfftw3 -Wl,-rpath=${FFTW_LIB_DIR}
23+
24+
ELPA_DIR = /home/liyuanbo/soft/elpa-2021.05.002/build
25+
ELPA_INCLUDE = -I${ELPA_DIR}/include/elpa-2021.05.002
26+
ELPA_LIB_DIR = ${ELPA_DIR}/lib
27+
ELPA_LIB = -L${ELPA_LIB_DIR} -lelpa -Wl,-rpath=${ELPA_LIB_DIR}
28+
29+
#LIBXC_INCLUDE = -I${LIBXC_DIR}/include
30+
#LIBXC_LIB_DIR = ${LIBXC_DIR}/lib
31+
#LIBXC_LIB = -L${LIBXC_LIB_DIR} -lxc -Wl,-rpath=${LIBXC_LIB_DIR}
32+
33+
CEREAL_DIR = /home/liyuanbo/soft/cereal/
34+
CEREAL_INCLUDE = -I${CEREAL_DIR}/include
35+
36+
#============DeePKS================
37+
#LIBTORCH_DIR = /home/fortneu49/soft/libtorch
38+
#LIBNPY_DIR = /home/fortneu49/soft/libnpy/include
3739

3840
OBJ_DIR = obj
41+
OBJ_DIR_serial = obj
3942
NP = 14

source/driver.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "src_io/print_info.h"
1313
#include "module_base/timer.h"
1414
#include "module_base/memory.h"
15+
#include "module_esolver/esolver.h"
1516

1617
Driver::Driver(){}
1718

@@ -85,22 +86,31 @@ void Driver::reading(void)
8586
void Driver::atomic_world(void)
8687
{
8788
ModuleBase::TITLE("Driver","atomic_world");
88-
8989
//--------------------------------------------------
9090
// choose basis sets:
9191
// pw: plane wave basis set
9292
// lcao_in_pw: LCAO expaned by plane wave basis set
9393
// lcao: linear combination of atomic orbitals
9494
//--------------------------------------------------
95+
string use_ensol;
96+
ModuleESolver::ESolver *p_esolver;
9597
if(GlobalV::BASIS_TYPE=="pw" || GlobalV::BASIS_TYPE=="lcao_in_pw")
9698
{
97-
Run_pw::plane_wave_line();
99+
use_ensol = "ksdft_pw";
100+
//We set it temporarily
101+
//Finally, we have ksdft_pw, ksdft_lcao, sdft_pw, ofdft, lj, eam, etc.
102+
ModuleESolver::init_esolver(p_esolver, use_ensol);
103+
Run_pw::plane_wave_line(p_esolver);
104+
ModuleESolver::clean_esolver(p_esolver);
98105
}
99106
#ifdef __LCAO
100107
else if(GlobalV::BASIS_TYPE=="lcao")
101-
{
102-
Run_lcao::lcao_line();
103-
}
108+
{
109+
use_ensol = "ksdft_lcao";
110+
ModuleESolver::init_esolver(p_esolver, use_ensol);
111+
Run_lcao::lcao_line(p_esolver);
112+
ModuleESolver::clean_esolver(p_esolver);
113+
}
104114
#endif
105115

106116
ModuleBase::timer::finish( GlobalV::ofs_running );

source/input.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ void Input::Default(void)
357357

358358
cell_factor = 1.2; //LiuXh add 20180619
359359

360-
new_dm=1; // Shen Yu add 2019/5/9
361360
GlobalV::mulliken=0;// qi feng add 2019/9/10
362361

363362
//---------------------------------------------------------- //Peize Lin add 2020-04-04
@@ -1356,10 +1355,6 @@ bool Input::Read(const std::string &fn)
13561355
{
13571356
read_value(ifs, cell_factor);
13581357
}
1359-
else if (strcmp("newdm", word) == 0)
1360-
{
1361-
read_value(ifs, new_dm);
1362-
}
13631358
else if (strcmp("test_just_neighbor", word) == 0)
13641359
{
13651360
read_value(ifs, test_just_neighbor);
@@ -1996,7 +1991,6 @@ void Input::Bcast()
19961991

19971992
//Parallel_Common::bcast_int( epsilon0_choice );
19981993
Parallel_Common::bcast_double( cell_factor); //LiuXh add 20180619
1999-
Parallel_Common::bcast_int( new_dm ); // Shen Yu add 2019/5/9
20001994
Parallel_Common::bcast_bool( restart_save ); // Peize Lin add 2020.04.04
20011995
Parallel_Common::bcast_bool( restart_load ); // Peize Lin add 2020.04.04
20021996

source/input.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,6 @@ class Input
348348
bool input_error;
349349
double cell_factor; //LiuXh add 20180619
350350

351-
//==========================================================
352-
// new DM algorithm test
353-
// add by Shen Yu @ 2019/5/9
354-
// newDM values:
355-
// 0: not use new DM algorithm;
356-
// 1: use new DM algorithm and show no debug information
357-
// 2: use new DM algorithm and only show key debug information
358-
// 3: use new DM algorithm and show all detail debug information
359-
//==========================================================
360-
int new_dm;
361-
362351
//==========================================================
363352
// DFT+U Xin Qu added on 2020-10-29
364353
//==========================================================

0 commit comments

Comments
 (0)