Skip to content

Commit 7c117b5

Browse files
committed
use 2 layers vector replace undered_map to improve perfermance
1 parent 06bf2df commit 7c117b5

File tree

6 files changed

+598
-587
lines changed

6 files changed

+598
-587
lines changed

source/module_cell/module_neighbor/sltk_atom.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <memory>
55
#include "sltk_util.h"
66
#include "module_base/timer.h"
7-
#include <list>
7+
#include <vector>
88

99
// a class contains the atom position,
1010
// the type and the index,
@@ -14,7 +14,7 @@ class FAtom
1414
double d_x;
1515
double d_y;
1616
double d_z;
17-
std::list<FAtom *> adjacent;
17+
std::vector<FAtom *> adjacent;
1818

1919
int type;
2020
int natom;
@@ -50,7 +50,7 @@ class FAtom
5050
{
5151
adjacent.push_back( &atom_in);
5252
}
53-
const std::list<FAtom *>& getAdjacent() const { return adjacent; }
53+
const std::vector<FAtom *>& getAdjacent() const { return adjacent; }
5454
void clearAdjacent() { adjacent.clear(); }
5555
//==========================================================
5656
// MEMBER FUNCTION :

source/module_cell/module_neighbor/sltk_atom_arrange.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ void atom_arrange::search(
128128
// test the adjacent atoms and the box.
129129
if(test_only)
130130
{
131+
std::cout << "radius_lat0unit = " << radius_lat0unit << std::endl;
132+
std::cout << "search_radius_bohr = " << search_radius_bohr << std::endl;
133+
131134
ofs_in << " " << std::setw(5) << "Type" << std::setw(5) << "Atom" << std::setw(8) << "AdjNum" << std::endl;
132135
std::cout << std::setw(8) << "Labels" << std::setw(15) << "tau.x" << std::setw(15) << "tau.y" << std::setw(15)
133136
<< "tau.z" << std::setw(8) << "box.x" << std::setw(8) << "box.y" << std::setw(8) << "box.z"

0 commit comments

Comments
 (0)