Skip to content

Commit 7097ecc

Browse files
committed
remove set fatom
1 parent 2342de1 commit 7097ecc

File tree

4 files changed

+21
-70
lines changed

4 files changed

+21
-70
lines changed

source/module_cell/module_neighbor/sltk_atom_arrange.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ void atom_arrange::search(
7575
{
7676
ModuleBase::TITLE("atom_arrange", "search");
7777
ModuleBase::timer::tick("atom_arrange","search");
78-
78+
/* std::cout << "pbc_flag = " << pbc_flag << std::endl;
79+
std::cout << "search_radius_bohr = " << search_radius_bohr << std::endl;
80+
std::cout << "test_atom_in = " << test_atom_in << std::endl;
81+
std::cout << "test_only = " << test_only << std::endl;
82+
*/
7983
assert( search_radius_bohr > 0.0 );
8084

8185
// OUT(ofs_in,"Atom coordinates reading from",PARAM.inp.stru_file);
@@ -93,6 +97,7 @@ void atom_arrange::search(
9397
//=============================
9498

9599
const double radius_lat0unit = search_radius_bohr / ucell.lat0;
100+
ModuleBase::timer::tick("atom_arrange", "Atom_input");
96101

97102
Atom_input at(
98103
ofs_in,
@@ -102,6 +107,7 @@ void atom_arrange::search(
102107
pbc_flag,
103108
radius_lat0unit,
104109
test_atom_in);
110+
ModuleBase::timer::tick("atom_arrange", "Atom_input");
105111

106112
//===========================================
107113
// Print important information in Atom_input
@@ -111,7 +117,13 @@ void atom_arrange::search(
111117
//=========================================
112118
// Construct Grid , Cells , Adjacent atoms
113119
//=========================================
120+
121+
ModuleBase::timer::tick("atom_arrange", "grid_d.init");
122+
114123
grid_d.init(ofs_in, ucell, at);
124+
ModuleBase::timer::tick("atom_arrange", "grid_d.init");
125+
126+
ModuleBase::timer::tick("atom_arrange", "search");
115127

116128
// test the adjacent atoms and the box.
117129
if(test_only)
@@ -142,7 +154,6 @@ void atom_arrange::search(
142154
ofs_in << "search neighboring atoms done." << std::endl;
143155
}
144156

145-
ModuleBase::timer::tick("atom_arrange", "search");
146157
return;
147158
}
148159

source/module_cell/module_neighbor/sltk_atom_input.cpp

Lines changed: 8 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66
//==========================================================
77
// define constructor and deconstructor
88
//==========================================================
9-
Atom_input::Atom_input
10-
(
11-
std::ofstream &ofs_in,
12-
const UnitCell &ucell,
13-
const int amount,
14-
const int ntype,
15-
const bool boundary_in,
16-
const double radius_in,
17-
const int &test_atom_in
18-
)
9+
Atom_input::Atom_input(std::ofstream &ofs_in,
10+
const UnitCell &ucell,
11+
const int amount,
12+
const int ntype,
13+
const bool boundary_in,
14+
const double radius_in,
15+
const int &test_atom_in)
1916
:d_amount(amount),
2017
d_amount_expand(amount),
2118
periodic_boundary(boundary_in),
@@ -33,17 +30,7 @@ Atom_input::Atom_input
3330
x_max_expand(0),
3431
y_max_expand(0),
3532
z_max_expand(0),
36-
d_current(0),
37-
test_atom_input(test_atom_in),
38-
39-
//----------------------------------------------------------
40-
// WARNING :
41-
// Please be very very careful!
42-
// Here type = 0 ,and natom = -1 is a initial value,
43-
// don't change it !!
44-
//----------------------------------------------------------
45-
type(0),
46-
natom(-1)
33+
test_atom_input(test_atom_in)
4734
{
4835
ModuleBase::TITLE("Atom_input", "Atom_input");
4936

@@ -530,40 +517,3 @@ void Atom_input::calculate_cells(void)
530517
//=======================================
531518
return;
532519
}
533-
534-
void Atom_input::set_FAtom(const UnitCell &ucell, FAtom &a)const
535-
{
536-
//----------------------------------------------------------
537-
// EXPLAIN : if expand grid , set from array
538-
//----------------------------------------------------------
539-
if (expand_flag)
540-
{
541-
a = fake_atoms[d_current];
542-
++ d_current;
543-
}
544-
545-
//----------------------------------------------------------
546-
// CALL MEMBER FUNCTION :
547-
// NAME : load_atom
548-
//
549-
// EXPLAIN : if not expand grid , set directly
550-
//----------------------------------------------------------
551-
else
552-
{
553-
natom++;
554-
555-
if (natom >= ucell.atoms[type].na)
556-
{
557-
type ++;
558-
natom = 0;
559-
}
560-
FAtom temp(ucell.atoms[type].tau[natom].x,
561-
ucell.atoms[type].tau[natom].y,
562-
ucell.atoms[type].tau[natom].z,
563-
type, natom,
564-
0, 0, 0);
565-
a = temp;
566-
}
567-
568-
return;
569-
}

source/module_cell/module_neighbor/sltk_atom_input.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ class Atom_input
2121
const int &test_atom_in = 0 //caoyu reconst 2021-05-24
2222
);
2323
~Atom_input();
24-
//==========================================================
25-
// Manipulators
26-
//==========================================================
27-
void set_FAtom(const UnitCell &ucell, FAtom& a)const ;
2824

2925
double vec1[3];
3026
double vec2[3];

source/module_cell/module_neighbor/test/sltk_atom_input_test.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,6 @@ TEST_F(SltkAtomInputTest, ConstructorNoExpand)
229229
radius = 0;
230230
Atom_input Atom_inp(ofs, *ucell, ucell->nat, ucell->ntype, pbc, radius, test_atom_in);
231231
EXPECT_FALSE(Atom_inp.getExpandFlag());
232-
// call set_FAtom and Load_atom
233-
FAtom fa;
234-
EXPECT_NO_THROW(Atom_inp.set_FAtom(*ucell, fa));
235232
ofs.close();
236233
ifs.open("test.out");
237234
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
@@ -257,9 +254,6 @@ TEST_F(SltkAtomInputTest, ConstructorSmallSearchRadius)
257254
radius = 0.5;
258255
Atom_input Atom_inp(ofs, *ucell, ucell->nat, ucell->ntype, pbc, radius, test_atom_in);
259256
EXPECT_TRUE(Atom_inp.getExpandFlag());
260-
// call set_FAtom and Load_atom
261-
FAtom fa;
262-
EXPECT_NO_THROW(Atom_inp.set_FAtom(*ucell, fa));
263257
ofs.close();
264258
ifs.open("test.out");
265259
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());

0 commit comments

Comments
 (0)