Skip to content

Commit fe183bd

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into hotfix
2 parents d549231 + 7e9d081 commit fe183bd

File tree

343 files changed

+5002
-6143
lines changed

Some content is hidden

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

343 files changed

+5002
-6143
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 14 additions & 4 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)
@@ -988,7 +989,7 @@ calculations.
988989

989990
- **Type**: String
990991
- **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**.
992+
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**.
992993

993994
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.
994995

@@ -1759,14 +1760,14 @@ The band (KS orbital) energy for each (k-point, spin, band) will be printed in t
17591760

17601761
- **Type**: Boolean
17611762
- **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.
1763+
- **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.
17631764
- **Default**: False
17641765

17651766
### dm_to_rho
17661767

17671768
- **Type**: Boolean
17681769
- **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.
1770+
- **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.
17701771
- **Default**: False
17711772

17721773
### out_app_flag
@@ -2925,7 +2926,7 @@ These variables are used to control DFT+U correlated parameters
29252926

29262927
- where $\gamma$ is a parameter that adjusts the relative weight of the error function to the derivative error function.
29272928
- **Unit**: Bohr
2928-
- **Default**: 5.0
2929+
- **Default**: 3.0
29292930

29302931
[back to top](#full-list-of-input-keywords)
29312932

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

3947+
### lr_init_xc_kernel
3948+
3949+
- **Type**: String
3950+
- **Description**: The method to initalize the xc kernel.
3951+
- "default": Calculate xc kerenel ($f_\text{xc}$) from the ground-state charge density.
3952+
- "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.
3953+
- "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.
3954+
- **Default**: "default"
3955+
39463956
### lr_solver
39473957

39483958
- **Type**: String

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/Makefile.Objects

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,18 +245,13 @@ OBJS_ESOLVER=esolver.o\
245245
esolver_of.o\
246246
esolver_of_tool.o\
247247
esolver_of_interface.o\
248-
pw_init_after_vc.o\
249-
pw_init_globalc.o\
250248
pw_others.o\
251249

252250
OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
253251
esolver_ks_lcao_tddft.o\
254-
dpks_cal_e_delta_band.o\
255-
set_matrix_grid.o\
256252
lcao_before_scf.o\
257253
esolver_gets.o\
258254
lcao_others.o\
259-
lcao_init_after_vc.o\
260255

261256
OBJS_GINT=gint.o\
262257
gint_gamma_env.o\
@@ -317,7 +312,7 @@ OBJS_HAMILT_LCAO=hamilt_lcao.o\
317312
op_dftu_lcao.o\
318313
deepks_lcao.o\
319314
op_exx_lcao.o\
320-
sc_lambda_lcao.o\
315+
dspin_lcao.o\
321316
dftu_lcao.o\
322317

323318
OBJS_HCONTAINER=base_matrix.o\
@@ -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+
psiinit.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,7 +722,7 @@ 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\

source/driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void Driver::atomic_world()
183183
//--------------------------------------------------
184184

185185
// where the actual stuff is done
186-
this->driver_run();
186+
this->driver_run(GlobalC::ucell);
187187

188188
ModuleBase::timer::finish(GlobalV::ofs_running);
189189
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

source/driver_run.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
* the configuration-changing subroutine takes force and stress and updates the
2525
* configuration
2626
*/
27-
void Driver::driver_run() {
27+
void Driver::driver_run(UnitCell& ucell)
28+
{
2829
ModuleBase::TITLE("Driver", "driver_line");
2930
ModuleBase::timer::tick("Driver", "driver_line");
3031

@@ -39,37 +40,35 @@ void Driver::driver_run() {
3940
#endif
4041

4142
// the life of ucell should begin here, mohan 2024-05-12
42-
// delete ucell as a GlobalC in near future
43-
GlobalC::ucell.setup_cell(PARAM.globalv.global_in_stru, GlobalV::ofs_running);
44-
Check_Atomic_Stru::check_atomic_stru(GlobalC::ucell,
45-
PARAM.inp.min_dist_coef);
43+
ucell.setup_cell(PARAM.globalv.global_in_stru, GlobalV::ofs_running);
44+
Check_Atomic_Stru::check_atomic_stru(ucell, PARAM.inp.min_dist_coef);
4645

4746
//! 2: initialize the ESolver (depends on a set-up ucell after `setup_cell`)
48-
ModuleESolver::ESolver* p_esolver = ModuleESolver::init_esolver(PARAM.inp, GlobalC::ucell);
47+
ModuleESolver::ESolver* p_esolver = ModuleESolver::init_esolver(PARAM.inp, ucell);
4948

5049
//! 3: initialize Esolver and fill json-structure
51-
p_esolver->before_all_runners(PARAM.inp, GlobalC::ucell);
50+
p_esolver->before_all_runners(ucell, PARAM.inp);
5251

5352
// this Json part should be moved to before_all_runners, mohan 2024-05-12
5453
#ifdef __RAPIDJSON
55-
Json::gen_stru_wrapper(&GlobalC::ucell);
54+
Json::gen_stru_wrapper(&ucell);
5655
#endif
5756

5857
const std::string cal_type = PARAM.inp.calculation;
5958

6059
//! 4: different types of calculations
6160
if (cal_type == "md")
6261
{
63-
Run_MD::md_line(GlobalC::ucell, p_esolver, PARAM);
62+
Run_MD::md_line(ucell, p_esolver, PARAM);
6463
}
6564
else if (cal_type == "scf" || cal_type == "relax" || cal_type == "cell-relax" || cal_type == "nscf")
6665
{
6766
Relax_Driver rl_driver;
68-
rl_driver.relax_driver(p_esolver);
67+
rl_driver.relax_driver(p_esolver, ucell);
6968
}
7069
else if (cal_type == "get_S")
7170
{
72-
p_esolver->runner(0, GlobalC::ucell);
71+
p_esolver->runner(ucell, 0);
7372
}
7473
else
7574
{
@@ -79,11 +78,11 @@ void Driver::driver_run() {
7978
//! test_neighbour(LCAO),
8079
//! gen_bessel(PW), et al.
8180
const int istep = 0;
82-
p_esolver->others(istep);
81+
p_esolver->others(ucell, istep);
8382
}
8483

8584
//! 5: clean up esolver
86-
p_esolver->after_all_runners();
85+
p_esolver->after_all_runners(ucell);
8786

8887
ModuleESolver::clean_esolver(p_esolver);
8988

source/module_base/module_mixing/mixing_data.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Base_Mixing
44
{
55

6-
Mixing_Data::Mixing_Data(const int& ndim, const int& length, const size_t& type_size)
6+
Mixing_Data::Mixing_Data(const int& ndim, const std::size_t& length, const size_t& type_size)
77
{
88
this->ndim_tot = ndim;
99
this->length = length;
@@ -15,16 +15,18 @@ Mixing_Data::Mixing_Data(const int& ndim, const int& length, const size_t& type_
1515

1616
Mixing_Data::~Mixing_Data()
1717
{
18-
if (this->data != nullptr)
18+
if (this->data != nullptr) {
1919
free(this->data);
2020
}
21+
}
2122

22-
void Mixing_Data::resize(const int& ndim, const int& length, const size_t& type_size)
23+
void Mixing_Data::resize(const int& ndim, const std::size_t& length, const size_t& type_size)
2324
{
2425
this->ndim_tot = ndim;
2526
this->length = length;
26-
if (this->data != nullptr)
27+
if (this->data != nullptr) {
2728
free(this->data);
29+
}
2830
if (ndim * length > 0)
2931
{
3032
this->data = malloc(ndim * length * type_size);

source/module_base/module_mixing/mixing_data.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Mixing_Data
2222
* @param type_size size of type
2323
*
2424
*/
25-
Mixing_Data(const int& ndim, const int& length, const size_t& type_size);
25+
Mixing_Data(const int& ndim, const std::size_t& length, const size_t& type_size);
2626

2727
/**
2828
* @brief Destroy the Mixing_Data object
@@ -38,7 +38,7 @@ class Mixing_Data
3838
* @param type_size size of type
3939
*
4040
*/
41-
void resize(const int& ndim, const int& length, const size_t& type_size);
41+
void resize(const int& ndim, const std::size_t& length, const size_t& type_size);
4242

4343
/**
4444
* @brief push data to the tensor
@@ -54,7 +54,7 @@ class Mixing_Data
5454
#ifdef _OPENMP
5555
#pragma omp parallel for schedule(static, 4096/sizeof(FPTYPE))
5656
#endif
57-
for (int i = 0; i < length; ++i)
57+
for (std::size_t i = 0; i < length; ++i)
5858
{
5959
FP_startdata[i] = data_in[i];
6060
}
@@ -86,7 +86,7 @@ class Mixing_Data
8686
// the number of vectors for mixing
8787
int ndim_tot = 0;
8888
// the length of each vector
89-
int length = 0;
89+
std::size_t length = 0;
9090
// the start index for vector: start = this->index_move(0)
9191
int start = -1;
9292
// the number of used vectors for mixing

source/module_base/module_mixing/pulay_mixing.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ void Pulay_Mixing::tem_push_data(Mixing_Data& mdata,
2828
std::function<void(FPTYPE*, const FPTYPE*, const FPTYPE*)> mix,
2929
const bool& need_calcoef)
3030
{
31-
const size_t length = mdata.length;
31+
const std::size_t length = mdata.length;
3232
std::vector<FPTYPE> F_tmp(length);
3333

3434
#ifdef _OPENMP
3535
#pragma omp parallel for schedule(static, 4096 / sizeof(FPTYPE))
3636
#endif
37-
for (int i = 0; i < length; ++i)
37+
for (std::size_t i = 0; i < length; ++i)
3838
{
3939
F_tmp[i] = data_out[i] - data_in[i];
4040
}
@@ -69,7 +69,7 @@ void Pulay_Mixing::tem_push_data(Mixing_Data& mdata,
6969
#ifdef _OPENMP
7070
#pragma omp parallel for schedule(static, 4096 / sizeof(FPTYPE))
7171
#endif
72-
for (int i = 0; i < length; ++i)
72+
for (std::size_t i = 0; i < length; ++i)
7373
{
7474
FP_F[i] = F_tmp[i];
7575
}
@@ -81,7 +81,7 @@ void Pulay_Mixing::tem_push_data(Mixing_Data& mdata,
8181
#ifdef _OPENMP
8282
#pragma omp parallel for schedule(static, 4096 / sizeof(FPTYPE))
8383
#endif
84-
for (int i = 0; i < length; ++i)
84+
for (std::size_t i = 0; i < length; ++i)
8585
{
8686
FP_startF[i] = F_tmp[i];
8787
}
@@ -103,7 +103,7 @@ void Pulay_Mixing::tem_cal_coef(const Mixing_Data& mdata, std::function<double(F
103103
ModuleBase::WARNING_QUIT(
104104
"Pulay_mixing",
105105
"One Pulay_Mixing object can only bind one Mixing_Data object to calculate coefficients");
106-
const int length = mdata.length;
106+
const std::size_t length = mdata.length;
107107
FPTYPE* FP_F = static_cast<FPTYPE*>(F);
108108

109109
if (mdata.ndim_use > 1)

0 commit comments

Comments
 (0)