Skip to content

Commit d2f4e7f

Browse files
authored
Merge branch 'develop' into fft5
2 parents 7ca986b + c9f7973 commit d2f4e7f

File tree

340 files changed

+6552
-7848
lines changed

Some content is hidden

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

340 files changed

+6552
-7848
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 12 additions & 2 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)
@@ -1389,7 +1390,7 @@ These variables are used to control the geometry relaxation.
13891390

13901391
- **Type**: Integer
13911392
- **Description**: The maximal number of ionic iteration steps, the minimum value is 1.
1392-
- **Default**: 1
1393+
- **Default**: 1 for SCF, 50 for relax and cell-relax calcualtions
13931394

13941395
### relax_cg_thr
13951396

@@ -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: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ OBJS_ELECSTAT=elecstate.o\
228228
pot_xc.o\
229229

230230
OBJS_ELECSTAT_LCAO=elecstate_lcao.o\
231-
elecstate_lcao_tddft.o\
232231
elecstate_lcao_cal_tau.o\
233232
density_matrix.o\
234233
density_matrix_io.o\
@@ -246,18 +245,13 @@ OBJS_ESOLVER=esolver.o\
246245
esolver_of.o\
247246
esolver_of_tool.o\
248247
esolver_of_interface.o\
249-
pw_init_after_vc.o\
250-
pw_init_globalc.o\
251248
pw_others.o\
252249

253250
OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
254251
esolver_ks_lcao_tddft.o\
255-
dpks_cal_e_delta_band.o\
256-
set_matrix_grid.o\
257252
lcao_before_scf.o\
258-
lcao_gets.o\
253+
esolver_gets.o\
259254
lcao_others.o\
260-
lcao_init_after_vc.o\
261255

262256
OBJS_GINT=gint.o\
263257
gint_gamma_env.o\
@@ -318,7 +312,7 @@ OBJS_HAMILT_LCAO=hamilt_lcao.o\
318312
op_dftu_lcao.o\
319313
deepks_lcao.o\
320314
op_exx_lcao.o\
321-
sc_lambda_lcao.o\
315+
dspin_lcao.o\
322316
dftu_lcao.o\
323317

324318
OBJS_HCONTAINER=base_matrix.o\
@@ -670,7 +664,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
670664
symmetry_rhog.o\
671665
wavefunc.o\
672666
wf_atomic.o\
673-
wfinit.o\
667+
psiinit.o\
674668
elecond.o\
675669
sto_tool.o\
676670
sto_elecond.o\
@@ -681,7 +675,9 @@ OBJS_VDW=vdw.o\
681675
vdwd3_parameters.o\
682676
vdwd2.o\
683677
vdwd3.o\
684-
vdwd3_parameters_tab.o
678+
vdwd3_parameters_tab.o\
679+
vdwd3_autoset_xcname.o\
680+
vdwd3_autoset_xcparam.o
685681

686682
OBJS_DFTU=dftu.o\
687683
dftu_force.o\
@@ -693,14 +689,11 @@ OBJS_DFTU=dftu.o\
693689
dftu_hamilt.o
694690

695691
OBJS_DELTASPIN=basic_funcs.o\
696-
cal_h_lambda.o\
697692
cal_mw_from_lambda.o\
698-
cal_mw_helper.o\
699693
cal_mw.o\
700694
init_sc.o\
701695
lambda_loop_helper.o\
702696
lambda_loop.o\
703-
sc_parse_json.o\
704697
spin_constrain.o\
705698
template_helpers.o\
706699

@@ -727,7 +720,7 @@ OBJS_TENSOR=tensor.o\
727720
dmr_complex.o\
728721
operator_lr_hxc.o\
729722
operator_lr_exx.o\
730-
kernel_xc.o\
723+
xc_kernel.o\
731724
pot_hxc_lrtd.o\
732725
lr_spectrum.o\
733726
hamilt_casida.o\

source/driver_run.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,16 @@ void Driver::driver_run() {
6767
Relax_Driver rl_driver;
6868
rl_driver.relax_driver(p_esolver);
6969
}
70+
else if (cal_type == "get_S")
71+
{
72+
p_esolver->runner(0, GlobalC::ucell);
73+
}
7074
else
7175
{
7276
//! supported "other" functions:
7377
//! get_pchg(LCAO),
7478
//! test_memory(PW,LCAO),
7579
//! test_neighbour(LCAO),
76-
//! get_S(LCAO),
7780
//! gen_bessel(PW), et al.
7881
const int istep = 0;
7982
p_esolver->others(istep);

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)

