BALL 1.5.0
bond.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_KERNEL_BOND_H
6#define BALL_KERNEL_BOND_H
7
8#ifndef BALL_CONCEPT_PROPERTY_H
10#endif
11
12#ifndef BALL_CONCEPT_COMPOSITE_H
14#endif
15
16#ifndef BALL_CONCEPT_ATOMCONTAINER_H
18#endif
19
20#define BALL_BOND_DEFAULT_FIRST_ATOM 0
21#define BALL_BOND_DEFAULT_SECOND_ATOM 0
22#define BALL_BOND_DEFAULT_NAME ""
23#define BALL_BOND_DEFAULT_ORDER ORDER__UNKNOWN
24#define BALL_BOND_DEFAULT_TYPE TYPE__UNKNOWN
25
26
27namespace BALL
28{
29 class Atom;
30 class Fragment;
31 class System;
32
55 : public Composite,
56 public PropertyManager
57 {
58 public:
59
61 friend class Atom;
62
64
65
68
69
73 : public Exception::GeneralException
74 {
75 public:
76 NotBound(const char* file, int line);
77 };
79
83
86 typedef short Order;
87 typedef short Type;
88
90
93
97 {
99 ORDER__UNKNOWN = 0,
101 ORDER__SINGLE = 1,
103 ORDER__DOUBLE = 2,
105 ORDER__TRIPLE = 3,
107 ORDER__QUADRUPLE = 4,
109 ORDER__AROMATIC = 5,
111 ORDER__ANY = 6,
113 NUMBER_OF_BOND_ORDERS
114 };
115
121 {
123 TYPE__UNKNOWN = 0,
125 TYPE__COVALENT = 1,
127 TYPE__HYDROGEN = 2,
129 TYPE__DISULPHIDE_BRIDGE = 3,
131 TYPE__SALT_BRIDGE = 4,
133 TYPE__PEPTIDE = 5,
135 NUMBER_OF_BOND_TYPES
136 };
137
142 {
144 IS_AROMATIC = 0,
146 NUMBER_OF_PROPERTIES
147 };
149
153
163
175 Bond(const Bond& bond, bool deep = true);
176
186 Bond(const String& name, Atom& first, Atom& second, Order order = BALL_BOND_DEFAULT_ORDER,
188
198 static Bond* createBond(Bond& bond, Atom& first, Atom& second);
199
203 virtual ~Bond();
204
214 virtual void clear();
215
223 virtual void destroy();
225
229
233 void persistentWrite(PersistenceManager& pm, const char* name = 0) const;
234
239
244 void finalize();
246
251 bool operator == (const Bond& bond) const;
252
254 bool operator != (const Bond& bond) const;
256
260
270 Bond& operator = (const Bond& bond);
271
276 void swap(Bond& bond);
278
282
287 void setFirstAtom(Atom* atom);
292 void setSecondAtom(Atom* atom);
293
295 const Atom* getFirstAtom() const;
298
300 const Atom* getSecondAtom() const;
303
311 Atom* getPartner(const Atom& atom) const;
312
314 void setName(const String& name);
315
317 const String& getName() const;
318
320 void setOrder(Order bond_order);
321
324
330 bool isAromatic() const;
331
333 void setType(Type bond_type);
334
336 Type getType() const;
337
342 float getLength() const;
343
349 const Atom* getBoundAtom(const Atom& atom) const;
350
356 Atom* getBoundAtom(const Atom& atom);
358
362
370 bool isBondOf(const Atom& atom) const;
371
377 bool isBound() const;
378
386 bool isInterBond() const;
387
396 bool isInterBondOf(const AtomContainer& atom_container) const;
397
406 bool isIntraBond() const;
407
416 bool isIntraBondOf(const AtomContainer& atom_container) const;
417
419
423
428 virtual bool isValid() const;
429
436 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
438
439 protected:
440
444
445 // First atom of the bond (bond owner)
447
448 // Second atom
450
451 // Bond name
453
454 // Bond order
456
457 // Bond type
460
461 private:
462
463 void arrangeBonds_();
464 void clear_();
465 };
466
467# ifndef BALL_NO_INLINE_FUNCTIONS
468# include <BALL/KERNEL/bond.iC>
469# endif
470} // namespace BALL
471
472#endif // BALL_KERNEL_BOND_H
473
#define BALL_BOND_DEFAULT_TYPE
Definition: bond.h:24
#define BALL_BOND_DEFAULT_ORDER
Definition: bond.h:23
#define BALL_CREATE_DEEP(name)
Definition: create.h:26
Definition: constants.h:13
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
char Atom[5]
Definition: PDBdefs.h:257
const Atom * getFirstAtom() const
Return a pointer to the first atom.
void setSecondAtom(Atom *atom)
Atom * getSecondAtom()
Return a pointer to the second atom.
String name_
Definition: bond.h:452
Bond(const Bond &bond, bool deep=true)
Atom * first_
Definition: bond.h:446
bool isIntraBondOf(const AtomContainer &atom_container) const
void persistentWrite(PersistenceManager &pm, const char *name=0) const
bool isAromatic() const
short Type
Definition: bond.h:87
Type getType() const
Return the bond type.
void setType(Type bond_type)
Set the bond type.
Type bond_type_
Definition: bond.h:458
Property
Definition: bond.h:142
bool isInterBond() const
Atom * getFirstAtom()
Return a pointer to the first atom.
void persistentRead(PersistenceManager &pm)
const String & getName() const
Return the atom name.
Bond(const String &name, Atom &first, Atom &second, Order order=BALL_BOND_DEFAULT_ORDER, Type type=BALL_BOND_DEFAULT_TYPE)
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
virtual ~Bond()
void finalize()
virtual bool isValid() const
static Bond * createBond(Bond &bond, Atom &first, Atom &second)
BondType
Definition: bond.h:121
bool isIntraBond() const
Atom * getPartner(const Atom &atom) const
float getLength() const
Order getOrder() const
Return the bond order.
void setFirstAtom(Atom *atom)
void swap(Bond &bond)
const Atom * getSecondAtom() const
Return a pointer to the second atom.
Atom * second_
Definition: bond.h:449
const Atom * getBoundAtom(const Atom &atom) const
virtual void clear()
bool isInterBondOf(const AtomContainer &atom_container) const
bool isBondOf(const Atom &atom) const
BondOrder
Definition: bond.h:97
void setName(const String &name)
Assign the atom name.
Order bond_order_
Definition: bond.h:455
bool isBound() const
virtual void destroy()
void setOrder(Order bond_order)
Assign the bond order.
short Order
Definition: bond.h:86
Atom * getBoundAtom(const Atom &atom)
NotBound(const char *file, int line)
#define BALL_EXPORT
Definition: COMMON/global.h:50