1 // BOND.H : the bond-related classes.
2 
3 // Copyright (C) 1998 Tommi Hassinen.
4 
5 // This package is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 
10 // This package is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 
15 // You should have received a copy of the GNU General Public License
16 // along with this package; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 /*################################################################################################*/
20 
21 #ifndef BOND_H
22 #define BOND_H
23 
24 #include "libghemicaldefine.h"
25 
26 class bondtype;
27 
28 class bond;
29 
30 /*################################################################################################*/
31 
32 class atom;	// atom.h
33 
34 #include "typedef.h"
35 
36 #include <list>
37 #include <vector>
38 using namespace std;
39 
40 /*################################################################################################*/
41 
42 #define BONDTYPE_CNJGTD 0
43 #define BONDTYPE_SINGLE 1
44 #define BONDTYPE_DOUBLE 2
45 #define BONDTYPE_TRIPLE 3
46 //////////////////////////////////////////////////////
47 //#define BONDTYPE_QUADRP 4	// never needed!!!
48 //////////////////////////////////////////////////////
49 
50 /// A bondtype class.
51 
52 class bondtype
53 {
54 	private:
55 
56 	i32s type;
57 
58 	static const char * string[4];
59 
60 	static const char symbol1[4];
61 	static const char symbol2[4];
62 
63 	public:
64 
65 	static bondtype current_bondtype;	///< This is the current element that user has selected.
66 
67 	public:
68 
69 	bondtype(void);
70 	bondtype(char);		///< By symbols.
71 	bondtype(i32s);		///< By number codes.
72 	~bondtype(void);
73 
74 	const char * GetString(void) const;
75 
76 	i32s GetValue(void) const;
77 	char GetSymbol1(void) const;
78 	char GetSymbol2(void) const;
79 
80 	void operator++(void);
81 	void operator--(void);
82 
83 //	friend ostream & operator<<(ostream &, bondtype &);	this is not needed...
84 };
85 
86 /*################################################################################################*/
87 
88 #define BOND_NFLAGS 3	// the number of flags can be increased if needed...
89 
90 // ABOUT FLAGS:
91 // ^^^^^^^^^^^^
92 // 0 is used generally in typerule tests.
93 // 1 is also used in "RingSize" and "Ring" typerule tests.
94 // 2 is used by sequencebuilder::FindPath() at least...
95 
96 /// A bond class.
97 /** Will store information about a bond, including the atoms that the bond connects,
98 and bondtype information. */
99 
100 class bond
101 {
102 //	protected:
103 	public:		// TODO : not properly divided in public/protected data.
104 
105 	atom * atmr[2];
106 	bondtype bt;
107 
108 	vector<bool> flags;
109 
110 /// A temporary variable used when creating molecular mechanics energy terms.
111 /** This variable is not otherwise used or initialized, and it is not saved. */
112 	i32s tmp_bt1_index;
113 
114 	bool do_not_render_TSS_fixmelater;	///< this is only for visualize breaking bonds in TSS!!!
115 
116 	public:
117 
118 	bond(void);
119 	bond(atom *, atom *, bondtype);
120 	bond(const bond &);
121 	~bond(void);
122 
123 	bool operator<(const bond &) const;	///< Using molecule numbers.
124 	bool operator==(const bond &) const;	///< Using atom pointers.
125 };
126 
127 /*################################################################################################*/
128 
129 typedef list<bond>::iterator iter_bl;		// bl = bond list
130 
131 typedef bond * ref_bond;
132 
133 /*################################################################################################*/
134 
135 #endif	// BOND_H
136 
137 // eof
138