@@ -38,6 +38,7 @@ void Grid_Driver::Find_atom(
3838
3939 // store result in member adj_info when parameter adjs is NULL
4040 AdjacentAtomInfo* local_adjs = adjs == nullptr ? &this ->adj_info : adjs;
41+ local_adjs->clear ();
4142 const std::list<FAtom *> & all_atom = Cell[this ->true_cell_x ][this ->true_cell_y ][this ->true_cell_z ].atom_map [std::make_tuple (cartesian_pos.x , cartesian_pos.y , cartesian_pos.z )].getAdjacent ();
4243 // std::cout << "ntype = "<< ntype << " atom size = " << all_atom.size() << std::endl;
4344 for (const FAtom * atom : all_atom)
@@ -53,30 +54,34 @@ void Grid_Driver::Find_atom(
5354 }
5455 else
5556 {
56- local_adjs->adjacent_tau .push_back (Calculate_adjacent_site (* atom,
57+ local_adjs->adjacent_tau .push_back (Calculate_adjacent_site (atom-> x (), atom-> y (), atom-> z () ,
5758 vec1[0 ], vec2[0 ], vec3[0 ],
5859 vec1[1 ], vec2[1 ], vec3[1 ],
5960 vec1[2 ], vec2[2 ], vec3[2 ],
6061 atom->getCellX (), atom->getCellY (), atom->getCellZ ()));
6162 }// end if expand_flag
6263 local_adjs->adj_num ++;
6364 }
64- local_adjs->adj_num --;
65+ local_adjs->ntype .push_back (ntype);
66+ local_adjs->natom .push_back (nnumber);
67+ local_adjs->box .push_back (ModuleBase::Vector3<int >(0 , 0 , 0 ));
68+ local_adjs->adjacent_tau .push_back (ModuleBase::Vector3<double >(cartesian_pos.x , cartesian_pos.y , cartesian_pos.z ));
69+
6570
6671 ModuleBase::timer::tick (" Grid_Driver" ," Find_atom" );
6772 return ;
6873}
6974
70- ModuleBase::Vector3<double > Grid_Driver::Calculate_adjacent_site (const FAtom &atom ,
75+ ModuleBase::Vector3<double > Grid_Driver::Calculate_adjacent_site (const double x, const double y, const double z ,
7176 const double &box11, const double &box12, const double &box13,
7277 const double &box21, const double &box22, const double &box23,
7378 const double &box31, const double &box32, const double &box33,
7479 const short box_x, const short box_y, const short box_z) const
7580{
7681 ModuleBase::Vector3<double > adjacent_site (0 , 0 , 0 );
77- adjacent_site.x = atom. x () + box_x * box11 + box_y * box12 + box_z * box13;
78- adjacent_site.y = atom. y () + box_x * box21 + box_y * box22 + box_z * box23;
79- adjacent_site.z = atom. z () + box_x * box31 + box_y * box32 + box_z * box33;
82+ adjacent_site.x = x + box_x * box11 + box_y * box12 + box_z * box13;
83+ adjacent_site.y = y + box_x * box21 + box_y * box22 + box_z * box23;
84+ adjacent_site.z = z + box_x * box31 + box_y * box32 + box_z * box33;
8085
8186 return adjacent_site;
8287}
0 commit comments