Skip to content

Commit 1bee98c

Browse files
authored
Merge branch 'develop' into dsp1
2 parents 8d6cbdf + a94c62d commit 1bee98c

File tree

473 files changed

+4906
-2408
lines changed

Some content is hidden

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

473 files changed

+4906
-2408
lines changed

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ option(USE_CUDA_MPI "Enable CUDA-aware MPI" OFF)
1717
option(USE_CUDA_ON_DCU "Enable CUDA on DCU" OFF)
1818
option(USE_ROCM "Enable ROCm" OFF)
1919
option(USE_DSP "Enable DSP" OFF)
20+
option(USE_SW "Enable SW Architecture" OFF)
2021

2122
option(USE_ABACUS_LIBM "Build libmath from source to speed up" OFF)
2223
option(ENABLE_LIBXC "Enable using the LibXC package" OFF)
@@ -281,8 +282,23 @@ if (USE_DSP)
281282
target_link_libraries(${ABACUS_BIN_NAME} ${MT_HOST_DIR}/hthreads/lib/libhthread_device.a)
282283
target_link_libraries(${ABACUS_BIN_NAME} ${MT_HOST_DIR}/hthreads/lib/libhthread_host.a)
283284
endif()
285+
284286
target_link_libraries(${ABACUS_BIN_NAME} ${SCALAPACK_LIBRARY_DIR})
285287

288+
if (USE_SW)
289+
add_compile_definitions(__SW)
290+
set(SW ON)
291+
include_directories(${SW_MATH}/include)
292+
include_directories(${SW_FFT}/include)
293+
294+
target_link_libraries(${ABACUS_BIN_NAME} ${SW_FFT}/lib/libfftw3.a)
295+
target_link_libraries(${ABACUS_BIN_NAME} ${SW_MATH}/libswfft.a)
296+
target_link_libraries(${ABACUS_BIN_NAME} ${SW_MATH}/libswscalapack.a)
297+
target_link_libraries(${ABACUS_BIN_NAME} ${SW_MATH}/libswlapack.a)
298+
target_link_libraries(${ABACUS_BIN_NAME} ${SW_MATH}/libswblas.a)
299+
endif()
300+
301+
286302
find_package(Threads REQUIRED)
287303
target_link_libraries(${ABACUS_BIN_NAME} Threads::Threads)
288304

@@ -460,6 +476,9 @@ if(MKLROOT)
460476
if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
461477
list(APPEND math_libs ifcore)
462478
endif()
479+
elseif(USE_SW)
480+
list(APPEND math_libs gfortran)
481+
# SW architecture can only use its own math library
463482
else()
464483
find_package(FFTW3 REQUIRED)
465484
find_package(Lapack REQUIRED)

