Skip to content

Commit 9346d00

Browse files
authored
Merge branch 'develop' into mc
2 parents 13b70b2 + 6df9240 commit 9346d00

File tree

565 files changed

+9598
-8308
lines changed

Some content is hidden

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

565 files changed

+9598
-8308
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ target_link_libraries(
709709
hamilt_stodft
710710
psi
711711
psi_initializer
712+
psi_overall_init
712713
esolver
713714
vdw
714715
device
@@ -724,7 +725,8 @@ if(ENABLE_LCAO)
724725
hcontainer
725726
deltaspin
726727
numerical_atomic_orbitals
727-
lr)
728+
lr
729+
rdmft)
728730
if(USE_ELPA)
729731
target_link_libraries(${ABACUS_BIN_NAME} genelpa)
730732
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: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@
423423
- [pexsi\_zero\_thr](#pexsi_zero_thr)
424424
- [Linear Response TDDFT](#linear-response-tddft)
425425
- [xc\_kernel](#xc_kernel)
426+
- [lr\_init\_xc\_kernel](#lr_init_xc_kernel)
426427
- [lr\_solver](#lr_solver)
427428
- [lr\_thr](#lr_thr)
428429
- [nocc](#nocc)
@@ -434,6 +435,9 @@
434435
- [abs\_broadening](#abs_broadening)
435436
- [ri\_hartree\_benchmark](#ri_hartree_benchmark)
436437
- [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)
437441

438442
[back to top](#full-list-of-input-keywords)
439443
## System variables
@@ -988,7 +992,7 @@ calculations.
988992

989993
- **Type**: String
990994
- **Description**: In our package, the XC functional can either be set explicitly using the `dft_functional` keyword in `INPUT` file. If `dft_functional` is not specified, ABACUS will use the xc functional indicated in the pseudopotential file.
991-
On the other hand, if dft_functional is specified, it will overwrite the functional from pseudopotentials and performs calculation with whichever functional the user prefers. We further offer two ways of supplying exchange-correlation functional. The first is using 'short-hand' names such as 'LDA', 'PBE', 'SCAN'. A complete list of 'short-hand' expressions can be found in [the source code](../../../source/module_hamilt_general/module_xc/xc_functional.cpp). The other way is only available when ***compiling with LIBXC***, and it allows for supplying exchange-correlation functionals as combinations of LIBXC keywords for functional components, joined by a plus sign, for example, 'dft_functional='LDA_X_1D_EXPONENTIAL+LDA_C_1D_CSC'. The list of LIBXC keywords can be found on its [website](https://www.tddft.org/programs/libxc/functionals/). In this way, **we support all the LDA,GGA and mGGA functionals provided by LIBXC**.
995+
On the other hand, if dft_functional is specified, it will overwrite the functional from pseudopotentials and performs calculation with whichever functional the user prefers. We further offer two ways of supplying exchange-correlation functional. The first is using 'short-hand' names such as 'LDA', 'PBE', 'SCAN'. A complete list of 'short-hand' expressions can be found in [the source code](../../../source/module_hamilt_general/module_xc/xc_functional.cpp). The other way is only available when ***compiling with LIBXC***, and it allows for supplying exchange-correlation functionals as combinations of LIBXC keywords for functional components, joined by a plus sign, for example, dft_functional='LDA_X_1D_EXPONENTIAL+LDA_C_1D_CSC'. The list of LIBXC keywords can be found on its [website](https://libxc.gitlab.io/functionals/). In this way, **we support all the LDA,GGA and mGGA functionals provided by LIBXC**.
992996

993997
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. And forces for hybrid functionals are not supported yet.
994998

@@ -1388,7 +1392,7 @@ These variables are used to control the geometry relaxation.
13881392
### relax_nmax
13891393

13901394
- **Type**: Integer
1391-
- **Description**: The maximal number of ionic iteration steps, the minimum value is 1.
1395+
- **Description**: The maximal number of ionic iteration steps. If set to 0, the code performs a quick "dry run", stopping just after initialization. This is useful to check for input correctness and to have the summary printed.
13921396
- **Default**: 1 for SCF, 50 for relax and cell-relax calcualtions
13931397

13941398
### relax_cg_thr
@@ -1716,7 +1720,7 @@ These variables are used to control the output of properties.
17161720

17171721
- **Type**: Boolean
17181722
- **Availability**: Numerical atomic orbital basis (not gamma-only algorithm)
1719-
- **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).
17201724
- **Default**: False
17211725

17221726
### out_mat_hs2
@@ -1759,14 +1763,14 @@ The band (KS orbital) energy for each (k-point, spin, band) will be printed in t
17591763

17601764
- **Type**: Boolean
17611765
- **Availability**: Numerical atomic orbital basis
1762-
- **Description**: Whether to print Hamiltonian matrices H(R)/density matrics DM(R) in npz format. This feature does not work for gamma-only calculations. Currently only intended for internal usage.
1766+
- **Description**: Whether to print Hamiltonian matrices $H(R)$/density matrics $DM(R)$ in npz format. This feature does not work for gamma-only calculations. Currently only intended for internal usage.
17631767
- **Default**: False
17641768

17651769
### dm_to_rho
17661770

17671771
- **Type**: Boolean
17681772
- **Availability**: Numerical atomic orbital basis
1769-
- **Description**: Reads density matrix DM(R) in npz format and creates electron density on grids. This feature does not work for gamma-only calculations. Only supports serial calculations. Currently only intended for internal usage.
1773+
- **Description**: Reads density matrix $DM(R)$ in npz format and creates electron density on grids. This feature does not work for gamma-only calculations. Only supports serial calculations. Currently only intended for internal usage.
17701774
- **Default**: False
17711775

17721776
### out_app_flag
@@ -2925,7 +2929,7 @@ These variables are used to control DFT+U correlated parameters
29252929

29262930
- where $\gamma$ is a parameter that adjusts the relative weight of the error function to the derivative error function.
29272931
- **Unit**: Bohr
2928-
- **Default**: 5.0
2932+
- **Default**: 3.0
29292933

29302934
[back to top](#full-list-of-input-keywords)
29312935

@@ -3943,6 +3947,15 @@ These parameters are used to solve the excited states using. e.g. LR-TDDFT.
39433947
Currently supported: `RPA`, `LDA`, `PBE`, `HSE`, `HF`.
39443948
- **Default**: LDA
39453949

3950+
### lr_init_xc_kernel
3951+
3952+
- **Type**: String
3953+
- **Description**: The method to initalize the xc kernel.
3954+
- "default": Calculate xc kerenel ($f_\text{xc}$) from the ground-state charge density.
3955+
- "file": Read the xc kernel $f_\text{xc}$ on grid from the provided files. The following words should be the paths of ".cube" files, where the first 1 (*[nspin](#nspin)==1*) or 3 (*[nspin](#nspin)==2*, namely spin-aa, spin-ab and spin-bb) will be read in. The parameter [xc_kernel](#xc_kernel) will be invalid. Now only LDA-type kernel is supproted as the potential will be calculated by directly multiplying the transition density.
3956+
- "from_charge_file": Calculate fxc from the charge density read from the provided files. The following words should be the paths of ".cube" files, where the first [nspin]($nspin) files will be read in.
3957+
- **Default**: "default"
3958+
39463959
### lr_solver
39473960

39483961
- **Type**: String
@@ -4021,4 +4034,21 @@ The output files are `OUT.${suffix}/Excitation_Energy.dat` and `OUT.${suffix}/Ex
40214034
- **Description**: Atomic basis set size for each atom type (with the same order as in `STRU`) in FHI-aims.
40224035
- **Default**: {} (empty list, where ABACUS use its own basis set size)
40234036

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+
40244054
[back to top](#full-list-of-input-keywords)

examples/bsse/water/result.ref

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-13.31798074740440
2-
E_H2O: -466.1225988776397
3-
E_O: -427.6271689751553
4-
E_H1: -12.58872469295076
5-
E_H2: -12.58872446212924
1+
-13.49968292248493
2+
E_H2O: -466.1225988772539
3+
E_O: -427.5222287307378
4+
E_H1: -12.55034372743879
5+
E_H2: -12.55034349659238

examples/scf/lcao_Cu/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ orbital_dir ../../../tests/PP_ORB
44
nbands 10
55

66
calculation scf
7-
ecutwfc 100
87
ecutwfc 100 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1]
98
scf_thr 1.0e-8
109
scf_nmax 100

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: 12 additions & 15 deletions
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\
@@ -226,6 +228,7 @@ OBJS_ELECSTAT=elecstate.o\
226228
H_Hartree_pw.o\
227229
H_TDDFT_pw.o\
228230
pot_xc.o\
231+
cal_ux.o\
229232

230233
OBJS_ELECSTAT_LCAO=elecstate_lcao.o\
231234
elecstate_lcao_cal_tau.o\
@@ -245,18 +248,13 @@ OBJS_ESOLVER=esolver.o\
245248
esolver_of.o\
246249
esolver_of_tool.o\
247250
esolver_of_interface.o\
248-
pw_init_after_vc.o\
249-
pw_init_globalc.o\
250251
pw_others.o\
251252

252253
OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
253254
esolver_ks_lcao_tddft.o\
254-
dpks_cal_e_delta_band.o\
255-
set_matrix_grid.o\
256255
lcao_before_scf.o\
257256
esolver_gets.o\
258257
lcao_others.o\
259-
lcao_init_after_vc.o\
260258

261259
OBJS_GINT=gint.o\
262260
gint_gamma_env.o\
@@ -317,7 +315,7 @@ OBJS_HAMILT_LCAO=hamilt_lcao.o\
317315
op_dftu_lcao.o\
318316
deepks_lcao.o\
319317
op_exx_lcao.o\
320-
sc_lambda_lcao.o\
318+
dspin_lcao.o\
321319
dftu_lcao.o\
322320

323321
OBJS_HCONTAINER=base_matrix.o\
@@ -406,9 +404,7 @@ OBJS_PSI_INITIALIZER=psi_initializer.o\
406404
psi_initializer_nao.o\
407405
psi_initializer_nao_random.o\
408406

409-
OBJS_PW=fft.o\
410-
fft_bundle.o\
411-
fft_base.o\
407+
OBJS_PW=fft_bundle.o\
412408
fft_cpu.o\
413409
pw_basis.o\
414410
pw_basis_k.o\
@@ -442,7 +438,6 @@ OBJS_SURCHEM=surchem.o\
442438
cal_totn.o\
443439
cal_vcav.o\
444440
cal_vel.o\
445-
corrected_energy.o\
446441
minimize_cg.o\
447442
sol_force.o\
448443

@@ -671,7 +666,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
671666
symmetry_rhog.o\
672667
wavefunc.o\
673668
wf_atomic.o\
674-
wfinit.o\
669+
psi_init.o\
675670
elecond.o\
676671
sto_tool.o\
677672
sto_elecond.o\
@@ -696,14 +691,11 @@ OBJS_DFTU=dftu.o\
696691
dftu_hamilt.o
697692

698693
OBJS_DELTASPIN=basic_funcs.o\
699-
cal_h_lambda.o\
700694
cal_mw_from_lambda.o\
701-
cal_mw_helper.o\
702695
cal_mw.o\
703696
init_sc.o\
704697
lambda_loop_helper.o\
705698
lambda_loop.o\
706-
sc_parse_json.o\
707699
spin_constrain.o\
708700
template_helpers.o\
709701

@@ -730,8 +722,13 @@ OBJS_TENSOR=tensor.o\
730722
dmr_complex.o\
731723
operator_lr_hxc.o\
732724
operator_lr_exx.o\
733-
kernel_xc.o\
725+
xc_kernel.o\
734726
pot_hxc_lrtd.o\
735727
lr_spectrum.o\
736728
hamilt_casida.o\
737729
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: 1 addition & 4 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()
@@ -183,7 +180,7 @@ void Driver::atomic_world()
183180
//--------------------------------------------------
184181

185182
// where the actual stuff is done
186-
this->driver_run();
183+
this->driver_run(GlobalC::ucell);
187184

188185
ModuleBase::timer::finish(GlobalV::ofs_running);
189186
ModuleBase::Memory::print_all(GlobalV::ofs_running);

source/driver.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef DRIVER_H
22
#define DRIVER_H
33

4+
#include "module_cell/unitcell.h"
5+
46
class Driver
57
{
68
public:
@@ -34,7 +36,7 @@ class Driver
3436
void atomic_world();
3537

3638
// the actual calculations
37-
void driver_run();
39+
void driver_run(UnitCell& ucell);
3840
};
3941

4042
#endif

0 commit comments

Comments
 (0)