Skip to content

Commit b264a75

Browse files
authored
Merge branch 'develop' into ucell3
2 parents 2a7bbaf + 6df9240 commit b264a75

File tree

149 files changed

+3363
-455
lines changed

Some content is hidden

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

149 files changed

+3363
-455
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,8 @@ if(ENABLE_LCAO)
725725
hcontainer
726726
deltaspin
727727
numerical_atomic_orbitals
728-
lr)
728+
lr
729+
rdmft)
729730
if(USE_ELPA)
730731
target_link_libraries(${ABACUS_BIN_NAME} genelpa)
731732
endif()

docs/advanced/elec_properties/hs_matrix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ We also offer the option of only calculating the overlap matrix without running
6161

6262
A file named `SR.csr` will be generated in the working directory, which contains the overlap matrix.
6363

64+
> When `nspin` is set to 1 or 2, the dimension of the overlap matrix is nlocal $\times$ nlocal, where nlocal is the total number of numerical atomic orbitals.
65+
These numerical atomic orbitals are ordered from outer to inner loop as atom, angular quantum number $l$, zeta (multiple radial orbitals corresponding to each $l$), and magnetic quantum number $m$.
66+
When `nspin` is set to 4, the dimension of the overlap matrix is (2 $\times$ nlocal) $\times$ (2 $\times$ nlocal). In this case, the numerical atomic orbitals are ordered from outer to inner loop as atom, angular quantum number $l$, zeta (multiple radial orbitals corresponding to each $l$), magnetic quantum number $m$, and npol (index of spin, ranges from 0 to 1).
67+
68+
6469
## examples
6570
We provide [examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/matrix_hs) of outputting the matrices. There are four examples:
6671

docs/advanced/elec_properties/position_matrix.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ Each file or each section of the appended file starts with "STEP: " followed by
1818

1919
Each block here contains the matrix for the corresponding cell. There are three columns in each block, giving the matrix elements in x, y, z directions, respectively. There are altogether nbasis * nbasis lines in each block, which emulates the matrix elements.
2020

