BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sdGenerator.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_SDGENERATOR_H
6 #define BALL_STRUCTURE_SDGENERATOR_H
7 
8 #ifndef BALL_DATATYPE_OPTIONS_H
9 # include <BALL/DATATYPE/options.h>
10 #endif
11 
12 #ifndef BALL_STRUCTURE_RINGANALYSER_H
14 #endif
15 
16 #ifndef BALL_KERNEL_PDBATOM_H
17 # include <BALL/KERNEL/PDBAtom.h>
18 #endif
19 
20 #include <vector>
21 #include <queue>
22 
23 namespace BALL
24 {
25  class System;
26  class Atom;
27 
34  {
35  public:
36 
40  enum Property
41  {
42  FIRST_SDGENERATOR_PROPERTY = PDBAtom::NUMBER_OF_PROPERTIES+1,
51  ZIG,
52  ZAG,
54  LAST_SDGENERATOR_PROPERTY
55  };
56 
60  struct BALL_EXPORT Option
62  {
65  static const char* SHOW_HYDROGENS;
66 
70  static const char* STANDARD_BOND_LENGTH;
71  };
72 
75  {
76  static const bool SHOW_HYDROGENS;
77 
78  static const float STANDARD_BOND_LENGTH;
79  };
81 
85 
89  SDGenerator(bool show_hydrogens = false);
90 
94  virtual ~SDGenerator();
96 
100  Options options;
103 
109  void setDefaultOptions();
111 
116  void generateSD(System& molecule_sys);
117 
121  void clear();
122 
123  protected:
124 
128  {
129  public:
130  bool operator() (Atom const* first, Atom const* second) const
131  {
132  Size first_value = first->getProperty("SDGenerator::PRIORITY").getUnsignedInt();
133  Size second_value = second->getProperty("SDGenerator::PRIORITY").getUnsignedInt();
134 
135  return first_value < second_value;
136  }
137  };
138 
143  void prepare_();
144 
149  void constructRingSystem_(Position current_ring_system);
150 
151  // Obtain the CFS from the properties of the atom...
152  Angle getCFS_(Atom const* atom, bool hi);
153 
154  // Convert a vector into the corresponding CFS angle
155  Angle computeCFS_(Vector3 const& input);
156 
157  // store the CFS for an atom
158  void setCFS_(Atom* atom, Angle cfs, bool high);
159 
160  // push the CFS before it is overwritten
161  void pushCFS_(Atom* atom);
162 
163  // retrieve backup CVS values
164  Angle getBackupCFS_(Atom const*, bool hi);
165 
166  // Compute the CFS values for a full regular polygon
167  void computeCoreCFS_(RingAnalyser::Ring& ring, bool clockwise);
168 
169  //
170  Angle computeAngularSeparation_(Atom* seed);
171 
172  //
173  Angle computeAngularDemand_(Atom* seed);
174 
175  //
176  std::vector<Atom*> sequenceSubstituents_(Atom* seed);
177 
180  void computeShelleyPriorities_();
181 
184  void buildRegularPolygon_(RingAnalyser::Ring& ring, Position first_anchor_index, bool clockwise);
185 
188  void buildOpenPolygon_(RingAnalyser::Ring& ring, Position first_anchor_index, Position second_anchor_index);
189 
196  void attachCore_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system, float x_start);
197 
203  void attachTemplate_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
204 
210  void attachFused_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
211 
217  void attachBridged_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
218 
224  void attachSpiro_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
225 
227  void computeAdjacencyMatrix_(std::vector<Atom*>& chain, std::vector<bool>& result);
228 
230  static bool compareChains_(const vector<Atom*>& x, const vector<Atom*>& y);
231 
235  void treatChains_();
236 
237  //
238  void smoothCFSAngle_(Atom* seed);
239 
240  //
241  void placeSubstituent_(Atom* seed, Atom* head, Atom* next);
242 
243  //
244  void depositPFU_(Atom* seed_atom, Atom* next_neighbour);
245 
246  //
247  void checkOverlap_(Atom* atom);
248 
249  //Check whether the ring is clockwise or not
250  bool ringIsClockwise_(const RingAnalyser::Ring& ring, Index start_index = 0) const;
251 
255  void assembleSD_();
256 
257  // The backtracking for our Floyd-Warshall implementation
258  void findFloydWarshallPath_(std::vector<int>& path, std::vector<Index>& next, Size remaining_atoms, Position i, Position j, std::list<Index>& output);
259 
262 
264  std::list<std::list<Atom*> > chains_;
265 
267  std::priority_queue<Atom*, std::vector<Atom*>, AtomComparator> redraw_queue_;
268 
271  };
272 
273 } // namepspace BALL
274 
275 #endif
Property
Properties, used to describe atoms and their status.
Definition: sdGenerator.h:40
const NamedProperty & getProperty(const std::string &name) const
unsigned int getUnsignedInt() const
System * system_
the system we are working on
Definition: sdGenerator.h:270
Default values for options.
Definition: sdGenerator.h:74
static const float STANDARD_BOND_LENGTH
Definition: sdGenerator.h:78
static const char * SHOW_HYDROGENS
Definition: sdGenerator.h:65
static const char * STANDARD_BOND_LENGTH
Definition: sdGenerator.h:70
std::list< std::list< Atom * > > chains_
all chains
Definition: sdGenerator.h:264
The number of properties in PDBAtom.
Definition: PDBAtom.h:82
RingAnalyser ring_analyser_
The ring analyser containing all information about ring systems.
Definition: sdGenerator.h:261
char Atom[5]
Definition: PDBdefs.h:257
std::priority_queue< Atom *, std::vector< Atom * >, AtomComparator > redraw_queue_
our redraw queue
Definition: sdGenerator.h:267
static const bool SHOW_HYDROGENS
Definition: sdGenerator.h:76
Methods for the analysis of the structure of ringsystems.
Definition: ringAnalyser.h:36
#define BALL_EXPORT
Definition: COMMON/global.h:50