BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_KERNEL_BOND_H 00006 #define BALL_KERNEL_BOND_H 00007 00008 #ifndef BALL_CONCEPT_PROPERTY_H 00009 # include <BALL/CONCEPT/property.h> 00010 #endif 00011 00012 #ifndef BALL_CONCEPT_COMPOSITE_H 00013 # include <BALL/CONCEPT/composite.h> 00014 #endif 00015 00016 #ifndef BALL_CONCEPT_ATOMCONTAINER_H 00017 # include <BALL/KERNEL/atomContainer.h> 00018 #endif 00019 00020 #define BALL_BOND_DEFAULT_FIRST_ATOM 0 00021 #define BALL_BOND_DEFAULT_SECOND_ATOM 0 00022 #define BALL_BOND_DEFAULT_NAME "" 00023 #define BALL_BOND_DEFAULT_ORDER ORDER__UNKNOWN 00024 #define BALL_BOND_DEFAULT_TYPE TYPE__UNKNOWN 00025 00026 00027 namespace BALL 00028 { 00029 class Atom; 00030 class Fragment; 00031 class System; 00032 00054 class BALL_EXPORT Bond 00055 : public Composite, 00056 public PropertyManager 00057 { 00058 public: 00059 00061 friend class Atom; 00062 00063 BALL_CREATE_DEEP(Bond) 00064 00065 00068 00072 class BALL_EXPORT NotBound 00073 : public Exception::GeneralException 00074 { 00075 public: 00076 NotBound(const char* file, int line); 00077 }; 00079 00083 00086 typedef short Order; 00087 typedef short Type; 00088 00090 00093 00096 enum BondOrder 00097 { 00099 ORDER__UNKNOWN = 0, 00101 ORDER__SINGLE = 1, 00103 ORDER__DOUBLE = 2, 00105 ORDER__TRIPLE = 3, 00107 ORDER__QUADRUPLE = 4, 00109 ORDER__AROMATIC = 5, 00111 ORDER__ANY = 6, 00113 NUMBER_OF_BOND_ORDERS 00114 }; 00115 00120 enum BondType 00121 { 00123 TYPE__UNKNOWN = 0, 00125 TYPE__COVALENT = 1, 00127 TYPE__HYDROGEN = 2, 00129 TYPE__DISULPHIDE_BRIDGE = 3, 00131 TYPE__SALT_BRIDGE = 4, 00133 TYPE__PEPTIDE = 5, 00135 NUMBER_OF_BOND_TYPES 00136 }; 00137 00141 enum Property 00142 { 00144 IS_AROMATIC = 0, 00146 NUMBER_OF_PROPERTIES 00147 }; 00149 00153 00162 Bond(); 00163 00175 Bond(const Bond& bond, bool deep = true); 00176 00186 Bond(const String& name, Atom& first, Atom& second, Order order = BALL_BOND_DEFAULT_ORDER, 00187 Type type = BALL_BOND_DEFAULT_TYPE); 00188 00198 static Bond* createBond(Bond& bond, Atom& first, Atom& second); 00199 00203 virtual ~Bond(); 00204 00214 virtual void clear(); 00215 00223 virtual void destroy(); 00225 00229 00233 void persistentWrite(PersistenceManager& pm, const char* name = 0) const; 00234 00238 void persistentRead(PersistenceManager& pm); 00239 00244 void finalize(); 00246 00250 00251 bool operator == (const Bond& bond) const; 00252 00254 bool operator != (const Bond& bond) const; 00256 00260 00270 Bond& operator = (const Bond& bond); 00271 00276 void swap(Bond& bond); 00278 00282 00287 void setFirstAtom(Atom* atom); 00292 void setSecondAtom(Atom* atom); 00293 00295 const Atom* getFirstAtom() const; 00297 Atom* getFirstAtom(); 00298 00300 const Atom* getSecondAtom() const; 00302 Atom* getSecondAtom(); 00303 00311 Atom* getPartner(const Atom& atom) const; 00312 00314 void setName(const String& name); 00315 00317 const String& getName() const; 00318 00320 void setOrder(Order bond_order); 00321 00323 Order getOrder() const; 00324 00330 bool isAromatic() const; 00331 00333 void setType(Type bond_type); 00334 00336 Type getType() const; 00337 00342 float getLength() const; 00343 00349 const Atom* getBoundAtom(const Atom& atom) const; 00350 00356 Atom* getBoundAtom(const Atom& atom); 00358 00362 00370 bool isBondOf(const Atom& atom) const; 00371 00377 bool isBound() const; 00378 00386 bool isInterBond() const; 00387 00396 bool isInterBondOf(const AtomContainer& atom_container) const; 00397 00406 bool isIntraBond() const; 00407 00416 bool isIntraBondOf(const AtomContainer& atom_container) const; 00417 00419 00423 00428 virtual bool isValid() const; 00429 00436 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const; 00438 00439 protected: 00440 00444 00445 // First atom of the bond (bond owner) 00446 Atom* first_; 00447 00448 // Second atom 00449 Atom* second_; 00450 00451 // Bond name 00452 String name_; 00453 00454 // Bond order 00455 Order bond_order_; 00456 00457 // Bond type 00458 Type bond_type_; 00460 00461 private: 00462 00463 void arrangeBonds_(); 00464 void clear_(); 00465 }; 00466 00467 # ifndef BALL_NO_INLINE_FUNCTIONS 00468 # include <BALL/KERNEL/bond.iC> 00469 # endif 00470 } // namespace BALL 00471 00472 #endif // BALL_KERNEL_BOND_H 00473