docs/advanced/input_files/input-main.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [symmetry](#symmetry)
99
- [symmetry\_prec](#symmetry_prec)
1010
- [symmetry\_autoclose](#symmetry_autoclose)
11+
- [cal_symm_repr](#cal_symm_repr)
1112
- [kpar](#kpar)
1213
- [bndpar](#bndpar)
1314
- [latname](#latname)
@@ -375,6 +376,8 @@
375376
- [out\_wannier\_unk](#out_wannier_unk)
376377
- [out\_wannier\_wvfn\_formatted](#out_wannier_wvfn_formatted)
377378
- [rt-TDDFT: Real-time time dependent density functional theory](#tddft-time-dependent-density-functional-theory)
379+
- [estep\_per\_md](#estep_per_md)
380+
- [td\_dt](#td_dt)
378381
- [td\_edm](#td_edm)
379382
- [td\_print\_eij](#td_print_eij)
380383
- [td\_propagator](#td_propagator)
@@ -510,6 +513,7 @@ These variables are used to control general system parameters.
510513
- get_wf: obtain real space wave functions (for LCAO basis only). See `out_wfc_norm` and `out_wfc_re_im` for more information
511514
- get_s: obtain the overlap matrix formed by localized orbitals (for LCAO basis with multiple k points). the file name is `SR.csr` with file format being the same as that generated by [out_mat_hs2](#out_mat_hs2). Note: in the 3.10-LTS version, the command was named `get_S`
512515
- gen_bessel: generates projectors, i.e., a series of Bessel functions, for the DeePKS method (for LCAO basis only); see also keywords `bessel_descriptor_lmax`, `bessel_descriptor_rcut` and `bessel_descriptor_tolerence`. A file named `jle.orb` will be generated which contains the projectors. An example is provided in examples/H2O-deepks-pw
516+
- gen_opt_abfs: generate opt-ABFs as discussed in this [article](https://pubs.acs.org/doi/abs/10.1021/acs.jpclett.0c00481).
513517
- test_memory: obtain a rough estimation of memory consuption for the calculation
514518
- test_neighbour: obtain information of neighboring atoms (for LCAO basis only), please specify a positive [search_radius](#search_radius) manually
515519
- **Default**: scf
@@ -538,7 +542,7 @@ These variables are used to control general system parameters.
538542
- **Default**:
539543
- 0:
540544
- if [calculation](#calculation)==md/nscf/get_pchg/get_wf/get_s or [gamma_only](#gamma_only)==True;
541-
- If ([dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0/opt_orb or [rpa](#rpa)==True).
545+
- If ([dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0 or [rpa](#rpa)==True).
542546
- If [efield_flag](#efield_flag)==1
543547
- 1: else
544548

@@ -559,6 +563,11 @@ These variables are used to control general system parameters.
559563
- True: automatically set symmetry to 0 and continue running without symmetry analysis
560564
- **Default**: True
561565

566+
### cal_symm_repr
567+
- **Type**: Integer [Integer]\(optional\)
568+
- **Description**: Whether to print the matrix representation of symmetry operation to running log file. If the first value is given as 1, then all matrix representations will be printed. The second optional parameter controls the precision (number of digits) to print, default is 3, which is enough for a quick check.
569+
- **Default**: 1 3
570+
562571
### kpar
563572

564573
- **Type**: Integer
@@ -761,7 +770,7 @@ These variables are used to control parameters related to input files.
761770
- **Availability**: Used only when numerical atomic orbitals are employed as basis set.
762771
- **Description**: If [restart_save](#restart_save) is set to true and an electronic iteration is finished, calculations can be restarted from the charge density file, which are saved in the former calculation. Please ensure [read_file_dir](#read_file_dir) is correct, and the charge density file exist.
763772

764-
If EXX(exact exchange) is calculated (i.e. *[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0/opt_orb* or *[rpa](#rpa)==True*), the Hexx(R) files in the same folder for each processor will also be read.
773+
If EXX(exact exchange) is calculated (i.e. *[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0* or *[rpa](#rpa)==True*), the Hexx(R) files in the same folder for each processor will also be read.
765774
- **Default**: False
766775

767776
### wannier_card
@@ -1055,7 +1064,6 @@ calculations.
10551064

10561065
Furthermore, the old INPUT parameter exx_hybrid_type for hybrid functionals has been absorbed into dft_functional. Options are `hf` (pure Hartree-Fock), `pbe0`(PBE0), `hse` (Note: in order to use HSE functional, LIBXC is required). Note also that HSE has been tested while PBE0 has NOT been fully tested yet, and the maximum CPU cores for running exx in parallel is $N(N+1)/2$, with N being the number of atoms.
10571066

1058-
If set to `opt_orb`, the program will not perform hybrid functional calculation. Instead, it is going to generate opt-ABFs as discussed in this [article](https://pubs.acs.org/doi/abs/10.1021/acs.jpclett.0c00481).
10591067
- **Default**: Used the same as DFT functional as specified in the pseudopotential files.
10601068

10611069
### xc_temperature
@@ -1643,7 +1651,7 @@ These variables are used to control the output of properties.
16431651
---
16441652
The circle order of the charge density on real space grids is: x is the outer loop, then y and finally z (z is moving fastest).
16451653

1646-
In EXX(exact exchange) calculations, (i.e. *[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0/opt_orb* or *[rpa](#rpa)==True*), the Hexx(R) files will be output in the folder `OUT.${suffix}` too, which can be read in NSCF calculation.
1654+
In EXX(exact exchange) calculations, (i.e. *[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0* or *[rpa](#rpa)==True*), the Hexx(R) files will be output in the folder `OUT.${suffix}` too, which can be read in NSCF calculation.
16471655

16481656
In molecular dynamics simulations, the output frequency is controlled by [out_interval](#out_interval).
16491657
- **Default**: 0 3
@@ -1728,7 +1736,7 @@ These variables are used to control the output of properties.
17281736

17291737
- **Type**: Integer
17301738
- **Availability**: Numerical atomic orbital basis
1731-
- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{s}{spin index}{k(optional)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the wave functions accumulate during ionic steps.
1739+
- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{s}{spin index}{k(optional)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the wave functions accumulate during ionic steps. If the out_app_flag is set to false, a new folder named WFC will be created, and the wave function files will be saved into it.
17321740
- 0: no output
17331741
- 1: (txt format)
17341742
- gamma-only: `wfs1_nao.txt` or `wfs2_nao.txt`, ...;
@@ -1963,7 +1971,7 @@ These variables are used to control the output of properties.
19631971
- auto: These files are saved in folder `OUT.${suffix}/restart/`;
19641972
- other: These files are saved in folder `${read_file_dir}/restart/`.
19651973

1966-
If EXX(exact exchange) is calculated (i.e. *[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0/opt_orb* or *[rpa](#rpa)==True*), the Hexx(R) files for each processor will also be saved in the above folder, which can be read in EXX calculation with *[restart_load](#restart_load)==True*.
1974+
If EXX(exact exchange) is calculated (i.e. *[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0* or *[rpa](#rpa)==True*), the Hexx(R) files for each processor will also be saved in the above folder, which can be read in EXX calculation with *[restart_load](#restart_load)==True*.
19671975
- **Default**: False
19681976

19691977
### rpa (Under Development Feature)
@@ -2925,22 +2933,22 @@ These variables are relevant when using hybrid functionals with *[basis_type](#b
29252933
### exx_opt_orb_lmax
29262934

29272935
- **Type**: Integer
2928-
- **Availability**: *[dft_functional](#dft_functional)==opt_orb*
2936+
- **Availability**: *[calculation](#calculation)==gen_opt_abfs*
29292937
- **Description**: The maximum l of the spherical Bessel functions, when the radial part of opt-ABFs are generated as linear combinations of spherical Bessel functions. A reasonable choice is 2.
29302938
- **Default**: 0
29312939

29322940
### exx_opt_orb_ecut
29332941

29342942
- **Type**: Real
2935-
- **Availability**: *[dft_functional](#dft_functional)==opt_orb*
2943+
- **Availability**: *[calculation](#calculation)==gen_opt_abfs*
29362944
- **Description**: The cut-off of plane wave expansion, when the plane wave basis is used to optimize the radial ABFs. A reasonable choice is 60.
29372945
- **Default**: 0
29382946
- **Unit**: Ry
29392947

29402948
### exx_opt_orb_tolerence
29412949

29422950
- **Type**: Real
2943-
- **Availability**: *[dft_functional](#dft_functional)==opt_orb*
2951+
- **Availability**: *[calculation](#calculation)==gen_opt_abfs*
29442952
- **Description**: The threshold when solving for the zeros of spherical Bessel functions. A reasonable choice is 1e-12.
29452953
- **Default**: 0
29462954

@@ -2973,7 +2981,7 @@ These variables are relevant when using hybrid functionals with *[basis_type](#b
29732981
### exx_symmetry_realspace
29742982

29752983
- **Type**: Boolean
2976-
- **Availability**: *[symmetry](#symmetry)==1* and exx calculation (*[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0/opt_orb* or *[rpa](#rpa)==True*)
2984+
- **Availability**: *[symmetry](#symmetry)==1* and exx calculation (*[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0* or *[rpa](#rpa)==True*)
29772985
- **Description**:
29782986
- False: only rotate k-space density matrix D(k) from irreducible k-points to accelerate diagonalization
29792987
- True: rotate both D(k) and Hexx(R) to accelerate both diagonalization and EXX calculation
@@ -3687,6 +3695,18 @@ These variables are used to control berry phase and wannier90 interface paramete
36873695

36883696
## TDDFT: time dependent density functional theory
36893697

3698+
### estep_per_md
3699+
3700+
- **Type**: Integer
3701+
- **Description**: The number of electron propagation steps between two ionic steps.
3702+
- **Default**: 1
3703+
3704+
### td_dt
3705+
3706+
- **Type**: Real
3707+
- **Description**: The time step used in electron propagation. Setting td_dt will reset the md_dt value to td_dt * estep_per_md.
3708+
- **Default**: md_dt/estep_per_md
3709+
36903710
### td_edm
36913711

36923712
- **Type**: Integer
@@ -3739,6 +3759,7 @@ These variables are used to control berry phase and wannier90 interface paramete
37393759
Type of electric field in space domain
37403760
- 0: length gauge.
37413761
- 1: velocity gauge.
3762+
- 2: hybrid gauge.
37423763
- **Default**: 0
37433764

37443765
### td_ttype

source/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ add_subdirectory(source_io)
1616
add_subdirectory(source_relax)
1717
add_subdirectory(source_lcao/module_ri)
1818
add_subdirectory(source_io/module_parameter)
19-
add_subdirectory(module_lr)
19+
add_subdirectory(source_lcao/module_lr)
2020

2121
# add by jghan
2222
add_subdirectory(source_lcao/module_rdmft)

source/Makefile.Objects

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ VPATH=./src_global:\
2020
./source_cell:\
2121
./source_base:\
2222
./source_base/kernels:\
23+
./source_base/module_external:\
2324
./source_base/module_container/base/core:\
2425
./source_base/module_container/ATen/core:\
2526
./source_base/module_container/ATen/kernels:\
@@ -32,7 +33,7 @@ VPATH=./src_global:\
3233
./source_esolver:\
3334
./source_hsolver:\
3435
./source_hsolver/kernels:\
35-
./source_hsolver/genelpa:\
36+
./source_hsolver/module_genelpa:\
3637
./source_hsolver/module_pexsi:\
3738
./source_estate:\
3839
./source_estate/kernels:\
@@ -69,12 +70,12 @@ VPATH=./src_global:\
6970
./src_ri:\
7071
./source_lcao/module_ri:\
7172
./source_io/module_parameter:\
72-
./module_lr:\
73-
./module_lr/ao_to_mo_transformer:\
74-
./module_lr/dm_trans:\
75-
./module_lr/operator_casida:\
76-
./module_lr/potentials:\
77-
./module_lr/utils:\
73+
./source_lcao/module_lr:\
74+
./source_lcao/module_lr/ao_to_mo_transformer:\
75+
./source_lcao/module_lr/dm_trans:\
76+
./source_lcao/module_lr/operator_casida:\
77+
./source_lcao/module_lr/potentials:\
78+
./source_lcao/module_lr/utils:\
7879
./source_lcao/module_rdmft:\
7980
./\
8081

@@ -356,6 +357,7 @@ OBJS_HAMILT_LCAO=hamilt_lcao.o\
356357
overlap_new.o\
357358
td_ekinetic_lcao.o\
358359
td_nonlocal_lcao.o\
360+
td_pot_hybrid.o\
359361
veff_lcao.o\
360362
meta_lcao.o\
361363
op_dftu_lcao.o\
@@ -624,8 +626,9 @@ OBJS_LCAO=evolve_elec.o\
624626
propagator_cn2.o\
625627
propagator_taylor.o\
626628
propagator_etrs.o\
627-
td_velocity.o\
628-
td_current.o\
629+
td_folding.o\
630+
td_info.o\
631+
velocity_op.o\
629632
snap_psibeta_half_tddft.o\
630633
solve_propagation.o\
631634
upsi.o\

source/source_base/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ add_library(
1010
base
1111
OBJECT
1212
assoc_laguerre.cpp
13-
blas_connector_base.cpp
14-
blas_connector_vector.cpp
15-
blas_connector_matrix.cpp
13+
module_external/blas_connector_base.cpp
14+
module_external/blas_connector_vector.cpp
15+
module_external/blas_connector_matrix.cpp
1616
clebsch_gordan_coeff.cpp
1717
complexarray.cpp
1818
complexmatrix.cpp
@@ -85,7 +85,7 @@ if(BUILD_TESTING)
8585
add_subdirectory(kernels/test)
8686
add_subdirectory(module_mixing/test)
8787
add_subdirectory(module_device/test)
88-
add_subdirectory(grid/test)
88+
add_subdirectory(module_grid/test)
8989
if (USE_ABACUS_LIBM)
9090
add_subdirectory(libm/test)
9191
endif()

source/source_base/complexmatrix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#ifdef __NORMAL
99
#else
10-
#include "blas_connector.h"
10+
#include "module_external/blas_connector.h"
1111
#endif
1212

1313
namespace ModuleBase

source/source_base/gather_math_lib_info.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Results will output to OUT/math_info.log, see ModuleBase::Global_File::make_dir_
88

99
#include <ostream>
1010
#undef GATHER_INFO
11-
#include "source_base/blas_connector.h"
12-
#include "source_base/lapack_connector.h"
11+
#include "source_base/module_external/blas_connector.h"
12+
#include "source_base/module_external/lapack_connector.h"
1313

1414
#include <iostream>
1515

source/source_base/global_file.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ void ModuleBase::Global_File::make_dir_out(
2525
const std::string &suffix,
2626
const std::string &calculation,
2727
const bool &out_dir,
28+
const bool &out_wfc_dir,
2829
const int rank,
2930
const bool &restart,
3031
const bool out_alllog)
@@ -153,6 +154,45 @@ void ModuleBase::Global_File::make_dir_out(
153154
#endif
154155
}
155156

157+
if(out_wfc_dir)
158+
{
159+
int make_dir_wfc = 0;
160+
std::string command1 = "test -d " + PARAM.globalv.global_wfc_dir + " || mkdir " + PARAM.globalv.global_wfc_dir;
161+
162+
times = 0;
163+
while(times<GlobalV::NPROC)
164+
{
165+
if(rank==times)
166+
{
167+
if ( system( command1.c_str() ) == 0 )
168+
{
169+
std::cout << " MAKE THE WFC DIR : " << PARAM.globalv.global_wfc_dir << std::endl;
170+
make_dir_wfc = 1;
171+
}
172+
else
173+
{
174+
std::cout << " PROC " << rank << " CAN NOT MAKE THE WFC DIR !!! " << std::endl;
175+
make_dir_wfc = 0;
176+
}
177+
}
178+
#ifdef __MPI
179+
Parallel_Reduce::reduce_all(make_dir_wfc);
180+
#endif
181+
if(make_dir_wfc>0) { break;
182+
}
183+
++times;
184+
}
185+
186+
#ifdef __MPI
187+
if(make_dir_wfc==0)
188+
{
189+
std::cout << " CAN NOT MAKE THE WFC DIR......." << std::endl;
190+
ModuleBase::QUIT();
191+
}
192+
MPI_Barrier(MPI_COMM_WORLD);
193+
#endif
194+
}
195+
156196
if(PARAM.inp.of_ml_gene_data == 1)
157197
{
158198
int make_dir_descrip = 0;

source/source_base/global_file.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace Global_File
2323
void make_dir_out(const std::string &suffix,
2424
const std::string &calculation,
2525
const bool &out_dir,
26+
const bool &out_wfc_dir,
2627
const int rank,
2728
const bool &restart,
2829
const bool out_alllog = false);

source/source_base/global_function.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void OUT(std::ofstream &ofs, const std::string &name)
6161
void MAKE_DIR(const std::string &fn)
6262
{
6363
// ModuleBase::TITLE("global_function","MAKE_DIR");
64+
#ifndef __SW
6465
if (GlobalV::MY_RANK == 0)
6566
{
6667
std::stringstream ss;
@@ -73,6 +74,7 @@ void MAKE_DIR(const std::string &fn)
7374
ModuleBase::WARNING_QUIT("MAKE_DIR", fn);
7475
}
7576
}
77+
#endif
7678
return;
7779
}
7880

0 commit comments

Comments
 (0)