/usr/include/BALL/STRUCTURE/sdGenerator.h is in libball1.4-dev 1.4.3~beta1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_STRUCTURE_SDGENERATOR_H
#define BALL_STRUCTURE_SDGENERATOR_H
#ifndef BALL_DATATYPE_OPTIONS_H
# include <BALL/DATATYPE/options.h>
#endif
#ifndef BALL_STRUCTURE_RINGANALYSER_H
# include <BALL/STRUCTURE/ringAnalyser.h>
#endif
#ifndef BALL_KERNEL_PDBATOM_H
# include <BALL/KERNEL/PDBAtom.h>
#endif
#include <vector>
#include <queue>
namespace BALL
{
class System;
class Atom;
/**
* Structure Diagram Generation.
*
* This class provides methods for analysis of the input.
*/
class BALL_EXPORT SDGenerator
{
public:
/**
* \brief Properties, used to describe atoms and their status
*/
enum Property
{
FIRST_SDGENERATOR_PROPERTY = PDBAtom::NUMBER_OF_PROPERTIES+1,
IN_RING,
CORE_CHAIN,
DEPOSITED,
FXAS,
EQAS,
HEAD,
EDGE,
ASSEMBLED,
ZIG,
ZAG,
INITIALIZED_HEAD_CFS,
LAST_SDGENERATOR_PROPERTY
};
/** @name Constant Definitions
*/
//@{
/// Option names
struct BALL_EXPORT Option
{
/** show hydrogen atoms.
*/
static const char* SHOW_HYDROGENS;
/** the standard bond length for structure
* diagrams
*/
static const char* STANDARD_BOND_LENGTH;
};
/// Default values for options
struct BALL_EXPORT Default
{
static const bool SHOW_HYDROGENS;
static const float STANDARD_BOND_LENGTH;
};
//@}
/** @name Constructors and Destructors.
*/
//@{
/**
* Default-Constructor
*/
SDGenerator(bool show_hydrogens = false);
/**
* Destructor
*/
virtual ~SDGenerator();
//@}
/** @name Public Attributes
*/
//@{
/// options
Options options;
//@}
/** @name Accessors
*/
//@{
/** Resets the options to default values.
*/
void setDefaultOptions();
//@}
/**
* \brief Generates a structure Diagram from the input System
* @param molecule_sys
*/
void generateSD(System& molecule_sys);
/**
* Clear all internal data structures.
*/
void clear();
protected:
/** A nested class for our atom priorization
*/
class AtomComparator
{
public:
bool operator() (Atom const* first, Atom const* second) const
{
Size first_value = first->getProperty("SDGenerator::PRIORITY").getUnsignedInt();
Size second_value = second->getProperty("SDGenerator::PRIORITY").getUnsignedInt();
return first_value < second_value;
}
};
/**
* \brief Distinguishes between ring-atoms and core-chain-atoms, removes all H-Atoms from the System
* @param molecule_sys
*/
void prepare_();
/**
* \brief Constructs a ringsystem, providing the atoms with relative 2D-coordinates, starting in the point of origin
* @param current_ring_system consecutive numbering of the molecule's ringsystems
*/
void constructRingSystem_(Position current_ring_system);
// Obtain the CFS from the properties of the atom...
Angle getCFS_(Atom const* atom, bool hi);
// Convert a vector into the corresponding CFS angle
Angle computeCFS_(Vector3 const& input);
// store the CFS for an atom
void setCFS_(Atom* atom, Angle cfs, bool high);
// push the CFS before it is overwritten
void pushCFS_(Atom* atom);
// retrieve backup CVS values
Angle getBackupCFS_(Atom const*, bool hi);
// Compute the CFS values for a full regular polygon
void computeCoreCFS_(RingAnalyser::Ring& ring, bool clockwise);
//
Angle computeAngularSeparation_(Atom* seed);
//
Angle computeAngularDemand_(Atom* seed);
//
std::vector<Atom*> sequenceSubstituents_(Atom* seed);
/** Compute the Shelley priority values for each atom
*/
void computeShelleyPriorities_();
/** Build a regular polygon for a ring with two fixed points.
*/
void buildRegularPolygon_(RingAnalyser::Ring& ring, Position first_anchor_index, bool clockwise);
/** Build an open polygon for a ring with two fixed points.
*/
void buildOpenPolygon_(RingAnalyser::Ring& ring, Position first_anchor_index, Position second_anchor_index);
/**
* \brief construct the core-ring as a regular polygon
* @param current_ring the index of the ring to attach
* @param current_system the ring system
* @param x_start the ring is created in (x_start, 0, 0)
*/
void attachCore_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system, float x_start);
/**
* \brief attach a ring template to a (partially) constructed ringsystem (no functionality yet)
* @param current_ring the index of the ring to attach
* @param current_system the ring system
*/
void attachTemplate_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
/**
* \brief attach a fused ring to a (partially) constructed ringsystem
* @param current_ring the index of the ring to attach
* @param current_system the index of the ring system
*/
void attachFused_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
/**
* \brief attach a bridged ring to a (partially) constructed ringsystem
* @param current_ring the index of the ring to attach
* @param current_system the index of the ring system
*/
void attachBridged_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
/**
* \brief attach a spiro ring to a (partially) constructed ringsystem
* @param current_ring the index of the ring to attach
* @param current_system the index of the ring system
*/
void attachSpiro_(Position current_ring, std::vector<RingAnalyser::Ring>& current_system);
/// Compute adjacency matrix of the given atoms
void computeAdjacencyMatrix_(std::vector<Atom*>& chain, std::vector<bool>& result);
/// Comparator for chains of atoms
static bool compareChains_(const vector<Atom*>& x, const vector<Atom*>& y);
/**
* \brief cluster and arrange all chains in the system
*/
void treatChains_();
//
void smoothCFSAngle_(Atom* seed);
//
void placeSubstituent_(Atom* seed, Atom* head, Atom* next);
//
void depositPFU_(Atom* seed_atom, Atom* next_neighbour);
//
void checkOverlap_(Atom* atom);
//Check whether the ring is clockwise or not
bool ringIsClockwise_(const RingAnalyser::Ring& ring, Index start_index = 0) const;
/**
* Assemble the final structure diagram
*/
void assembleSD_();
// The backtracking for our Floyd-Warshall implementation
void findFloydWarshallPath_(std::vector<int>& path, std::vector<Index>& next, Size remaining_atoms, Position i, Position j, std::list<Index>& output);
/// The ring analyser containing all information about ring systems
RingAnalyser ring_analyser_;
/// all chains
std::list<std::list<Atom*> > chains_;
/// our redraw queue
std::priority_queue<Atom*, std::vector<Atom*>, AtomComparator> redraw_queue_;
/// the system we are working on
System* system_;
};
} // namepspace BALL
#endif
|