1 |
/********************************************************************** |
2 |
generic.h - Handle generic data classes. Custom data for atoms, bonds, etc. |
3 |
|
4 |
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc. |
5 |
Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison |
6 |
|
7 |
This file is part of the Open Babel project. |
8 |
For more information, see <http://openbabel.sourceforge.net/> |
9 |
|
10 |
This program is free software; you can redistribute it and/or modify |
11 |
it under the terms of the GNU General Public License as published by |
12 |
the Free Software Foundation version 2 of the License. |
13 |
|
14 |
This program is distributed in the hope that it will be useful, |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
GNU General Public License for more details. |
18 |
***********************************************************************/ |
19 |
|
20 |
#ifndef OB_GENERIC_H |
21 |
#define OB_GENERIC_H |
22 |
|
23 |
#include "config.h" |
24 |
|
25 |
#include <string> |
26 |
#include <vector> |
27 |
#include <map> |
28 |
|
29 |
namespace OpenBabel |
30 |
{ |
31 |
|
32 |
class OBAtom; |
33 |
class OBBond; |
34 |
class OBRing; |
35 |
|
36 |
OBAPI void Trim(std::string& txt); |
37 |
|
38 |
//! \brief Classification of data stored via OBGenericData class and subclasses. |
39 |
//! |
40 |
//! OBGenericDataType can be used as a faster, direct access to a particular category |
41 |
//! instead of the slower access via GetData(std::string), which must loop |
42 |
//! through all data to find a match with the supplied key. It is implemented |
43 |
//! as a set of unsigned integer constants for maximum flexibility and future |
44 |
//! expansion. |
45 |
//! |
46 |
//! CustomData0 through CustomData15 are data slots that are not used in |
47 |
//! OpenBabel directly and are meant for use in derivative programs. |
48 |
//! Macro definitions can be used to define what each data slot is used in your code. |
49 |
namespace OBGenericDataType |
50 |
{ |
51 |
//! Unknown data type (default) |
52 |
static const unsigned int UndefinedData = 0; |
53 |
|
54 |
//! Arbitrary key/value data, i.e., OBPairData |
55 |
static const unsigned int PairData = 1; |
56 |
|
57 |
//! Energetics data (e.g., total energy, heat of formation, etc.) |
58 |
static const unsigned int EnergyData = 2; |
59 |
|
60 |
//! Storing text comments (one per molecule, atom, bond, etc.) (for other data, e.g., author, keyword, ... use OBPairData) |
61 |
static const unsigned int CommentData = 3; |
62 |
|
63 |
//! Arbitrary information about conformers, i.e., OBConformerData |
64 |
static const unsigned int ConformerData = 4; |
65 |
|
66 |
//! Bond data external to OpenBabel, i.e., OBExternalBond, OBExternalBondData |
67 |
static const unsigned int ExternalBondData = 5; |
68 |
|
69 |
//! Information for generating & manipulating rotamers, i.e. OBRotamerList |
70 |
static const unsigned int RotamerList = 6; |
71 |
|
72 |
//! Info. for storing bonds to atoms yet to be added, i.e. OBVirtualBond |
73 |
static const unsigned int VirtualBondData = 7; |
74 |
|
75 |
//! Information on rings in a molecule, i.e., OBRingData |
76 |
static const unsigned int RingData = 8; |
77 |
|
78 |
//! Information about torsion/dihedral angles, i.e., OBTorsionData and OBTorsion |
79 |
static const unsigned int TorsionData = 9; |
80 |
|
81 |
//! Bond angles in a molecule, i.e., OBAngle, OBAngleData |
82 |
static const unsigned int AngleData = 10; |
83 |
|
84 |
//! Residue serial numbers |
85 |
static const unsigned int SerialNums = 11; |
86 |
|
87 |
//! Crystallographic unit cell data, i.e., OBUnitCell |
88 |
static const unsigned int UnitCell = 12; |
89 |
|
90 |
//! Spin data, including NMR, atomic and molecular spin, etc. |
91 |
static const unsigned int SpinData = 13; |
92 |
|
93 |
//! Arbitrary partial and total charges, dipole moments, etc. |
94 |
static const unsigned int ChargeData = 14; |
95 |
|
96 |
//! Symmetry data -- point and space groups, transforms, etc. i.e., OBSymmetryData |
97 |
static const unsigned int SymmetryData = 15; |
98 |
|
99 |
//! Arbitrary chiral information (atom, bond, molecule, etc.) i.e., OBChiralData |
100 |
static const unsigned int ChiralData = 16; |
101 |
|
102 |
//! Atomic and molecular occupation data |
103 |
static const unsigned int OccupationData = 17; |
104 |
|
105 |
//! Density (cube) data and surfaces |
106 |
static const unsigned int DensityData = 18; |
107 |
|
108 |
//! Electronic levels, redox states, orbitals, etc. |
109 |
static const unsigned int ElectronicData = 19; |
110 |
|
111 |
//! Vibrational modes, frequencies, etc. |
112 |
static const unsigned int VibrationData = 20; |
113 |
|
114 |
//! Rotational energy information |
115 |
static const unsigned int RotationData = 21; |
116 |
|
117 |
//! Nuclear transitions (e.g., decay, fission, fusion) |
118 |
static const unsigned int NuclearData = 22; |
119 |
|
120 |
// space for up to 2^14 more entries... |
121 |
|
122 |
//! Custom (user-defined data) |
123 |
static const unsigned int CustomData0 = 16384; |
124 |
static const unsigned int CustomData1 = 16385; |
125 |
static const unsigned int CustomData2 = 16386; |
126 |
static const unsigned int CustomData3 = 16387; |
127 |
static const unsigned int CustomData4 = 16388; |
128 |
static const unsigned int CustomData5 = 16389; |
129 |
static const unsigned int CustomData6 = 16390; |
130 |
static const unsigned int CustomData7 = 16391; |
131 |
static const unsigned int CustomData8 = 16392; |
132 |
static const unsigned int CustomData9 = 16393; |
133 |
static const unsigned int CustomData10 = 16394; |
134 |
static const unsigned int CustomData11 = 16395; |
135 |
static const unsigned int CustomData12 = 16396; |
136 |
static const unsigned int CustomData13 = 16397; |
137 |
static const unsigned int CustomData14 = 16398; |
138 |
static const unsigned int CustomData15 = 16399; |
139 |
} // end namespace |
140 |
|
141 |
//! \brief Base class for generic data |
142 |
// class introduction in generic.cpp |
143 |
class OBAPI OBGenericData |
144 |
{ |
145 |
protected: |
146 |
std::string _attr; //!< attribute tag (e.g., "UnitCell", "Comment" or "Author") |
147 |
unsigned int _type; //!< attribute type -- declared for each subclass |
148 |
public: |
149 |
OBGenericData(); |
150 |
OBGenericData(const OBGenericData&); |
151 |
virtual ~OBGenericData() {} |
152 |
OBGenericData& operator=(const OBGenericData &src); |
153 |
|
154 |
void SetAttribute(const std::string &v) |
155 |
{ _attr = v; } |
156 |
virtual const std::string &GetAttribute() const |
157 |
{ return(_attr); } |
158 |
unsigned int GetDataType() const |
159 |
{ return(_type); } |
160 |
}; |
161 |
|
162 |
//! Used to store a comment string (can be multiple lines long) |
163 |
class OBAPI OBCommentData : public OBGenericData |
164 |
{ |
165 |
protected: |
166 |
std::string _data; |
167 |
public: |
168 |
OBCommentData(); |
169 |
OBCommentData(const OBCommentData&); |
170 |
OBCommentData& operator=(const OBCommentData &src); |
171 |
|
172 |
void SetData(const std::string &data) |
173 |
{ _data = data; Trim(_data); } |
174 |
void SetData(const char *d) |
175 |
{_data = d; Trim(_data); } |
176 |
const std::string &GetData() const |
177 |
{ return(_data); } |
178 |
}; |
179 |
|
180 |
//! \brief Used to store information on an external bond |
181 |
//! (e.g., SMILES fragments) |
182 |
class OBAPI OBExternalBond |
183 |
{ |
184 |
int _idx; |
185 |
OBAtom *_atom; |
186 |
OBBond *_bond; |
187 |
public: |
188 |
OBExternalBond() {} |
189 |
OBExternalBond(OBAtom *,OBBond *,int); |
190 |
OBExternalBond(const OBExternalBond &); |
191 |
~OBExternalBond() {} |
192 |
|
193 |
int GetIdx() const { return(_idx); } |
194 |
OBAtom *GetAtom() const { return(_atom); } |
195 |
OBBond *GetBond() const { return(_bond); } |
196 |
void SetIdx(int idx) { _idx = idx; } |
197 |
void SetAtom(OBAtom *atom) { _atom = atom; } |
198 |
void SetBond(OBBond *bond) { _bond = bond; } |
199 |
}; |
200 |
|
201 |
//! \brief Used to store information on external bonds (e.g., in SMILES fragments) |
202 |
class OBAPI OBExternalBondData : public OBGenericData |
203 |
{ |
204 |
protected: |
205 |
std::vector<OBExternalBond> _vexbnd; |
206 |
public: |
207 |
OBExternalBondData(); |
208 |
void SetData(OBAtom*,OBBond*,int); |
209 |
std::vector<OBExternalBond> *GetData() |
210 |
{ |
211 |
return(&_vexbnd); |
212 |
} |
213 |
}; |
214 |
|
215 |
//! \brief Used to store arbitrary attribute/value relationships. |
216 |
//! |
217 |
//! Ideal for arbitrary text descriptors for molecules, atoms, bonds, residues, |
218 |
//! e.g. in QSAR. |
219 |
class OBAPI OBPairData : public OBGenericData |
220 |
{ |
221 |
protected: |
222 |
std::string _value; |
223 |
public: |
224 |
OBPairData(); |
225 |
void SetValue(const char *v) |
226 |
{ |
227 |
_value = v; |
228 |
} |
229 |
void SetValue(const std::string &v) |
230 |
{ |
231 |
_value = v; |
232 |
} |
233 |
std::string &GetValue() |
234 |
{ |
235 |
return(_value); |
236 |
} |
237 |
}; |
238 |
|
239 |
//! \brief Used to temporarily store bonds that reference |
240 |
//! an atom that has not yet been added to a molecule |
241 |
class OBAPI OBVirtualBond : public OBGenericData |
242 |
{ |
243 |
protected: |
244 |
int _bgn; |
245 |
int _end; |
246 |
int _ord; |
247 |
int _stereo; |
248 |
public: |
249 |
OBVirtualBond(); |
250 |
OBVirtualBond(int,int,int,int stereo=0); |
251 |
int GetBgn() |
252 |
{ |
253 |
return(_bgn); |
254 |
} |
255 |
int GetEnd() |
256 |
{ |
257 |
return(_end); |
258 |
} |
259 |
int GetOrder() |
260 |
{ |
261 |
return(_ord); |
262 |
} |
263 |
int GetStereo() |
264 |
{ |
265 |
return(_stereo); |
266 |
} |
267 |
}; |
268 |
|
269 |
//! Used to store the SSSR set (filled in by OBMol::GetSSSR()) |
270 |
class OBAPI OBRingData : public OBGenericData |
271 |
{ |
272 |
protected: |
273 |
std::vector<OBRing*> _vr; |
274 |
public: |
275 |
OBRingData(); |
276 |
OBRingData(const OBRingData &); |
277 |
~OBRingData(); |
278 |
|
279 |
OBRingData &operator=(const OBRingData &); |
280 |
|
281 |
void SetData(std::vector<OBRing*> &vr) |
282 |
{ |
283 |
_vr = vr; |
284 |
} |
285 |
void PushBack(OBRing *r) |
286 |
{ |
287 |
_vr.push_back(r); |
288 |
} |
289 |
std::vector<OBRing*> &GetData() |
290 |
{ |
291 |
return(_vr); |
292 |
} |
293 |
}; |
294 |
|
295 |
//! \brief Used for storing information about periodic boundary conditions |
296 |
//! with conversion to/from translation vectors and |
297 |
//! (a, b, c, alpha, beta, gamma) |
298 |
class OBAPI OBUnitCell: public OBGenericData |
299 |
{ |
300 |
protected: |
301 |
double _a, _b, _c, _alpha, _beta, _gamma; |
302 |
vector3 _offset; //!< offset for origin |
303 |
vector3 _v1, _v2, _v3; //!< translation vectors |
304 |
std::string _spaceGroup; |
305 |
public: |
306 |
OBUnitCell(); |
307 |
OBUnitCell(const OBUnitCell &); |
308 |
~OBUnitCell() {} |
309 |
|
310 |
OBUnitCell &operator=(const OBUnitCell &); |
311 |
|
312 |
void SetData(const double a, const double b, const double c, |
313 |
const double alpha, const double beta, const double gamma) |
314 |
{ _a = a; _b = b; _c = c; |
315 |
_alpha = alpha; _beta = beta; _gamma = gamma; } |
316 |
void SetData(const vector3 v1, const vector3 v2, const vector3 v3); |
317 |
void SetOffset(const vector3 v1) { _offset = v1; } |
318 |
//! Set the space group symbol for this unit cell. |
319 |
//! Does not create an OBSymmetryData entry or attempt to convert |
320 |
//! between different symbol notations |
321 |
void SetSpaceGroup(const std::string sg) { _spaceGroup = sg; } |
322 |
|
323 |
double GetA() { return(_a); } |
324 |
double GetB() { return(_b); } |
325 |
double GetC() { return(_c); } |
326 |
double GetAlpha(){ return(_alpha);} |
327 |
double GetBeta() { return(_beta); } |
328 |
double GetGamma(){ return(_gamma);} |
329 |
vector3 GetOffset() { return(_offset); } |
330 |
const std::string GetSpaceGroup() { return(_spaceGroup); } |
331 |
|
332 |
//! \return v1, v2, v3 cell vectors |
333 |
std::vector<vector3> GetCellVectors(); |
334 |
//! \return v1, v2, v3 cell vectors as a 3x3 matrix |
335 |
matrix3x3 GetCellMatrix(); |
336 |
//! \return The orthogonalization matrix, used for converting from fractional to Cartesian coords. |
337 |
matrix3x3 GetOrthoMatrix(); |
338 |
//! \return The fractionalization matrix, used for converting from Cartesian to fractional coords. |
339 |
matrix3x3 GetFractionalMatrix(); |
340 |
}; |
341 |
|
342 |
//! \brief Used to hold data on conformers or geometry optimization steps |
343 |
class OBAPI OBConformerData: public OBGenericData |
344 |
{ |
345 |
protected: |
346 |
//! Dimensionalities of conformers |
347 |
std::vector<unsigned short> _vDimension; |
348 |
//! Relative energies of conformers (preferably in kJ/mol) |
349 |
std::vector<double> _vEnergies; |
350 |
//! Atomic forces for each conformer |
351 |
std::vector< std::vector< vector3 > > _vForces; |
352 |
//! Atomic velocities for each conformer (e.g., trajectories) |
353 |
std::vector< std::vector< vector3 > > _vVelocity; |
354 |
//! Atomic displacements for each conformer (e.g., RMS distances) |
355 |
std::vector< std::vector< vector3 > > _vDisplace; |
356 |
//! Additional data (as strings) |
357 |
std::vector<std::string> _vData; |
358 |
|
359 |
public: |
360 |
OBConformerData(); |
361 |
OBConformerData(const OBConformerData &); |
362 |
~OBConformerData() {} |
363 |
|
364 |
OBConformerData &operator=(const OBConformerData &); |
365 |
|
366 |
void SetDimension(std::vector<unsigned short> vd) { _vDimension = vd; } |
367 |
void SetEnergies(std::vector<double> ve) { _vEnergies = ve; } |
368 |
void SetForces(std::vector< std::vector< vector3 > > vf) {_vForces = vf;} |
369 |
void SetVelocities(std::vector< std::vector< vector3 > > vv) |
370 |
{ _vVelocity = vv; } |
371 |
void SetDisplacements(std::vector< std::vector< vector3 > > vd) |
372 |
{ _vDisplace = vd; } |
373 |
void SetData(std::vector<std::string> vdat) { _vData = vdat; } |
374 |
|
375 |
std::vector<unsigned short> GetDimension() { return _vDimension; } |
376 |
std::vector<double> GetEnergies() { return _vEnergies; } |
377 |
std::vector< std::vector< vector3 > > GetForces() {return _vForces; } |
378 |
std::vector< std::vector< vector3 > > GetVelocities() |
379 |
{return _vVelocity;} |
380 |
std::vector< std::vector< vector3 > > GetDisplacements() |
381 |
{return _vDisplace;} |
382 |
std::vector<std::string> GetData() { return _vData; } |
383 |
|
384 |
}; |
385 |
|
386 |
//! \brief Used to hold the point-group and/or space-group symmetry |
387 |
//! \todo Add support for translation between symbol notations. |
388 |
//! Add symmetry perception routines. |
389 |
class OBAPI OBSymmetryData: public OBGenericData |
390 |
{ |
391 |
protected: |
392 |
std::string _spaceGroup; |
393 |
std::string _pointGroup; |
394 |
public: |
395 |
OBSymmetryData(); |
396 |
OBSymmetryData(const OBSymmetryData &); |
397 |
~OBSymmetryData() {} |
398 |
|
399 |
OBSymmetryData &operator=(const OBSymmetryData &); |
400 |
|
401 |
void SetData(std::string pg, std::string sg = "") |
402 |
{ _pointGroup = pg; _spaceGroup = sg; } |
403 |
void SetPointGroup(std::string pg) { _pointGroup = pg; } |
404 |
void SetSpaceGroup(std::string sg) { _spaceGroup = sg; } |
405 |
|
406 |
std::string GetPointGroup() { return _pointGroup; } |
407 |
std::string GetSpaceGroup() { return _spaceGroup; } |
408 |
}; |
409 |
|
410 |
//! \brief Used to hold the torsion data for a single rotatable bond |
411 |
//! and all four atoms around it |
412 |
class OBAPI OBTorsion |
413 |
{ |
414 |
friend class OBMol; |
415 |
friend class OBTorsionData; |
416 |
|
417 |
protected: |
418 |
std::pair<OBAtom*,OBAtom*> _bc; |
419 |
//! double is angle in rads |
420 |
std::vector<triple<OBAtom*,OBAtom*,double> > _ads; |
421 |
|
422 |
OBTorsion() |
423 |
{ |
424 |
_bc.first=0; |
425 |
_bc.second=0; |
426 |
} |
427 |
; //protected for use only by friend classes |
428 |
OBTorsion(OBAtom *, OBAtom *, OBAtom *, OBAtom *); |
429 |
|
430 |
std::vector<quad<OBAtom*,OBAtom*,OBAtom*,OBAtom*> > GetTorsions(); |
431 |
|
432 |
public: |
433 |
OBTorsion(const OBTorsion &); |
434 |
~OBTorsion() |
435 |
{} |
436 |
|
437 |
OBTorsion& operator=(const OBTorsion &); |
438 |
|
439 |
void Clear(); |
440 |
bool Empty() |
441 |
{ |
442 |
return(_bc.first == 0 && _bc.second == 0); |
443 |
} |
444 |
|
445 |
bool AddTorsion(OBAtom *a,OBAtom *b, OBAtom *c,OBAtom *d); |
446 |
bool AddTorsion(quad<OBAtom*,OBAtom*,OBAtom*,OBAtom*> &atoms); |
447 |
|
448 |
bool SetAngle(double radians, unsigned int index = 0); |
449 |
bool SetData(OBBond *bond); |
450 |
|
451 |
bool GetAngle(double &radians, unsigned int index =0); |
452 |
unsigned int GetBondIdx(); |
453 |
unsigned int GetSize() const |
454 |
{ |
455 |
return (unsigned int)_ads.size(); |
456 |
} |
457 |
|
458 |
std::pair<OBAtom*,OBAtom*> GetBC() |
459 |
{ |
460 |
return(_bc); |
461 |
} |
462 |
std::vector<triple<OBAtom*,OBAtom*,double> > GetADs() |
463 |
{ |
464 |
return(_ads) ; |
465 |
} |
466 |
|
467 |
bool IsProtonRotor(); |
468 |
}; |
469 |
|
470 |
//! \brief Used to hold torsions as generic data for OBMol. |
471 |
//! Filled by OBMol::FindTorsions() |
472 |
class OBAPI OBTorsionData : public OBGenericData |
473 |
{ |
474 |
friend class OBMol; |
475 |
|
476 |
protected: |
477 |
std::vector<OBTorsion> _torsions; |
478 |
|
479 |
OBTorsionData(); |
480 |
OBTorsionData(const OBTorsionData &); |
481 |
|
482 |
public: |
483 |
OBTorsionData &operator=(const OBTorsionData &); |
484 |
|
485 |
void Clear(); |
486 |
|
487 |
std::vector<OBTorsion> GetData() const |
488 |
{ |
489 |
return _torsions; |
490 |
} |
491 |
unsigned int GetSize() const |
492 |
{ |
493 |
return (unsigned int)_torsions.size(); |
494 |
} |
495 |
|
496 |
void SetData(OBTorsion &torsion); |
497 |
|
498 |
bool FillTorsionArray(std::vector<std::vector<unsigned int> > &torsions); |
499 |
}; |
500 |
|
501 |
//! Used to hold the 3 atoms in an angle and the angle itself |
502 |
class OBAPI OBAngle |
503 |
{ |
504 |
friend class OBMol; |
505 |
friend class OBAngleData; |
506 |
|
507 |
protected: |
508 |
|
509 |
//member data |
510 |
|
511 |
OBAtom *_vertex; |
512 |
std::pair<OBAtom*,OBAtom*> _termini; |
513 |
double _radians; |
514 |
|
515 |
//protected member functions |
516 |
|
517 |
OBAngle(); //protect constructor for use only by friend classes |
518 |
OBAngle(OBAtom *vertex,OBAtom *a,OBAtom *b); |
519 |
|
520 |
triple<OBAtom*,OBAtom*,OBAtom*> GetAtoms(); |
521 |
void SortByIndex(); |
522 |
|
523 |
public: |
524 |
|
525 |
OBAngle(const OBAngle &); |
526 |
~OBAngle() |
527 |
{ |
528 |
_vertex = NULL; |
529 |
} |
530 |
|
531 |
OBAngle &operator = (const OBAngle &); |
532 |
bool operator ==(const OBAngle &); |
533 |
|
534 |
void Clear(); |
535 |
|
536 |
double GetAngle() const |
537 |
{ |
538 |
return(_radians); |
539 |
} |
540 |
|
541 |
void SetAngle(double radians) |
542 |
{ |
543 |
_radians = radians; |
544 |
} |
545 |
void SetAtoms(OBAtom *vertex,OBAtom *a,OBAtom *b); |
546 |
void SetAtoms(triple<OBAtom*,OBAtom*,OBAtom*> &atoms); |
547 |
|
548 |
}; |
549 |
|
550 |
|
551 |
//! \brief Used to hold all angles in a molecule as generic data for OBMol |
552 |
class OBAPI OBAngleData : public OBGenericData |
553 |
{ |
554 |
friend class OBMol; |
555 |
|
556 |
protected: |
557 |
std::vector<OBAngle> _angles; |
558 |
|
559 |
OBAngleData(); |
560 |
OBAngleData(const OBAngleData &); |
561 |
std::vector<OBAngle> GetData() const |
562 |
{ |
563 |
return(_angles); |
564 |
} |
565 |
|
566 |
public: |
567 |
OBAngleData &operator =(const OBAngleData &); |
568 |
|
569 |
void Clear(); |
570 |
unsigned int FillAngleArray(int **angles, unsigned int &size); |
571 |
void SetData(OBAngle &); |
572 |
unsigned int GetSize() const |
573 |
{ |
574 |
return (unsigned int)_angles.size(); |
575 |
} |
576 |
}; |
577 |
|
578 |
enum atomreftype{output,input,calcvolume}; // sets which atom4ref is accessed |
579 |
|
580 |
//! \brief Used to hold chiral inforamtion about the atom as OBGenericData |
581 |
class OBAPI OBChiralData : public OBGenericData |
582 |
{ |
583 |
friend class OBMol; |
584 |
friend class OBAtom; |
585 |
|
586 |
protected: |
587 |
std::vector<unsigned int> _atom4refs; |
588 |
int parity; |
589 |
std::vector<unsigned int> _atom4refo; |
590 |
std::vector<unsigned int> _atom4refc; |
591 |
|
592 |
public: |
593 |
std::vector<unsigned int> GetAtom4Refs(atomreftype t) const; |
594 |
unsigned int GetAtomRef(int a,atomreftype t); |
595 |
|
596 |
OBChiralData(); |
597 |
OBChiralData(const OBChiralData &src); |
598 |
OBChiralData &operator =(const OBChiralData &); |
599 |
~OBChiralData(){} |
600 |
|
601 |
void Clear(); |
602 |
bool SetAtom4Refs(std::vector<unsigned int> atom4refs, atomreftype t); |
603 |
int AddAtomRef(unsigned int atomref, atomreftype t); |
604 |
unsigned int GetSize(atomreftype t) const; |
605 |
}; |
606 |
|
607 |
//! Defines a map between serial numbers (e.g., in a PDB file) and OBAtom objects |
608 |
class OBSerialNums : public OBGenericData |
609 |
{ |
610 |
protected: |
611 |
std::map<int, OBAtom*> _serialMap; |
612 |
|
613 |
public: |
614 |
|
615 |
OBSerialNums() |
616 |
{ |
617 |
_attr = "obSerialNums"; |
618 |
_type = OBGenericDataType::SerialNums; |
619 |
} |
620 |
OBSerialNums(const OBSerialNums &cp) : OBGenericData(cp) |
621 |
{ |
622 |
_serialMap = cp._serialMap; |
623 |
} |
624 |
|
625 |
std::map<int,OBAtom*> &GetData() { return _serialMap; } |
626 |
void SetData(std::map<int,OBAtom*> &sm) { _serialMap = sm; } |
627 |
|
628 |
}; |
629 |
|
630 |
//****************doxygen for inline functions*********** |
631 |
/*! |
632 |
**\fn OBTorsionData::GetSize() const |
633 |
**\brief Gets the number of torsion structs |
634 |
**\return integer count of the number of torsions |
635 |
*/ |
636 |
|
637 |
/*! |
638 |
**\fn OBTorsionData::GetData() const |
639 |
**\brief Gets a vector of the OBTorsions |
640 |
**\return the vector of torsions |
641 |
*/ |
642 |
|
643 |
/*! |
644 |
**\fn OBAngleData::GetSize() const |
645 |
**\brief Gets the number of angles |
646 |
**\return integer count of the number of angles |
647 |
*/ |
648 |
|
649 |
/*! |
650 |
**\fn OBAngleData::GetData() const |
651 |
**\brief Gets the angle vector data |
652 |
**\return pointer to vector<OBAngle> |
653 |
*/ |
654 |
|
655 |
/*! |
656 |
**\fn OBAngle::SetAngle(double angle) |
657 |
**\brief Sets the OBAngle angle value |
658 |
**\param angle in radians |
659 |
*/ |
660 |
|
661 |
/*! |
662 |
**\fn OBAngle::GetAngle() const |
663 |
**\brief Gets the OBAngle angle value |
664 |
**\return angle in radians |
665 |
*/ |
666 |
|
667 |
/*! |
668 |
**\fn OBTorsion::GetBondIdx() |
669 |
**\brief Gets the bond index of the central bond |
670 |
**\return int bond index |
671 |
*/ |
672 |
|
673 |
/*! |
674 |
**\fn OBTorsion::GetBC() |
675 |
**\brief Gets the two central atoms of ABCD torsion |
676 |
**\return pair<OBAtom*,OBAtom*> |
677 |
*/ |
678 |
|
679 |
/*! |
680 |
**\fn OBTorsion::GetADs() |
681 |
**\brief Gets the vector of distal atoms of ABCD torsion |
682 |
**\return vector of A,D atom pointers and a double |
683 |
*/ |
684 |
|
685 |
} //end namespace OpenBabel |
686 |
|
687 |
#endif // OB_GENERIC_H |
688 |
|
689 |
//! \file generic.h |
690 |
//! \brief Handle generic data classes. Custom data for atoms, bonds, etc. |