BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
9 # include <BALL/CONCEPT/property.h>
10 #endif
11 
12 #ifndef BALL_CONCEPT_COMPOSITE_H
13 # include <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 
27 namespace 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 
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 
96  enum BondOrder
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 
120  enum BondType
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 
141  enum Property
142  {
144  IS_AROMATIC = 0,
146  NUMBER_OF_PROPERTIES
147  };
149 
153 
162  Bond();
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,
187  Type type = BALL_BOND_DEFAULT_TYPE);
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 
238  void persistentRead(PersistenceManager& pm);
239 
244  void finalize();
246 
250  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;
297  Atom* getFirstAtom();
298 
300  const Atom* getSecondAtom() const;
302  Atom* getSecondAtom();
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 
323  Order getOrder() const;
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 
Order bond_order_
Definition: bond.h:455
short Type
Definition: bond.h:87
BondType
Definition: bond.h:120
short Order
Definition: bond.h:86
Type bond_type_
Definition: bond.h:458
String name_
Definition: bond.h:452
#define BALL_BOND_DEFAULT_ORDER
Definition: bond.h:23
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
const char * getName()
Definition: rtti.h:97
#define BALL_CREATE_DEEP(name)
Definition: create.h:26
BondOrder
Definition: bond.h:96
BALL_EXPORT bool operator==(const String &s1, const String &s2)
Atom * first_
Definition: bond.h:446
char Atom[5]
Definition: PDBdefs.h:257
Atom * second_
Definition: bond.h:449
#define BALL_BOND_DEFAULT_TYPE
Definition: bond.h:24
Property
Definition: bond.h:141
#define BALL_EXPORT
Definition: COMMON/global.h:50