Pteros  2.0
Molecular modeling library for human beings!
distance_search_base.h
1 /*
2  *
3  * This source code is part of
4  * ******************
5  * *** Pteros ***
6  * ******************
7  * molecular modeling library
8  *
9  * Copyright (c) 2009-2013, Semen Yesylevskyy
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of Artistic License:
13  *
14  * Please note, that Artistic License is slightly more restrictive
15  * then GPL license in terms of distributing the modified versions
16  * of this software (they should be approved first).
17  * Read http://www.opensource.org/licenses/artistic-license-2.0.php
18  * for details. Such license fits scientific software better then
19  * GPL because it prevents the distribution of bugged derivatives.
20  *
21 */
22 
23 #ifndef DISTANCE_SEARCH_BASE_H_INCLUDED
24 #define DISTANCE_SEARCH_BASE_H_INCLUDED
25 
26 #include <Eigen/Core>
27 #include <vector>
28 #include "pteros/core/periodic_box.h"
29 #include "pteros/core/grid.h"
30 
31 namespace pteros {
32 
33  struct Nlist_t {
34  std::vector<Eigen::Vector3i> data;
35  std::vector<bool> wrapped;
36 
37  void clear();
38  void append(Vector3i_const_ref coor, bool wrap = false);
39  };
40 
41 
42  class Distance_search_base {
43  public:
44  protected:
45  // Min and max of the bounding box (for non-periodic case)
46  Eigen::Vector3f min,max;
47  // Current periodic box (for periodic case)
48  Periodic_box box;
49  // Grid dimensions
50  int NgridX, NgridY, NgridZ;
51  // Grids with coordinate pointers
52  Grid grid1,grid2;
53  // Cut-off
54  float cutoff;
55  // If true absolute index rather then selection index is returned in the bond list
56  bool abs_index;
57  // Periodicity
58  bool is_periodic;
59 
60  void set_grid_size(const Eigen::Vector3f& min, const Eigen::Vector3f& max,
61  int Natoms, const Periodic_box& box);
62 
63 
64  void get_nlist(int i, int j, int k, Nlist_t &nlist);
65  };
66 
67 }
68 
69 #endif // GRID_SEARCH_H_INCLUDED
Pteros namespace.
Definition: options.cpp:32