/usr/include/BALL/STRUCTURE/geometricProperties.h is in libball1.4-dev 1.4.1+20111206-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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_STRUCTURE_GEOMETRICPROPERTIES_H
#define BALL_STRUCTURE_GEOMETRICPROPERTIES_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#ifndef BALL_MATHS_SIMPLEBOX3_H
# include <BALL/MATHS/simpleBox3.h>
#endif
#ifndef BALL_KERNEL_ATOM_H
# include <BALL/KERNEL/atom.h>
#endif
#ifndef BALL_KERNEL_FRAGMENT_H
# include <BALL/KERNEL/fragment.h>
#endif
#ifndef BALL_CONCEPT_PROCESSOR_H
# include <BALL/CONCEPT/processor.h>
#endif
#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif
#include <vector>
namespace BALL
{
/** Bounding box creating processor.
This class iterates over all atoms of a given molecular object and
determines the lowest and the highest coordinates occuring. It returns
two coordinates ( \link getLower getLower \endlink , \link getUpper getUpper \endlink ) describing the smallest
cuboid (whose sides are parallel to the planes defined by the corrdinate
axes) enclosing all atoms of the molecular object. \par
This processor is useful to determine the extent of a molecular object
if you want to define a \link THashGrid THashGrid \endlink or alike objects. \par
The coordinates returned by \link getLower getLower \endlink and \link getUpper getUpper \endlink are only
valid, if the processor has been applied to a molecular object containing
atoms. \par
\par
\ingroup StructureGeometric
*/
class BALL_EXPORT BoundingBoxProcessor
: public UnaryProcessor<Atom>
{
public:
/** @name Processor related methods.
*/
//@{
/**
*/
virtual bool start()
;
/**
*/
virtual bool finish()
;
/**
*/
virtual Processor::Result operator () (Atom& atom)
{ return operator() (atom.getPosition());}
/**
*/
virtual Processor::Result operator () (const Vector3& v)
;
//@}
/** @name Accessors
*/
//@{
/** Return the bounding box
*/
SimpleBox3 getBox() const
;
/** Returns the lower corner of the bounding box
*/
const Vector3& getLower() const
;
/** Returns the upper corner of the bounding box
*/
const Vector3& getUpper() const
;
//@}
private:
Vector3 lower_;
Vector3 upper_;
};
/** Calculates the geometric center of a given Composite object.
This processor calculates the geometric center of the atom coordinates
of a given molecular object. \par
The geometric center is calculated as follows: \par
\[
\vec{C} = \frac{1}{N} \sum_{i}{N} \vec{r_i}
\]
Where $\vec{r_i}$ represents the coordinates of the ith atom. \par
\ingroup StructureGeometric
*/
class BALL_EXPORT GeometricCenterProcessor
: public UnaryProcessor<Atom>
{
public:
/** @name Processor related methods
*/
//@{
/**
*/
virtual bool start()
;
/**
*/
virtual bool finish()
;
/**
*/
virtual Processor::Result operator()(Atom& atom)
{ return operator()(atom.getPosition());}
/**
*/
virtual Processor::Result operator()(const Vector3& v)
;
//@}
/**@name Accessors
*/
//@{
/** Returns the center of the object
*/
Vector3& getCenter()
;
//@}
private:
Vector3 center_;
Size n_;
};
/** Collects all MolecularFragments that are close enough to another
molecular fragment.
This processor examines the distances between every atom of a given fragment
(further referred to as the reference fragment) and all other atoms in a molecular
object he is applied to. If any atom of a fragment is closer to any atom of the
reference fragment, the whole fragment is collected in an array. \par
The reference fragment itself is also contained in this array, if it is part
of the molecular object the collector is applied to. \par
The array only contains pointers to the fragments, the fragments are neither
changed, nor removed from the molecular object. \par
The reference fragment may either be given by a specialized constructor (also
together with the distance) or using \link setFragment setFragment \endlink . \par
The fragment array is emptied prior to each collection run. \par
\par
\ingroup StructureGeometric
*/
class BALL_EXPORT FragmentDistanceCollector
: public UnaryProcessor<Composite>
{
public:
/** @name Constructors and Destructors
*/
//@{
/** Default constructor
*/
FragmentDistanceCollector()
;
/** Constructor.
Creates a new collector and sets the reference composite
@param composite the reference composite
*/
FragmentDistanceCollector(const Composite& composite)
;
/** Constructor.
Creates a new collector and sets the reference composite and the distance.
@param composite the reference composite
@param distance the maximum distance between any two atoms
*/
FragmentDistanceCollector(const Composite& composite, float distance)
;
virtual ~FragmentDistanceCollector()
{}
//@}
/** @name Processor related methods
*/
//@{
/**
*/
virtual bool start()
;
/**
*/
virtual bool finish()
;
/**
*/
virtual Processor::Result operator()(Composite& composite)
;
//@}
/** @name Accessors
*/
//@{
/** Returns the number of molecular fragments found
@return the number of fragments in the array
*/
Size getNumberOfFragments()
;
/** Sets the reference composite
@param composite the new reference composite
*/
void setComposite(const Composite& composite)
;
/** Gets the reference composite
@return a const pointer to the reference composite
*/
const Composite* getComposite() const
;
/** Gets the maximum distance
@return the maximum distance
*/
float getDistance() const
;
/** Sets the maximum distance
@param distance the new maximum distance
*/
void setDistance(float distance)
;
//@}
/** The array containing all molecular fragments collected
*/
std::vector<Fragment*> fragments;
protected:
std::vector<Fragment*> all_fragments_;
const Composite* reference_composite_;
float squared_distance_;
};
//@}
/** @name Angle Calculation
\ingroup StructureGeometric
*/
//@{
/** Calculate the torsion angle between four atoms
*/
BALL_EXPORT Angle calculateTorsionAngle(const Atom& a1, const Atom& a2, const Atom& a3, const Atom& a4)
throw(Exception::IllegalPosition);
/**
* Set the torsion angle defined by a1, a2, a3, a4. The atoms should be connected by bonds
* The position of a1 and a2 is kept fix, while the connected component
* containing a4 is rotated accordingly.
*
* @return false if the bond is not rotatable or if the molecule graph is not divided
* into two connected components upon removal of the bond (a2,a3)
*/
BALL_EXPORT bool setTorsionAngle(const Atom& a1, const Atom& a2, Atom& a3, const Atom& a4, Angle angle);
/** Calculate the bond angle between three atoms
*/
BALL_EXPORT Angle calculateBondAngle(const Atom& a1, const Atom& a2, const Atom& a3)
throw(Exception::IllegalPosition);
//@}
} // namespace BALL
#endif // BALL_STRUCTURE_GEOMETRICPROPERTIES_H
|