source/module_base/vector3.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ template <class T> class Vector3
3636
Vector3(const Vector3<T> &v) : x(v.x), y(v.y), z(v.z){}; // Peize Lin add 2018-07-16
3737
explicit Vector3(const std::array<T,3> &v) :x(v[0]), y(v[1]), z(v[2]){}
3838

39+
template <typename U>
40+
explicit Vector3(const Vector3<U>& other) : x(static_cast<T>(other.x)), y(static_cast<T>(other.y)), z(static_cast<T>(other.z)) {}
41+
3942
Vector3(Vector3<T> &&v) noexcept : x(v.x), y(v.y), z(v.z) {}
4043

4144
/**

source/module_basis/module_nao/two_center_bundle.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void TwoCenterBundle::tabulate()
6363
{
6464
ModuleBase::SphericalBesselTransformer sbt(true);
6565
orb_->set_transformer(sbt);
66-
beta_->set_transformer(sbt);
66+
if (beta_) { beta_->set_transformer(sbt); }
6767
if (alpha_) {
6868
alpha_->set_transformer(sbt);
6969
}
@@ -75,22 +75,17 @@ void TwoCenterBundle::tabulate()
7575
// build two-center integration tables
7676
//================================================================
7777
// set up a universal radial grid
78-
double rmax = std::max(orb_->rcut_max(), beta_->rcut_max());
79-
if (alpha_) {
80-
rmax = std::max(rmax, alpha_->rcut_max());
81-
}
78+
double rmax = orb_->rcut_max();
79+
if (beta_) { rmax = std::max(rmax, beta_->rcut_max()); }
80+
if (alpha_) { rmax = std::max(rmax, alpha_->rcut_max()); }
8281
double dr = 0.01;
8382
double cutoff = 2.0 * rmax;
8483
int nr = static_cast<int>(rmax / dr) + 1;
8584

8685
orb_->set_uniform_grid(true, nr, cutoff, 'i', true);
87-
beta_->set_uniform_grid(true, nr, cutoff, 'i', true);
88-
if (alpha_) {
89-
alpha_->set_uniform_grid(true, nr, cutoff, 'i', true);
90-
}
91-
if (orb_onsite_) {
92-
orb_onsite_->set_uniform_grid(true, nr, cutoff, 'i', true);
93-
}
86+
if (beta_) { beta_->set_uniform_grid(true, nr, cutoff, 'i', true); }
87+
if (alpha_) { alpha_->set_uniform_grid(true, nr, cutoff, 'i', true);}
88+
if (orb_onsite_) { orb_onsite_->set_uniform_grid(true, nr, cutoff, 'i', true);}
9489

9590
// build TwoCenterIntegrator objects
9691
kinetic_orb = std::unique_ptr<TwoCenterIntegrator>(new TwoCenterIntegrator);
@@ -101,9 +96,12 @@ void TwoCenterBundle::tabulate()
10196
overlap_orb->tabulate(*orb_, *orb_, 'S', nr, cutoff);
10297
ModuleBase::Memory::record("TwoCenterTable: Overlap", overlap_orb->table_memory());
10398

104-
overlap_orb_beta = std::unique_ptr<TwoCenterIntegrator>(new TwoCenterIntegrator);
105-
overlap_orb_beta->tabulate(*orb_, *beta_, 'S', nr, cutoff);
106-
ModuleBase::Memory::record("TwoCenterTable: Nonlocal", overlap_orb_beta->table_memory());
99+
if (beta_)
100+
{
101+
overlap_orb_beta = std::unique_ptr<TwoCenterIntegrator>(new TwoCenterIntegrator);
102+
overlap_orb_beta->tabulate(*orb_, *beta_, 'S', nr, cutoff);
103+
ModuleBase::Memory::record("TwoCenterTable: Nonlocal", overlap_orb_beta->table_memory());
104+
}
107105

108106
if (alpha_)
109107
{

0 commit comments

Comments
 (0)