BALL  1.5.0
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 
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  //
171 
172  //
174 
175  //
176  std::vector<Atom*> sequenceSubstituents_(Atom* seed);
177 
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
BALL::SDGenerator::SDGenerator
SDGenerator(bool show_hydrogens=false)
BALL::PropertyManager::getProperty
const NamedProperty & getProperty(const std::string &name) const
BALL::SDGenerator::redraw_queue_
std::priority_queue< Atom *, std::vector< Atom * >, AtomComparator > redraw_queue_
our redraw queue
Definition: sdGenerator.h:267
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL::SDGenerator::Property
Property
Properties, used to describe atoms and their status.
Definition: sdGenerator.h:41
BALL::SDGenerator::computeAngularDemand_
Angle computeAngularDemand_(Atom *seed)
BALL::TAngle< float >
BALL::SDGenerator::system_
System * system_
the system we are working on
Definition: sdGenerator.h:270
BALL::SDGenerator::ZAG
@ ZAG
Definition: sdGenerator.h:52
BALL::SDGenerator::CORE_CHAIN
@ CORE_CHAIN
Definition: sdGenerator.h:44
BALL::SDGenerator::findFloydWarshallPath_
void findFloydWarshallPath_(std::vector< int > &path, std::vector< Index > &next, Size remaining_atoms, Position i, Position j, std::list< Index > &output)
BALL::SDGenerator::prepare_
void prepare_()
Distinguishes between ring-atoms and core-chain-atoms, removes all H-Atoms from the System.
BALL::Options
Definition: options.h:48
BALL::SDGenerator::placeSubstituent_
void placeSubstituent_(Atom *seed, Atom *head, Atom *next)
BALL::NamedProperty::getUnsignedInt
unsigned int getUnsignedInt() const
BALL::System
Definition: KERNEL/system.h:40
BALL::SDGenerator::IN_RING
@ IN_RING
Definition: sdGenerator.h:43
BALL::SDGenerator::EDGE
@ EDGE
Definition: sdGenerator.h:49
BALL::SDGenerator::computeAdjacencyMatrix_
void computeAdjacencyMatrix_(std::vector< Atom * > &chain, std::vector< bool > &result)
Compute adjacency matrix of the given atoms.
BALL::SDGenerator::HEAD
@ HEAD
Definition: sdGenerator.h:48
BALL::SDGenerator::buildRegularPolygon_
void buildRegularPolygon_(RingAnalyser::Ring &ring, Position first_anchor_index, bool clockwise)
BALL::SDGenerator::depositPFU_
void depositPFU_(Atom *seed_atom, Atom *next_neighbour)
BALL::Atom
Definition: atom.h:90
BALL::SDGenerator::assembleSD_
void assembleSD_()
BALL::SDGenerator::DEPOSITED
@ DEPOSITED
Definition: sdGenerator.h:45
BALL::SDGenerator::attachBridged_
void attachBridged_(Position current_ring, std::vector< RingAnalyser::Ring > &current_system)
attach a bridged ring to a (partially) constructed ringsystem
BALL
Definition: constants.h:13
BALL::SDGenerator::checkOverlap_
void checkOverlap_(Atom *atom)
BALL::SDGenerator::pushCFS_
void pushCFS_(Atom *atom)
BALL::SDGenerator::smoothCFSAngle_
void smoothCFSAngle_(Atom *seed)
BALL::SDGenerator::Option::STANDARD_BOND_LENGTH
static const char * STANDARD_BOND_LENGTH
Definition: sdGenerator.h:70
BALL::PDB::Atom
char Atom[5]
Definition: PDBdefs.h:257
options.h
BALL::SDGenerator::computeCFS_
Angle computeCFS_(Vector3 const &input)
BALL::SDGenerator::getCFS_
Angle getCFS_(Atom const *atom, bool hi)
BALL::SDGenerator::Default
Default values for options.
Definition: sdGenerator.h:75
BALL::SDGenerator::buildOpenPolygon_
void buildOpenPolygon_(RingAnalyser::Ring &ring, Position first_anchor_index, Position second_anchor_index)
BALL_INDEX_TYPE
BALL::SDGenerator::computeAngularSeparation_
Angle computeAngularSeparation_(Atom *seed)
BALL::SDGenerator::INITIALIZED_HEAD_CFS
@ INITIALIZED_HEAD_CFS
Definition: sdGenerator.h:53
BALL_SIZE_TYPE
BALL::TVector3< float >
BALL::SDGenerator::computeShelleyPriorities_
void computeShelleyPriorities_()
BALL::SDGenerator::ring_analyser_
RingAnalyser ring_analyser_
The ring analyser containing all information about ring systems.
Definition: sdGenerator.h:261
BALL::RingAnalyser::Ring
Definition: ringAnalyser.h:53
BALL::PDBAtom::NUMBER_OF_PROPERTIES
@ NUMBER_OF_PROPERTIES
The number of properties in PDBAtom.
Definition: PDBAtom.h:82
BALL::SDGenerator::Option::SHOW_HYDROGENS
static const char * SHOW_HYDROGENS
Definition: sdGenerator.h:65
BALL::SDGenerator::~SDGenerator
virtual ~SDGenerator()
BALL::SDGenerator::ZIG
@ ZIG
Definition: sdGenerator.h:51
PDBAtom.h
BALL::SDGenerator::clear
void clear()
BALL::SDGenerator::setCFS_
void setCFS_(Atom *atom, Angle cfs, bool high)
BALL::SDGenerator::attachSpiro_
void attachSpiro_(Position current_ring, std::vector< RingAnalyser::Ring > &current_system)
attach a spiro ring to a (partially) constructed ringsystem
BALL::SDGenerator::attachCore_
void attachCore_(Position current_ring, std::vector< RingAnalyser::Ring > &current_system, float x_start)
construct the core-ring as a regular polygon
BALL::SDGenerator::attachFused_
void attachFused_(Position current_ring, std::vector< RingAnalyser::Ring > &current_system)
attach a fused ring to a (partially) constructed ringsystem
BALL::SDGenerator::constructRingSystem_
void constructRingSystem_(Position current_ring_system)
Constructs a ringsystem, providing the atoms with relative 2D-coordinates, starting in the point of o...
BALL::SDGenerator::ASSEMBLED
@ ASSEMBLED
Definition: sdGenerator.h:50
BALL::RingAnalyser
Methods for the analysis of the structure of ringsystems.
Definition: ringAnalyser.h:38
BALL::SDGenerator::ringIsClockwise_
bool ringIsClockwise_(const RingAnalyser::Ring &ring, Index start_index=0) const
BALL::SDGenerator::chains_
std::list< std::list< Atom * > > chains_
all chains
Definition: sdGenerator.h:264
BALL::SDGenerator::sequenceSubstituents_
std::vector< Atom * > sequenceSubstituents_(Atom *seed)
BALL::SDGenerator::generateSD
void generateSD(System &molecule_sys)
Generates a structure Diagram from the input System.
BALL::SDGenerator
Definition: sdGenerator.h:34
BALL::SDGenerator::computeCoreCFS_
void computeCoreCFS_(RingAnalyser::Ring &ring, bool clockwise)
BALL::SDGenerator::treatChains_
void treatChains_()
cluster and arrange all chains in the system
BALL::SDGenerator::getBackupCFS_
Angle getBackupCFS_(Atom const *, bool hi)
BALL::SDGenerator::Default::SHOW_HYDROGENS
static const bool SHOW_HYDROGENS
Definition: sdGenerator.h:76
BALL::SDGenerator::FXAS
@ FXAS
Definition: sdGenerator.h:46
BALL::SDGenerator::setDefaultOptions
void setDefaultOptions()
BALL::SDGenerator::compareChains_
static bool compareChains_(const vector< Atom * > &x, const vector< Atom * > &y)
Comparator for chains of atoms.
ringAnalyser.h
BALL::SDGenerator::Default::STANDARD_BOND_LENGTH
static const float STANDARD_BOND_LENGTH
Definition: sdGenerator.h:78
BALL::SDGenerator::AtomComparator
Definition: sdGenerator.h:128
BALL::SDGenerator::attachTemplate_
void attachTemplate_(Position current_ring, std::vector< RingAnalyser::Ring > &current_system)
attach a ring template to a (partially) constructed ringsystem (no functionality yet)
BALL::SDGenerator::EQAS
@ EQAS
Definition: sdGenerator.h:47