QNANO
Neighbor_List.h
1 #ifndef QNANO_NEW_NEIGHBOR_LIST_DEFINED_H
2 #define QNANO_NEW_NEIGHBOR_LIST_DEFINED_H
3 
4 #include "structure/Neighbor.h"
5 #include "tightbinding/TB_Parameter_List.h"
6 #include "structure/Atoms_in_Boxes.h"
7 #include "structure/Atom_List.h"
8 #include "structure/Neighborhood_Criterion_Lattice.h"
9 #include "structure/Periodic_Vecs.h"
10 
11 
12 class Neighbor_List: public List_Class<std::vector<Neighbor> > {
13 public:
15  void setup(Parameter_Map &param_map, const Atom_List &atlist);
17  void setup(Parameter_Map &param_map);
18 
19 
21  void add(const Atom_List &atlist, const Neighborhood_Criterion &criterion, double boxwidth=-1.);
22 
24  void add_shifted(const Atom_List &atlist, const Neighborhood_Criterion &criterion, const Vec3d &shift, double boxwidth=-1.);
25 
27  void calculate(const Atom_List &atlist, const Neighborhood_Criterion &criterion, const std::vector<Vec3d> & periodic_vec=std::vector<Vec3d>(), double boxwidth=-1.);
28  void calculate(const Atom_List &atlist, const Lattice &lat, const std::vector<Vec3d> & periodic_vec=std::vector<Vec3d>(), double tolerance=0.20){
29  Neighborhood_Criterion_Lattice criterion(lat, tolerance);
30  calculate(atlist, criterion, periodic_vec, criterion.upper_bound_radius());
31  }
32 
33 
35  void calculate_unrelaxed(const Atom_List &atlist, const Lattice &lat, double tolerance=0.2);
36  void setup_unrelaxed_from_relaxed(const Atom_List & atlist, const Neighbor_List & neilist_relaxed, const TB_Parameter_List &parlist);
37 
38 
40 // bool calcualte_unrelaxed_single(const Atom_List &atlist, size_t index1, size_t index2, size_t nindex, const Lattice &lat, double tolerance=0.2, const Vec3d &shift=Vec3d());
41  bool calcualte_unrelaxed_single(const Neighbor_List &other, size_t index, size_t n, const Lattice &lat, double tolerance=0.2, const Vec3d &shift=Vec3d());
42 
43 
44 
45  size_t get_max_neighbors_per_atom()const;
46  //read from file
47  void read(const std::string &filename, const Atom_List &atlist);
48  //print neighbors file
49  void print(const std::string &filename)const;
50  //print neighbors file with bond vectors 'D'
51  void print_withD(const std::string &filename)const;
52 
53 
54  //Basic consistency check: if A is a neighbor of B, B has to be a neighbor of A
55  void check_consistency()const;
56 
57  //Constructors:
58  Neighbor_List(){}
59  Neighbor_List(const Atom_List &atlist, const Neighborhood_Criterion &criterion, const std::vector<Vec3d> &periodic_vec=std::vector<Vec3d>(), double boxwidth=-1.){
60  calculate(atlist, criterion, periodic_vec, boxwidth);
61  }
62  Neighbor_List(const Atom_List &atlist, const Lattice &lat, const std::vector<Vec3d> &periodic_vec=std::vector<Vec3d>(), double tolerance=0.2){
63  calculate(atlist, lat, periodic_vec, tolerance);
64  }
65 };
66 
67 #endif
Definition: Parameter_Map.h:12
Class to store positions and to handle operations on 3d vectors.
Definition: Vec3d.h:9
void add(const Atom_List &atlist, const Neighborhood_Criterion &criterion, double boxwidth=-1.)
calculate neighbors from Atom_List according to the specified Neighborhood_Criterion, then add them to the existing neighbors
Definition: Neighbor_List.cc:21
Definition: Atom_List.h:9
Definition: List_Class.h:8
Definition: Neighbor_List.h:12
Definition: TB_Parameter_List.h:8
Definition: Neighborhood_Criterion_Lattice.h:7
void add_shifted(const Atom_List &atlist, const Neighborhood_Criterion &criterion, const Vec3d &shift, double boxwidth=-1.)
Same as &#39;add&#39; but shift the atom positions before checking if the Neighborhood_Criterion is fulfilled...
Definition: Neighbor_List.cc:25
Definition: Neighborhood_Criterion.h:6
void calculate_unrelaxed(const Atom_List &atlist, const Lattice &lat, double tolerance=0.2)
Same as &#39;calculate&#39;, but set the bond vector &#39;D&#39; of each &#39;Neighbor&#39; to one matching a neighbor in an ...
Definition: Neighbor_List.cc:120
void setup(Parameter_Map &param_map, const Atom_List &atlist)
setup from command line parameters. Typically, an Atom_List has to be set up anyway, so use if it possible
Definition: Neighbor_List.cc:4
Definition: Lattice.h:36
void calculate(const Atom_List &atlist, const Neighborhood_Criterion &criterion, const std::vector< Vec3d > &periodic_vec=std::vector< Vec3d >(), double boxwidth=-1.)
Clear existing data and &#39;add&#39;.
Definition: Neighbor_List.cc:59
bool calcualte_unrelaxed_single(const Neighbor_List &other, size_t index, size_t n, const Lattice &lat, double tolerance=0.2, const Vec3d &shift=Vec3d())
If there is more than one material, there is more than one equilibrium lattice. Thus, we have to go through all atoms individually to get the correct equilibirum distance vectors. Returns false if neighbor is not found.
Definition: Neighbor_List.cc:105