Skip to content

Commit 5f97360

Browse files
authored
Fix periodic boundary condition search by making search_pbc always true (#6163)
1 parent 549a85a commit 5f97360

File tree

13 files changed

+27
-35
lines changed

13 files changed

+27
-35
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
- [lcao\_dr](#lcao_dr)
5353
- [lcao\_rmax](#lcao_rmax)
5454
- [search\_radius](#search_radius)
55-
- [search\_pbc](#search_pbc)
5655
- [bx, by, bz](#bx-by-bz)
5756
- [elpa\_num\_thread](#elpa_num_thread)
5857
- [num\_stream](#num_stream)
@@ -924,12 +923,6 @@ These variables are used to control the numerical atomic orbitals related parame
924923
- **Default**: -1
925924
- **Unit**: Bohr
926925

927-
### search_pbc
928-
929-
- **Type**: Boolean
930-
- **Description**: If True, periodic images will be included in searching for the neighbouring atoms. If False, periodic images will be ignored.
931-
- **Default**: True
932-
933926
### bx, by, bz
934927

935928
- **Type**: Integer
@@ -3586,19 +3579,23 @@ These variables are used to control berry phase and wannier90 interface paramete
35863579
- **Type**: Real
35873580
- **Description**:
35883581
`td_lcut1` is the lower bound of the interval in the length gauge RT-TDDFT, where $x$ is the fractional coordinate:
3582+
35893583
$$
35903584
E(x)=\begin{cases}E_0, & \mathtt{cut1}\leqslant x \leqslant \mathtt{cut2} \\-E_0\left(\dfrac{1}{\mathtt{cut1}+1-\mathtt{cut2}}-1\right), & 0 < x < \mathtt{cut1~~or~~cut2} < x < 1 \end{cases}
35913585
$$
3586+
35923587
- **Default**: 0.05
35933588

35943589
### td_lcut2
35953590

35963591
- **Type**: Real
35973592
- **Description**:
35983593
`td_lcut2` is the upper bound of the interval in the length gauge RT-TDDFT, where $x$ is the fractional coordinate:
3594+
35993595
$$
36003596
E(x)=\begin{cases}E_0, & \mathtt{cut1}\leqslant x \leqslant \mathtt{cut2} \\-E_0\left(\dfrac{1}{\mathtt{cut1}+1-\mathtt{cut2}}-1\right), & 0 < x < \mathtt{cut1~~or~~cut2} < x < 1 \end{cases}
36013597
$$
3598+
36023599
- **Default**: 0.95
36033600

36043601
### td_gauss_freq

source/module_esolver/esolver_gets.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
9090

9191
Grid_Driver gd;
9292

93-
atom_arrange::search(PARAM.inp.search_pbc,
93+
atom_arrange::search(PARAM.globalv.search_pbc,
9494
GlobalV::ofs_running,
9595
gd,
9696
ucell,
@@ -133,7 +133,7 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
133133
if (PARAM.inp.out_mat_r)
134134
{
135135
cal_r_overlap_R r_matrix;
136-
r_matrix.init(ucell,pv, orb_);
136+
r_matrix.init(ucell, pv, orb_);
137137
r_matrix.out_rR(ucell, gd, istep);
138138
}
139139

@@ -142,20 +142,23 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
142142
LCAO_HS_Arrays HS_Arrays; // store sparse arrays
143143
//! Print out sparse matrix
144144
ModuleIO::output_dSR(istep,
145-
ucell,
146-
this->pv,
147-
HS_Arrays,
148-
gd, // mohan add 2024-04-06
149-
two_center_bundle_,
150-
orb_,
151-
kv);
145+
ucell,
146+
this->pv,
147+
HS_Arrays,
148+
gd, // mohan add 2024-04-06
149+
two_center_bundle_,
150+
orb_,
151+
kv);
152152
}
153153

154154
ModuleBase::timer::tick("ESolver_GetS", "runner");
155155
}
156156

157157
void ESolver_GetS::after_all_runners(UnitCell& ucell) {};
158-
double ESolver_GetS::cal_energy() { return 0.0; };
158+
double ESolver_GetS::cal_energy()
159+
{
160+
return 0.0;
161+
};
159162
void ESolver_GetS::cal_force(UnitCell& ucell, ModuleBase::matrix& force) {};
160163
void ESolver_GetS::cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) {};
161164

source/module_esolver/esolver_lj.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void ESolver_LJ::before_all_runners(UnitCell& ucell, const Input_para& inp)
3333
void ESolver_LJ::runner(UnitCell& ucell, const int istep)
3434
{
3535
Grid_Driver grid_neigh(PARAM.inp.test_deconstructor, PARAM.inp.test_grid);
36-
atom_arrange::search(PARAM.inp.search_pbc,
36+
atom_arrange::search(PARAM.globalv.search_pbc,
3737
GlobalV::ofs_running,
3838
grid_neigh,
3939
ucell,

source/module_esolver/lcao_after_scf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep, const
476476
/*test_deconstructor=*/PARAM.inp.test_deconstructor,
477477
/*test_grid=*/PARAM.inp.test_grid,
478478
/*test_atom_input=*/PARAM.inp.test_atom_input,
479-
/*search_pbc=*/PARAM.inp.search_pbc,
479+
/*search_pbc=*/PARAM.globalv.search_pbc,
480480
/*ofs=*/&GlobalV::ofs_running,
481481
/*rank=*/GlobalV::MY_RANK
482482
);

source/module_esolver/lcao_before_scf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
5353
PARAM.globalv.gamma_only_local);
5454

5555
//! 3) use search_radius to search adj atoms
56-
atom_arrange::search(PARAM.inp.search_pbc,
56+
atom_arrange::search(PARAM.globalv.search_pbc,
5757
GlobalV::ofs_running,
5858
this->gd,
5959
ucell,

source/module_esolver/lcao_others.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
6767
// test_search_neighbor();
6868
std::cout << FmtCore::format("\n * * * * * *\n << Start %s.\n", "testing neighbour");
6969
double search_radius = PARAM.inp.search_radius;
70-
atom_arrange::search(PARAM.inp.search_pbc,
70+
atom_arrange::search(PARAM.globalv.search_pbc,
7171
GlobalV::ofs_running,
7272
this->gd,
7373
ucell,
@@ -86,7 +86,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
8686
ucell.infoNL.get_rcutmax_Beta(),
8787
PARAM.globalv.gamma_only_local);
8888

89-
atom_arrange::search(PARAM.inp.search_pbc,
89+
atom_arrange::search(PARAM.globalv.search_pbc,
9090
GlobalV::ofs_running,
9191
this->gd,
9292
ucell,

source/module_hamilt_lcao/module_deepks/test/LCAO_deepks_test_prep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void test_deepks<T>::prep_neighbour()
171171
ucell.infoNL.get_rcutmax_Beta(),
172172
PARAM.sys.gamma_only_local);
173173

174-
atom_arrange::search(PARAM.inp.search_pbc,
174+
atom_arrange::search(PARAM.globalv.search_pbc,
175175
GlobalV::ofs_running,
176176
Test_Deepks::GridD,
177177
ucell,

source/module_io/read_input_item_elec_stru.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,12 +712,6 @@ void ReadInput::item_elec_stru()
712712
read_sync_double(input.search_radius);
713713
this->add_item(item);
714714
}
715-
{
716-
Input_Item item("search_pbc");
717-
item.annotation = "input periodic boundary condition";
718-
read_sync_bool(input.search_pbc);
719-
this->add_item(item);
720-
}
721715
{
722716
Input_Item item("bx");
723717
item.annotation = "division of an element grid in FFT grid along x";

source/module_io/test/read_input_ptest.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ TEST_F(InputParaTest, ParaRead)
101101
EXPECT_EQ(param.inp.basis_type, "lcao");
102102
EXPECT_EQ(param.inp.ks_solver, "genelpa");
103103
EXPECT_DOUBLE_EQ(param.inp.search_radius, -1.0);
104-
EXPECT_TRUE(param.inp.search_pbc);
105104
EXPECT_EQ(param.inp.symmetry, "1");
106105
EXPECT_FALSE(param.inp.init_vel);
107106
EXPECT_DOUBLE_EQ(param.inp.symmetry_prec, 1.0e-6);

source/module_io/test/support/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ basis_type lcao #PW; LCAO in pw; LCAO
134134
nb2d 0 #2d distribution of atoms
135135
gamma_only T #Only for localized orbitals set and gamma point. If set to 1, a fast algorithm is used
136136
search_radius -1 #input search radius (Bohr)
137-
search_pbc 1 #input periodic boundary condition
138137
lcao_ecut 20 #energy cutoff for LCAO
139138
lcao_dk 0.01 #delta k for 1D integration in LCAO
140139
lcao_dr 0.01 #delta r for 1D integration in LCAO

0 commit comments

Comments
 (0)