Skip to content

Commit 5f81849

Browse files
Merge branch 'develop' into fix/agent-test
2 parents f22653d + a02d7c7 commit 5f81849

20 files changed

Lines changed: 587 additions & 384 deletions

docs/advanced/input_files/input-main.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@
502502
- [cond\_smear](#cond_smear)
503503
- [cond\_fwhm](#cond_fwhm)
504504
- [cond\_nonlocal](#cond_nonlocal)
505+
- [cond\_mgga\_vel](#cond_mgga_vel)
505506
- [Implicit solvation model](#implicit-solvation-model)
506507
- [imp\_sol](#imp_sol)
507508
- [eb\_k](#eb_k)
@@ -4471,6 +4472,13 @@
44714472
- False: .
44724473
- **Default**: True
44734474

4475+
### cond_mgga_vel
4476+
4477+
- **Type**: Boolean
4478+
- **Availability**: [basis_type](#basis_type) = `pw`
4479+
- **Description**: Whether to include the meta-GGA velocity correction from the $v_\tau$ term when calculating velocity matrix $\bra{\psi_i}\hat{v}\ket{\psi_j}$.
4480+
- **Default**: True
4481+
44744482
[back to top](#full-list-of-input-keywords)
44754483

44764484
## Implicit solvation model

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ OBJS_LCAO=evolve_elec.o\
635635
td_folding.o\
636636
td_info.o\
637637
velocity_op.o\
638+
snap_projector_half_tddft.o\
638639
snap_psibeta_half_tddft.o\
639640
solve_propagation.o\
640641
boundary_fix.o\

source/source_io/module_ctrl/ctrl_output_pw.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ void ModuleIO::ctrl_runner_pw(UnitCell& ucell,
334334
inp.cond_dw,
335335
inp.cond_dt,
336336
inp.cond_nonlocal,
337+
inp.cond_mgga_vel,
337338
pelec->wg);
338339
}
339340

source/source_io/module_hs/cal_r_overlap_R.cpp

Lines changed: 166 additions & 190 deletions
Large diffs are not rendered by default.

source/source_io/module_hs/cal_r_overlap_R.h

Lines changed: 40 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef CAL_R_OVERLAP_R_H
22
#define CAL_R_OVERLAP_R_H
33

4-
#include "source_lcao/module_ri/abfs-vector3_order.h"
54
#include "source_base/sph_bessel_recursive.h"
65
#include "source_base/vector3.h"
76
#include "source_base/ylm.h"
@@ -14,6 +13,7 @@
1413
#include "source_lcao/center2_orb-orb11.h"
1514
#include "source_lcao/center2_orb-orb21.h"
1615
#include "source_lcao/center2_orb.h"
16+
#include "source_lcao/module_ri/abfs-vector3_order.h"
1717

1818
#include <map>
1919
#include <set>
@@ -31,45 +31,39 @@ class cal_r_overlap_R
3131
double sparse_threshold = 1e-10;
3232
bool binary = false;
3333

34-
void init(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb);
35-
void init_nonlocal(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb);
36-
ModuleBase::Vector3<double> get_psi_r_psi(
37-
const ModuleBase::Vector3<double>& R1,
38-
const int& T1,
39-
const int& L1,
40-
const int& m1,
41-
const int& N1,
42-
const ModuleBase::Vector3<double>& R2,
43-
const int& T2,
44-
const int& L2,
45-
const int& m2,
46-
const int& N2
47-
);
48-
ModuleBase::Vector3<double> get_psi_r_gradpsi(
49-
const ModuleBase::Vector3<double>& R1,
50-
const int& T1,
51-
const int& L1,
52-
const int& m1,
53-
const int& N1,
54-
const ModuleBase::Vector3<double>& R2,
55-
const int& T2,
56-
const int& L2,
57-
const int& m2,
58-
const int& N2,
59-
const ModuleBase::Vector3<double>& Efield,
60-
const ModuleBase::Vector3<double>& dR
61-
);
62-
void get_psi_r_beta(
63-
const UnitCell& ucell,
64-
std::vector<std::vector<double>>& nlm,
65-
const ModuleBase::Vector3<double>& R1,
66-
const int& T1,
67-
const int& L1,
68-
const int& m1,
69-
const int& N1,
70-
const ModuleBase::Vector3<double>& R2,
71-
const int& T2
72-
);
34+
void init(const UnitCell& ucell, const Parallel_Orbitals& pv, const LCAO_Orbitals& orb);
35+
void init_nonlocal(const UnitCell& ucell, const Parallel_Orbitals& pv, const LCAO_Orbitals& orb);
36+
ModuleBase::Vector3<double> get_psi_r_psi(const ModuleBase::Vector3<double>& R1,
37+
const int& T1,
38+
const int& L1,
39+
const int& m1,
40+
const int& N1,
41+
const ModuleBase::Vector3<double>& R2,
42+
const int& T2,
43+
const int& L2,
44+
const int& m2,
45+
const int& N2);
46+
ModuleBase::Vector3<double> get_psi_r_gradpsi(const ModuleBase::Vector3<double>& R1,
47+
const int& T1,
48+
const int& L1,
49+
const int& m1,
50+
const int& N1,
51+
const ModuleBase::Vector3<double>& R2,
52+
const int& T2,
53+
const int& L2,
54+
const int& m2,
55+
const int& N2,
56+
const ModuleBase::Vector3<double>& Efield,
57+
const ModuleBase::Vector3<double>& dR);
58+
void get_psi_r_beta(const UnitCell& ucell,
59+
std::vector<std::vector<double>>& nlm,
60+
const ModuleBase::Vector3<double>& R1,
61+
const int& T1,
62+
const int& L1,
63+
const int& m1,
64+
const int& N1,
65+
const ModuleBase::Vector3<double>& R2,
66+
const int& T2);
7367
void out_rR(const UnitCell& ucell, const Grid_Driver& gd, const int& istep, const int precision = 16);
7468
void out_rR_other(const UnitCell& ucell,
7569
const int& istep,
@@ -78,8 +72,8 @@ class cal_r_overlap_R
7872

7973
private:
8074
void initialize_orb_table(const UnitCell& ucell, const LCAO_Orbitals& orb);
81-
void construct_orbs_and_orb_r(const UnitCell& ucell,const LCAO_Orbitals& orb);
82-
void construct_orbs_and_nonlocal_and_orb_r(const UnitCell& ucell,const LCAO_Orbitals& orb);
75+
void construct_orbs_and_orb_r(const UnitCell& ucell, const LCAO_Orbitals& orb);
76+
void construct_orbs_and_nonlocal_and_orb_r(const UnitCell& ucell, const LCAO_Orbitals& orb);
8377

8478
std::vector<int> iw2ia;
8579
std::vector<int> iw2iL;
@@ -94,25 +88,15 @@ class cal_r_overlap_R
9488
std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> orbs;
9589
std::vector<std::vector<Numerical_Orbital_Lm>> orbs_nonlocal;
9690

97-
std::map<
98-
size_t,
99-
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb11>>>>>>
91+
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb11>>>>>>
10092
center2_orb11;
10193

102-
std::map<
103-
size_t,
104-
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb21>>>>>>
94+
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb21>>>>>>
10595
center2_orb21_r;
10696

107-
std::map<
108-
size_t,
109-
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb11>>>>>
110-
center2_orb11_nonlocal;
97+
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb11>>>>> center2_orb11_nonlocal;
11198

112-
std::map<
113-
size_t,
114-
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb21>>>>>
115-
center2_orb21_r_nonlocal;
99+
std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb21>>>>> center2_orb21_r_nonlocal;
116100

117101
const Parallel_Orbitals* ParaV = nullptr;
118102
};

source/source_io/module_parameter/input_parameter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ struct Input_para
467467
int cond_smear = 1; ///< smearing method for conductivities 1: Gaussian 2: Lorentzian
468468
double cond_fwhm = 0.4; ///< FWHM for conductivities
469469
bool cond_nonlocal = true; ///< if calculate nonlocal effects
470+
bool cond_mgga_vel = true; ///< if calculate meta-GGA velocity correction
470471

471472
bool berry_phase = false; ///< berry phase calculation: calculate berry phase or not
472473
int gdir = 3; ///< berry phase calculation: calculate the polarization in

source/source_io/module_parameter/read_input_item_postprocess.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ void ReadInput::item_postprocess()
275275
read_sync_bool(input.cond_nonlocal);
276276
this->add_item(item);
277277
}
278+
{
279+
Input_Item item("cond_mgga_vel");
280+
item.annotation = "Meta-GGA velocity correction for conductivities";
281+
read_sync_bool(input.cond_mgga_vel);
282+
this->add_item(item);
283+
}
278284

279285
// berry_wannier
280286
{

source/source_io/test/read_input_ptest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ TEST_F(InputParaTest, ParaRead)
7373
EXPECT_EQ(param.inp.cond_dtbatch, 2);
7474
EXPECT_DOUBLE_EQ(param.inp.cond_fwhm, 0.3);
7575
EXPECT_TRUE(param.inp.cond_nonlocal);
76+
EXPECT_TRUE(param.inp.cond_mgga_vel);
7677
EXPECT_FALSE(param.inp.berry_phase);
7778
EXPECT_EQ(param.inp.ocp_kb.size(), 2);
7879
EXPECT_EQ(param.inp.ocp_kb[0], 1);

source/source_io/test/support/INPUT

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ cond_dt 0.07 #control the t interval
9191
cond_dtbatch 2 #control dt batch
9292
cond_fwhm 0.3 #FWHM for conductivities
9393
cond_nonlocal 1 #Nonlocal effects for conductivities
94+
cond_mgga_vel 1 #Meta-GGA velocity correction for conductivities
9495

9596
#Parameters (4.Relaxation)
9697
ks_solver genelpa #cg; dav; lapack; genelpa; scalapack_gvx; cusolver
@@ -391,3 +392,7 @@ nsc 50 #Maximal number of spin-constrained iteration
391392
nsc_min 4 #Minimum number of spin-constrained iteration
392393
alpha_trial 0.02 #Initial trial step size for lambda in eV/uB^2
393394
sccut 4 #Maximal step size for lambda in eV/uB
395+
396+
#Parameters (23. Time-dependent orbital-free DFT)
397+
of_cd 0 #0: no CD potential; 1: add CD potential
398+
of_mCD_alpha 1.0 # parameter of modified CD potential

source/source_lcao/module_rt/snap_projector_half_tddft.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ AngularGridView angular_grid(const int ngrid)
104104
{
105105
if (!is_supported_lebedev_grid(ngrid))
106106
{
107-
ModuleBase::WARNING_QUIT("snap_projector_half_tddft",
108-
"Unsupported Lebedev-Laikov grid size: " + std::to_string(ngrid));
107+
ModuleBase::WARNING_QUIT("snap_projector_half_tddft", "Unsupported Lebedev-Laikov grid size: " + std::to_string(ngrid));
109108
}
110109

111110
if (ngrid == default_lebedev_grid_points)
@@ -142,9 +141,7 @@ AngularGridView angular_grid(const int ngrid)
142141

143142
double radial_factor(const ProjectorChannel& channel, const double r, const double w_radial)
144143
{
145-
const double projector_val
146-
= ModuleBase::PolyInt::Polynomial_Interpolation(channel.radial_values, channel.mesh, channel.dk, r);
147-
144+
const double projector_val = ModuleBase::PolyInt::Polynomial_Interpolation(channel.radial_times_r, channel.mesh, channel.dk, r);
148145
return projector_val * r * w_radial;
149146
}
150147
} // namespace
@@ -264,7 +261,7 @@ void snap_projector_half_tddft(const LCAO_Orbitals& orb,
264261
}
265262

266263
assert(channel.mesh > 0);
267-
assert(channel.radial_values != nullptr);
264+
assert(channel.radial_times_r != nullptr);
268265
assert(channel.radial_grid != nullptr);
269266

270267
const double r_min = channel.radial_grid[0];

0 commit comments

Comments
 (0)