21-
In molecular dynamics (MD) calculations, if [out_app_flag](../input_files/input-main.md#out_app_flag) is set to true, then `data-rR-tr` is written in an append manner. Otherwise, output files will be put in a separate directory, `matrix`, and named as `$x`_data-rR-tr, where `$x` is the number of MD step. In addition, The output frequency is controlled by [out_interval](../input_files/input-main.md#out_interval). For example, if we are running a 10-step MD with out_interval = 3, then `$x` will be 0, 3, 6, and 9.
21+
In molecular dynamics (MD) calculations, if [out_app_flag](../input_files/input-main.md#out_app_flag) is set to true, then `data-rR-tr` is written in an append manner. Otherwise, output files will be put in a separate directory, `matrix`, and named as `$x`_data-rR-tr, where `$x` is the number of MD step. In addition, the output frequency is controlled by [out_interval](../input_files/input-main.md#out_interval). For example, if we are running a 10-step MD with out_interval = 3, then `$x` will be 0, 3, 6, and 9.
22+
23+
## get_S
24+
We also offer the option of only calculating the position matrix without running SCF. For that purpose, in `INPUT` file we need to set the keyword [calculation](../input_files/input-main.md#calculation) to `get_S`, and [out_mat_r](../input_files/input-main.md#out_mat_r) to `true`.

docs/advanced/input_files/input-main.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@
435435
- [abs\_broadening](#abs_broadening)
436436
- [ri\_hartree\_benchmark](#ri_hartree_benchmark)
437437
- [aims\_nbasis](#aims_nbasis)
438+
- [Reduced Density Matrix Functional Theory](#Reduced-Density-Matrix-Functional-Theory)
439+
- [rdmft](#rdmft)
440+
- [rdmft\_power\_alpha](#rdmft_power_alpha)
438441

439442
[back to top](#full-list-of-input-keywords)
440443
## System variables
@@ -1717,7 +1720,7 @@ These variables are used to control the output of properties.
17171720

17181721
- **Type**: Boolean
17191722
- **Availability**: Numerical atomic orbital basis (not gamma-only algorithm)
1720-
- **Description**: Whether to print the matrix representation of the position matrix (in Bohr) into a file named `data-rR-tr` in the directory `OUT.${suffix}`. For more information, please refer to [position_matrix.md](../elec_properties/position_matrix.md#extracting-position-matrices).
1723+
- **Description**: Whether to print the matrix representation of the position matrix (in Bohr) into a file named `data-rR-tr` in the directory `OUT.${suffix}`. If [calculation](#calculation) is set to `get_S`, the position matrix can be obtained without scf iterations. For more information, please refer to [position_matrix.md](../elec_properties/position_matrix.md#extracting-position-matrices).
17211724
- **Default**: False
17221725

17231726
### out_mat_hs2
@@ -4031,4 +4034,21 @@ The output files are `OUT.${suffix}/Excitation_Energy.dat` and `OUT.${suffix}/Ex
40314034
- **Description**: Atomic basis set size for each atom type (with the same order as in `STRU`) in FHI-aims.
40324035
- **Default**: {} (empty list, where ABACUS use its own basis set size)
40334036

4037+
## Reduced Density Matrix Functional Theory
4038+
4039+
ab-initio methods and the xc-functional parameters used in RDMFT.
4040+
The physical quantities that RDMFT temporarily expects to output are the kinetic energy, total energy, and 1-RDM of the system in the ground state, etc.
4041+
4042+
### rdmft
4043+
4044+
- **Type**: Boolean
4045+
- **Description**: Whether to perform rdmft calculation (reduced density matrix funcional theory)
4046+
- **Default**: false
4047+
4048+
### rdmft_power_alpha
4049+
4050+
- **Type**: Real
4051+
- **Description**: The alpha parameter of power-functional(or other exx-type/hybrid functionals) which used in RDMFT, g(occ_number) = occ_number^alpha
4052+
- **Default**: 0.656
4053+
40344054
[back to top](#full-list-of-input-keywords)

source/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ add_subdirectory(module_ri)
1818
add_subdirectory(module_parameter)
1919
add_subdirectory(module_lr)
2020

21+
# add by jghan
22+
add_subdirectory(module_rdmft)
23+
2124
add_library(
2225
driver
2326
OBJECT

source/Makefile.Objects

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ VPATH=./src_global:\
7474
./module_lr/operator_casida:\
7575
./module_lr/potentials:\
7676
./module_lr/utils:\
77+
./module_rdmft:\
7778
./\
7879

7980
OBJS_ABACUS_PW=${OBJS_MAIN}\
@@ -115,6 +116,7 @@ ${OBJS_DELTASPIN}\
115116
${OBJS_TENSOR}\
116117
${OBJS_HSOLVER_PEXSI}\
117118
${OBJS_LR}\
119+
${OBJS_RDMFT}
118120

119121
OBJS_MAIN=main.o\
120122
driver.o\
@@ -436,7 +438,6 @@ OBJS_SURCHEM=surchem.o\
436438
cal_totn.o\
437439
cal_vcav.o\
438440
cal_vel.o\
439-
corrected_energy.o\
440441
minimize_cg.o\
441442
sol_force.o\
442443

@@ -726,3 +727,8 @@ OBJS_TENSOR=tensor.o\
726727
lr_spectrum.o\
727728
hamilt_casida.o\
728729
esolver_lrtd_lcao.o\
730+
731+
OBJS_RDMFT=rdmft.o\
732+
rdmft_tools.o\
733+
rdmft_pot.o\
734+
update_state_rdmft.o\

source/driver.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ Driver::Driver()
1919

2020
Driver::~Driver()
2121
{
22-
// Release the device memory within singleton object GlobalC::ppcell
23-
// before the main function exits.
24-
GlobalC::ppcell.release_memory();
2522
}
2623

2724
void Driver::init()

source/module_cell/cell_index.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* the maximum L of a given atom, the number of chi of a given atom and a given L, the atom label of a given atom,
1313
* etc. The class provides the interface to get the information of the atoms and orbitals indices in the unit cell. It
1414
* also provides the interface to write the orbital information into a file. It is now used only in the Output_Mulliken
15-
* class. However, it is supposed to be able to replace GlobalC::ucell in LCAO codes where only cell indices are needed.
15+
* class. However, it is supposed to be able to replace ucell in LCAO codes where only cell indices are needed.
1616
* Take care that the three key vectors atomCounts, lnchiCounts, and atomLabels should be set from the UnitCell class.
1717
* It depends on nspin because the functions get_nw() and get_iwt() are related to nspin, and can
1818
* be used in the LCAO Hamiltonian construction.

source/module_cell/klist.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ int K_Vectors::get_ik_global(const int& ik, const int& nkstot)
5959
}
6060
}
6161

62-
void K_Vectors::set(const ModuleSymmetry::Symmetry& symm,
62+
void K_Vectors::set(const UnitCell& ucell,
63+
const ModuleSymmetry::Symmetry& symm,
6364
const std::string& k_file_name,
6465
const int& nspin_in,
6566
const ModuleBase::Matrix3& reciprocal_vec,
@@ -93,7 +94,7 @@ void K_Vectors::set(const ModuleSymmetry::Symmetry& symm,
9394
this->nspin = (this->nspin == 4) ? 1 : this->nspin;
9495

9596
// read KPT file and generate K-point grid
96-
bool read_succesfully = this->read_kpoints(k_file_name);
97+
bool read_succesfully = this->read_kpoints(ucell,k_file_name);
9798
#ifdef __MPI
9899
Parallel_Common::bcast_bool(read_succesfully);
99100
#endif
@@ -113,7 +114,7 @@ void K_Vectors::set(const ModuleSymmetry::Symmetry& symm,
113114
{
114115
bool match = true;
115116
// calculate kpoints in IBZ and reduce kpoints according to symmetry
116-
this->ibz_kpoint(symm, ModuleSymmetry::Symmetry::symm_flag, skpt1, GlobalC::ucell, match);
117+
this->ibz_kpoint(symm, ModuleSymmetry::Symmetry::symm_flag, skpt1, ucell, match);
117118
#ifdef __MPI
118119
Parallel_Common::bcast_bool(match);
119120
#endif
@@ -128,7 +129,7 @@ void K_Vectors::set(const ModuleSymmetry::Symmetry& symm,
128129
std::cout << "Automatically set symmetry to 0 and continue ..." << std::endl;
129130
ModuleSymmetry::Symmetry::symm_flag = 0;
130131
match = true;
131-
this->ibz_kpoint(symm, ModuleSymmetry::Symmetry::symm_flag, skpt1, GlobalC::ucell, match);
132+
this->ibz_kpoint(symm, ModuleSymmetry::Symmetry::symm_flag, skpt1, ucell, match);
132133
} else {
133134
ModuleBase::WARNING_QUIT("K_Vectors::ibz_kpoint",
134135
"Possible solutions: \n \
@@ -209,7 +210,8 @@ void K_Vectors::renew(const int& kpoint_number)
209210

210211
// Read the KPT file, which contains K-point coordinates, weights, and grid size information
211212
// Generate K-point grid according to different parameters of the KPT file
212-
bool K_Vectors::read_kpoints(const std::string& fn)
213+
bool K_Vectors::read_kpoints(const UnitCell& ucell,
214+
const std::string& fn)
213215
{
214216
ModuleBase::TITLE("K_Vectors", "read_kpoints");
215217
if (GlobalV::MY_RANK != 0)
@@ -236,16 +238,16 @@ bool K_Vectors::read_kpoints(const std::string& fn)
236238
ModuleBase::WARNING_QUIT("K_Vectors", "kspacing should > 0");
237239
};
238240
// number of K points = max(1,int(|bi|/KSPACING+1))
239-
ModuleBase::Matrix3 btmp = GlobalC::ucell.G;
241+
ModuleBase::Matrix3 btmp = ucell.G;
240242
double b1 = sqrt(btmp.e11 * btmp.e11 + btmp.e12 * btmp.e12 + btmp.e13 * btmp.e13);
241243
double b2 = sqrt(btmp.e21 * btmp.e21 + btmp.e22 * btmp.e22 + btmp.e23 * btmp.e23);
242244
double b3 = sqrt(btmp.e31 * btmp.e31 + btmp.e32 * btmp.e32 + btmp.e33 * btmp.e33);
243245
int nk1
244-
= std::max(1, static_cast<int>(b1 * ModuleBase::TWO_PI / PARAM.inp.kspacing[0] / GlobalC::ucell.lat0 + 1));
246+
= std::max(1, static_cast<int>(b1 * ModuleBase::TWO_PI / PARAM.inp.kspacing[0] / ucell.lat0 + 1));
245247
int nk2
246-
= std::max(1, static_cast<int>(b2 * ModuleBase::TWO_PI / PARAM.inp.kspacing[1] / GlobalC::ucell.lat0 + 1));
248+
= std::max(1, static_cast<int>(b2 * ModuleBase::TWO_PI / PARAM.inp.kspacing[1] / ucell.lat0 + 1));
247249
int nk3
248-
= std::max(1, static_cast<int>(b3 * ModuleBase::TWO_PI / PARAM.inp.kspacing[2] / GlobalC::ucell.lat0 + 1));
250+
= std::max(1, static_cast<int>(b3 * ModuleBase::TWO_PI / PARAM.inp.kspacing[2] / ucell.lat0 + 1));
249251

250252
GlobalV::ofs_warning << " Generate k-points file according to KSPACING: " << fn << std::endl;
251253
std::ofstream ofs(fn.c_str());

source/module_cell/klist.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class K_Vectors
5050
* it will output a warning and suggest possible solutions.
5151
* @note Only available for nspin = 1 or 2 or 4.
5252
*/
53-
void set(const ModuleSymmetry::Symmetry& symm,
53+
void set(const UnitCell& ucell,
54+
const ModuleSymmetry::Symmetry& symm,
5455
const std::string& k_file_name,
5556
const int& nspin,
5657
const ModuleBase::Matrix3& reciprocal_vec,
@@ -204,7 +205,8 @@ class K_Vectors
204205
* @note If the k-points type is Line mode and the symmetry flag is 1, it will quit with a warning.
205206
* @note If the number of k-points is greater than 100000, it will quit with a warning.
206207
*/
207-
bool read_kpoints(const std::string& fn); // return 0: something wrong.
208+
bool read_kpoints(const UnitCell& ucell,
209+
const std::string& fn); // return 0: something wrong.
208210

209211
/**
210212
* @brief Adds k-points linearly between special points.

0 commit comments

Comments
 (0)