Skip to content

Commit 4d4a358

Browse files
committed
Merge branch 'develop' into refactor_libxc
2 parents 2d49c3d + 7fa03ca commit 4d4a358

File tree

390 files changed

+8195
-5208
lines changed

Some content is hidden

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

390 files changed

+8195
-5208
lines changed

CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ if(ENABLE_MPI)
238238
target_link_libraries(${ABACUS_BIN_NAME} MPI::MPI_CXX)
239239
add_compile_definitions(__MPI)
240240
list(APPEND math_libs MPI::MPI_CXX)
241-
else()
242-
find_package(MPI REQUIRED)
243-
include_directories(${MPI_CXX_INCLUDE_PATH})
244-
target_link_libraries(${ABACUS_BIN_NAME} MPI::MPI_CXX)
245-
list(APPEND math_libs MPI::MPI_CXX)
246241
endif()
247242

248243
find_package(Threads REQUIRED)
@@ -535,7 +530,7 @@ if(ENABLE_LIBRI)
535530
else()
536531
message(FATAL_ERROR "Must provide LIBRI_DIR for RI related features.")
537532
endif()
538-
target_link_libraries(${ABACUS_BIN_NAME} ri)
533+
target_link_libraries(${ABACUS_BIN_NAME} ri module_exx_symmetry)
539534
add_compile_definitions(__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0
540535
TEST_EXX_RADIAL=1)
541536
endif()
@@ -683,6 +678,7 @@ add_subdirectory(source)
683678
target_link_libraries(
684679
${ABACUS_BIN_NAME}
685680
base
681+
parameter
686682
cell
687683
symmetry
688684
md
@@ -705,7 +701,6 @@ target_link_libraries(
705701
psi_initializer
706702
esolver
707703
vdw
708-
parameter
709704
device
710705
container)
711706
if(ENABLE_LCAO)

docs/advanced/input_files/input-main.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@
243243
- [exx\_opt\_orb\_ecut](#exx_opt_orb_ecut)
244244
- [exx\_opt\_orb\_tolerence](#exx_opt_orb_tolerence)
245245
- [exx\_real\_number](#exx_real_number)
246+
- [exx\_symmetry\_realspace](#exx_symmetry_realspace)
246247
- [rpa\_ccp\_rmesh\_times](#rpa_ccp_rmesh_times)
247248
- [Molecular dynamics](#molecular-dynamics)
248249
- [md\_type](#md_type)
@@ -568,6 +569,7 @@ These variables are used to control general system parameters.
568569

569570
- atomic: the density is starting from the summation of the atomic density of single atoms.
570571
- file: the density will be read in from a binary file `charge-density.dat` first. If it does not exist, the charge density will be read in from cube files. Besides, when you do `nspin=1` calculation, you only need the density file SPIN1_CHG.cube. However, if you do `nspin=2` calculation, you also need the density file SPIN2_CHG.cube. The density file should be output with these names if you set out_chg = 1 in INPUT file.
572+
- wfc: the density will be calculated by wavefunctions and occupations. Wavefunctions are read in from binary files `WAVEFUNC*.dat` while occupations are read in from file `istate.info`.
571573
- auto: Abacus first attempts to read the density from a file; if not found, it defaults to using atomic density.
572574
- **Default**: atomic
573575

@@ -2425,6 +2427,15 @@ These variables are relevant when using hybrid functionals.
24252427
- **Description**: How many times larger the radial mesh required is to that of atomic orbitals in the postprocess calculation of the **bare** Coulomb matrix for RPA, GW, etc.
24262428
- **Default**: 10
24272429

2430+
### exx_symmetry_realspace
2431+
2432+
- **Type**: Boolean
2433+
- **Availability**: *[symmetry](#symmetry)==1* and exx calculation (*[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0/opt_orb* or *[rpa](#rpa)==True*)
2434+
- **Description**:
2435+
- False: only rotate k-space density matrix D(k) from irreducible k-points to accelerate diagonalization
2436+
- True: rotate both D(k) and Hexx(R) to accelerate both diagonalization and EXX calculation
2437+
- **Default**: True
2438+
24282439
[back to top](#full-list-of-input-keywords)
24292440

24302441
## Molecular dynamics

examples/hse/lcao_Si2/INPUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ecutwfc 100
1010
scf_thr 1e-8
1111
scf_nmax 100
1212
gamma_only 0
13-
symmetry -1
13+
symmetry 1
1414
smearing_method gauss
1515
mixing_type broyden
1616
mixing_beta 0.4

source/Makefile.Objects

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ OBJS_IO=input_conv.o\
485485
rhog_io.o\
486486
read_exit_file.o\
487487
read_wfc_pw.o\
488+
read_wfc_to_rho.o\
488489
restart.o\
489490
binstream.o\
490491
to_wannier90.o\
@@ -526,7 +527,7 @@ OBJS_IO=input_conv.o\
526527
read_input_item_exx_dftu.o\
527528
read_input_item_other.o\
528529
read_input_item_output.o\
529-
bcast_globalv.o\
530+
read_set_globalv.o\
530531

531532
OBJS_IO_LCAO=cal_r_overlap_R.o\
532533
write_orb_info.o\
@@ -607,6 +608,8 @@ OBJS_MODULE_RI=conv_coulomb_pot_k.o\
607608
RI_2D_Comm.o\
608609
Mix_DMk_2D.o\
609610
Mix_Matrix.o\
611+
symmetry_rotation.o\
612+
symmetry_irreducible_sector.o\
610613

611614
OBJS_PARALLEL=parallel_common.o\
612615
parallel_global.o\

source/driver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ void Driver::print_start_info()
106106
std::cout << std::setiosflags(std::ios::left);
107107

108108
GlobalV::ofs_running << "\n READING GENERAL INFORMATION" << std::endl;
109-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "global_out_dir", GlobalV::global_out_dir);
110-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "global_in_card", GlobalV::global_in_card);
109+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "global_out_dir", PARAM.globalv.global_out_dir);
110+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "global_in_card", PARAM.globalv.global_in_card);
111111
}
112112

113113
void Driver::reading()
@@ -119,15 +119,15 @@ void Driver::reading()
119119

120120
// (1) read the input file
121121
ModuleIO::ReadInput read_input(PARAM.globalv.myrank);
122-
read_input.read_parameters(PARAM, GlobalV::global_in_card);
122+
read_input.read_parameters(PARAM, PARAM.globalv.global_in_card);
123123

124124
// (2) create the output directory, running_*.log and print info
125125
read_input.create_directory(PARAM);
126126
this->print_start_info();
127127

128128
// (3) write the input file
129129
std::stringstream ss1;
130-
ss1 << GlobalV::global_out_dir << GlobalV::global_in_card;
130+
ss1 << PARAM.globalv.global_out_dir << PARAM.globalv.global_in_card;
131131
read_input.write_parameters(PARAM, ss1.str());
132132

133133
// (*temp*) copy the variables from INPUT to each class

source/module_base/global_file.cpp

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
//==========================================================
22
// AUTHOR : mohan
3+
34
// DATE : 2008-11-10
45
//==========================================================
56
#include "global_file.h"
67

78
#ifdef __MPI
89
#include <mpi.h>
910
#endif
10-
1111
#include <unistd.h>
1212
#include <sstream>
1313
#include "global_function.h"
14+
#include "module_parameter/parameter.h"
1415
#include "global_variable.h"
1516
#include "module_base/parallel_common.h"
1617
#include "module_base/parallel_reduce.h"
@@ -33,28 +34,12 @@ void ModuleBase::Global_File::make_dir_out(
3334
// NAME : system
3435
//----------------------------------------------------------
3536

36-
std::string prefix ;
37-
38-
#ifdef __EPM
39-
#ifdef __MPI
40-
prefix = "OUT_EPM_MPI.";
41-
#else
42-
prefix = "OUT_EPM.";
43-
#endif
44-
#else
45-
prefix = "OUT.";
46-
#endif
47-
48-
GlobalV::global_out_dir = prefix + suffix + "/";
49-
GlobalV::global_stru_dir = GlobalV::global_out_dir + "STRU/";
50-
GlobalV::global_matrix_dir = GlobalV::global_out_dir + "matrix/";
51-
5237
#ifdef __MPI
5338
MPI_Barrier(MPI_COMM_WORLD);
5439
#endif
5540
int make_dir = 0;
5641
// mohan update 2011-05-03
57-
std::string command0 = "test -d " + GlobalV::global_out_dir + " || mkdir " + GlobalV::global_out_dir;
42+
std::string command0 = "test -d " + PARAM.globalv.global_out_dir + " || mkdir " + PARAM.globalv.global_out_dir;
5843

5944
int times = 0;
6045
while(times<GlobalV::NPROC)
@@ -63,7 +48,7 @@ void ModuleBase::Global_File::make_dir_out(
6348
{
6449
if ( system( command0.c_str() ) == 0 )
6550
{
66-
std::cout << " MAKE THE DIR : " << GlobalV::global_out_dir << std::endl;
51+
std::cout << " MAKE THE DIR : " << PARAM.globalv.global_out_dir << std::endl;
6752
make_dir = 1;
6853
}
6954
else
@@ -92,7 +77,7 @@ void ModuleBase::Global_File::make_dir_out(
9277
if(calculation == "md")
9378
{
9479
int make_dir_stru = 0;
95-
std::string command1 = "test -d " + GlobalV::global_stru_dir + " || mkdir " + GlobalV::global_stru_dir;
80+
std::string command1 = "test -d " + PARAM.globalv.global_stru_dir + " || mkdir " + PARAM.globalv.global_stru_dir;
9681

9782
times = 0;
9883
while(times<GlobalV::NPROC)
@@ -101,7 +86,7 @@ void ModuleBase::Global_File::make_dir_out(
10186
{
10287
if ( system( command1.c_str() ) == 0 )
10388
{
104-
std::cout << " MAKE THE STRU DIR : " << GlobalV::global_stru_dir << std::endl;
89+
std::cout << " MAKE THE STRU DIR : " << PARAM.globalv.global_stru_dir << std::endl;
10590
make_dir_stru = 1;
10691
}
10792
else
@@ -132,7 +117,7 @@ void ModuleBase::Global_File::make_dir_out(
132117
if((out_dir) && calculation == "md")
133118
{
134119
int make_dir_matrix = 0;
135-
std::string command1 = "test -d " + GlobalV::global_matrix_dir + " || mkdir " + GlobalV::global_matrix_dir;
120+
std::string command1 = "test -d " + PARAM.globalv.global_matrix_dir + " || mkdir " + PARAM.globalv.global_matrix_dir;
136121

137122
times = 0;
138123
while(times<GlobalV::NPROC)
@@ -141,7 +126,7 @@ void ModuleBase::Global_File::make_dir_out(
141126
{
142127
if ( system( command1.c_str() ) == 0 )
143128
{
144-
std::cout << " MAKE THE MATRIX DIR : " << GlobalV::global_stru_dir << std::endl;
129+
std::cout << " MAKE THE MATRIX DIR : " << PARAM.globalv.global_stru_dir << std::endl;
145130
make_dir_matrix = 1;
146131
}
147132
else
@@ -209,7 +194,7 @@ void ModuleBase::Global_File::make_dir_atom(const std::string &label)
209194
// EXPLAIN : generate atom dir for each type of atom
210195
//----------------------------------------------------------
211196
std::stringstream ss;
212-
ss << GlobalV::global_out_dir << label << "/";
197+
ss << PARAM.globalv.global_out_dir << label << "/";
213198
ModuleBase::GlobalFunc::MAKE_DIR(ss.str());
214199
return;
215200
}
@@ -218,10 +203,10 @@ void ModuleBase::Global_File::open_log(std::ofstream &ofs, const std::string &fn
218203
{
219204
//----------------------------------------------------------
220205
// USE GLOBAL VARIABLE :
221-
// GlobalV::global_out_dir : (default dir to store "*.log" file)
206+
// PARAM.globalv.global_out_dir : (default dir to store "*.log" file)
222207
//----------------------------------------------------------
223208
std::stringstream ss;
224-
ss << GlobalV::global_out_dir << fn << ".log";
209+
ss << PARAM.globalv.global_out_dir << fn << ".log";
225210

226211
if(calculation == "md" && restart)
227212
{
@@ -296,9 +281,9 @@ void ModuleBase::Global_File::delete_tmp_files()
296281
{
297282
for (int is = 0; is < GlobalV::NSPIN; ++is)
298283
{
299-
std::string tmp_chg_1 = GlobalV::global_out_dir + "NOW_SPIN" + std::to_string(is + 1) + "_CHG.cube";
300-
std::string tmp_chg_2 = GlobalV::global_out_dir + "OLD1_SPIN" + std::to_string(is + 1) + "_CHG.cube";
301-
std::string tmp_chg_3 = GlobalV::global_out_dir + "OLD2_SPIN" + std::to_string(is + 1) + "_CHG.cube";
284+
std::string tmp_chg_1 = PARAM.globalv.global_out_dir + "NOW_SPIN" + std::to_string(is + 1) + "_CHG.cube";
285+
std::string tmp_chg_2 = PARAM.globalv.global_out_dir + "OLD1_SPIN" + std::to_string(is + 1) + "_CHG.cube";
286+
std::string tmp_chg_3 = PARAM.globalv.global_out_dir + "OLD2_SPIN" + std::to_string(is + 1) + "_CHG.cube";
302287

303288
if (access(tmp_chg_1.c_str(), 0) == 0)
304289
{

source/module_base/global_function.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -104,48 +104,6 @@ void DONE(std::ofstream &ofs, const std::string &description, const bool only_ra
104104
return;
105105
}
106106

107-
//==========================================================
108-
// GLOBAL FUNCTION :
109-
// NAME : TEST_LEVEL
110-
// control the test_level
111-
//==========================================================
112-
void TEST_LEVEL(const std::string &name, bool disable=true)
113-
{
114-
if (disable) return;
115-
116-
if (name == "none")
117-
{
118-
GlobalV::test_wf = 0;
119-
GlobalV::test_potential = 0;
120-
GlobalV::test_charge = 0;
121-
}
122-
else if (name == "init_potential")
123-
{
124-
GlobalV::test_wf = 1;
125-
GlobalV::test_potential = 1;
126-
GlobalV::test_charge = 1;
127-
}
128-
else if (name == "init_read")
129-
{
130-
GlobalV::test_input = 1;
131-
GlobalV::test_winput = 1;
132-
GlobalV::test_kpoint = 1;
133-
GlobalV::test_atom = 1;
134-
GlobalV::test_unitcell = 1;
135-
#ifndef __EPM
136-
GlobalV::test_pseudo_cell = 1;
137-
#else
138-
test_epm_unitcell = 1;
139-
#endif
140-
}
141-
else if (name == "pw_init")
142-
{
143-
GlobalV::test_pw = 1;
144-
}
145-
146-
return;
147-
}
148-
149107
bool SCAN_BEGIN(std::ifstream &ifs, const std::string &TargetName, const bool restart, const bool ifwarn)
150108
{
151109
std::string SearchName;

0 commit comments

Comments
 (0)