QNANO
Lattice.h
1 #ifndef QNANO_NEW_LATTICE_DEFINED_H
2 #define QNANO_NEW_LATTICE_DEFINED_H
3 
4 #include "tools/Reader.h"
5 #include "tools/List_Class.h"
6 #include "structure/Atom.h"
7 #include "tools/Parameter_Map.h"
8 
16 public:
17  int nn_index;
18  std::vector<int> nn_unitcells;
19  Vec3d D;
20 
21  Single_Lattice_Bond(): nn_index(-1), nn_unitcells(3,-1), D(0,0,0){
22  }
23 };
25 class Lattice_Bonds: public List_Class<Single_Lattice_Bond>{
26 public:
27  Vec3d pos;
28  int type;
29 };
30 
36 class Lattice: public List_Class<Lattice_Bonds> {
37 public:
39  Vec3d p[3];
41  Vec3d recip[3];
44 
46  void calc_dist();
47  void calc_recip();
48 
50  Vec3d cartesian_from_lattice_units(const Vec3d &v)const;
51 
53  double get_first_bondlength()const;
54 
55 
56  std::pair<int, int> find(const Vec3d& D, int type, double tolerance=0.2)const;
57  std::pair<int, int> find_check(const Vec3d& D, int type, double tolerance=0.2)const;
58  Single_Lattice_Bond &get(const Vec3d& D, int type, double tolerance=0.2);
59 
60 
61  void read(const std::string &filename, const double sx=1.,const double sy=1., const double sz=1.);
62 // void read(const std::string &filename, const double sx,const double sy, const double sz);
63 /* void read(const std::string &filename){
64  read(filename,1.,1.,1.);
65  lattice_vectors_set_up=false;
66  }*/
67  void print(const std::string &filename)const;
68  void read_from_material_file(const std::string &material, const std::string &alt_dir="");
69  void read_from_positions_file(const std::string &mat_dir, const std::string &positionsfilename);
70  void print_info(std::ostream &ofs=std::cout)const;
71 
72 
73 
74  Lattice(){lattice_vectors_set_up=false;}
75  Lattice(const std::string &filename){
76  read(filename,1.,1.,1.);
77  lattice_vectors_set_up=false;
78  }
79  Lattice(const std::string &filename, const double sx,const double sy, const double sz){
80  read(filename,sx,sy,sz);
81  }
82 
83 };
84 
85 
86 #endif
bool lattice_vectors_set_up
set if proper lattice constants have been specified and (reciprocal) lattice vectors have been set up...
Definition: Lattice.h:43
Class to store positions and to handle operations on 3d vectors.
Definition: Vec3d.h:9
Definition: List_Class.h:8
A single bond.
Definition: Lattice.h:15
Definition: Lattice.h:36
Bonds associated to one atom in a lattice (cf. Lattice)
Definition: Lattice.h:25