Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
core
id
AtomID.hh
Go to the documentation of this file.
1
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2
// vi: set ts=2 noet:
3
//
4
// (c) Copyright Rosetta Commons Member Institutions.
5
// (c) This file is part of the Rosetta software suite and is made available under license.
6
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9
10
/// @file core/id/AtomID.hh
11
/// @author Phil Bradley
12
13
14
#ifndef INCLUDED_core_id_AtomID_hh
15
#define INCLUDED_core_id_AtomID_hh
16
17
// Unit headers
18
// AUTO-REMOVED #include <core/id/types.hh>
19
#include <
core/id/AtomID.fwd.hh
>
20
21
// AUTO-REMOVED #include <basic/Tracer.fwd.hh>
22
#include <utility/exit.hh>
23
// C++ headers
24
// AUTO-REMOVED #include <iosfwd>
25
26
#include <
core/types.hh
>
27
28
29
30
namespace
core {
31
namespace
id {
32
33
34
/////////////////////////////////////////////////////////////////////////////
35
// AtomID
36
/////////////////////////////////////////////////////////////////////////////
37
38
// data to uniquely specify an atom
39
// could change -- pointer?
40
41
/// @brief Atom identifier class. Defined by the atom number and the residue number.
42
class
AtomID
43
{
44
45
public
:
// Creation
46
47
/// @brief Default constructor
48
inline
49
AtomID
() :
50
atomno_
( 0 ),
51
rsd_
( 0 )
52
{};
53
54
/// @brief Copy constructor
55
inline
56
AtomID
(
AtomID
const
& src ) :
57
atomno_
( src.
atomno_
),
58
rsd_
( src.
rsd_
)
59
{}
60
61
/// @brief Property constructor
62
inline
63
AtomID
(
64
Size
const
atomno_in,
65
Size
const
rsd_in
66
) :
67
atomno_
( atomno_in ),
68
rsd_
( rsd_in )
69
{}
70
71
public
:
// Properties
72
73
/// @brief Returns the AtomID residue number
74
inline
75
Size
76
rsd
()
const
{
return
rsd_
; }
77
78
inline
79
Size
&
80
rsd
() {
return
rsd_
; }
81
82
/// @brief Returns the AtomID atom number
83
inline
84
Size
85
atomno
()
const
{
return
atomno_
; }
86
87
inline
88
Size
&
89
atomno
() {
return
atomno_
; }
90
91
/// @brief Returns true if the AtomID is valid
92
/// @note must return false for BOGUS_ATOM_ID
93
inline
94
bool
95
valid
()
const
{
return
(
atomno_
> 0 ) && (
rsd_
> 0 ); }
96
public
:
// Friends
97
98
friend
99
std::ostream &
100
operator <<
(
101
std::ostream & os,
102
AtomID
const
& a
103
);
104
105
/// @brief a and b are the same atom
106
friend
107
inline
108
bool
109
operator ==
(
110
AtomID
const
& a,
111
AtomID
const
&
b
112
) {
return
a.
atomno_
== b.
atomno_
&& a.
rsd_
== b.
rsd_
; }
113
114
/// @brief a and b are different atom
115
friend
116
inline
117
bool
118
operator !=
(
119
AtomID
const
& a,
120
AtomID
const
&
b
121
) {
return
a.
atomno_
!= b.
atomno_
|| a.
rsd_
!= b.
rsd_
; }
122
123
/// @brief a is LOWER than b (e.g., first by smaller residue index number then by smaller atom index number)
124
friend
125
inline
126
bool
127
operator <
(
128
AtomID
const
& a,
129
AtomID
const
&
b
130
)
131
{
132
return
( a.
rsd_
< b.
rsd_
||
133
( a.
rsd_
== b.
rsd_
&& a.
atomno_
< b.
atomno_
) );
134
}
135
136
private
:
// Fields
137
138
139
/// @brief Atom number within the Residue
140
Size
atomno_
;
141
142
/// @brief Residue number within the complex
143
Size
rsd_
;
144
145
146
};
// AtomID
147
148
extern
AtomID
const
BOGUS_ATOM_ID
;
149
extern
AtomID
const
CHAINBREAK_BOGUS_ATOM_ID
;
150
151
///////////////////////////////////////////////////////////////////////////////
152
/// two more classes, temporary for testing purposes
153
///////////////////////////////////////////////////////////////////////////////
154
155
class
BondID
{
156
public
:
157
158
BondID
():
159
atom1
(
BOGUS_ATOM_ID
),
160
atom2
(
BOGUS_ATOM_ID
)
161
{}
162
163
BondID
(
AtomID
const
& a1,
AtomID
const
& a2 ):
164
atom1
( a1 ),
165
atom2
( a2 )
166
{}
167
168
bool
169
has
(
AtomID
const
&
id
)
const
170
{
171
return
(
id
==
atom1
||
id
==
atom2
);
172
}
173
174
AtomID
const
&
175
other_atom
(
AtomID
const
&
id
)
const
;
176
177
BondID
178
reversed
()
const
179
{
180
return
BondID
(
atom2
,
atom1
);
181
}
182
183
void
184
reverse
()
185
{
186
AtomID
const
tmp(
atom1
);
187
atom1
=
atom2
;
188
atom2
= tmp;
189
}
190
191
friend
192
bool
193
operator==
(
BondID
const
& a,
BondID
const
&
b
)
194
{
195
return
( a.
atom1
== b.
atom1
&& a.
atom2
== b.
atom2
);
196
}
197
198
199
public
:
200
AtomID
atom1
;
201
AtomID
atom2
;
202
};
203
204
205
///////////////////////////////////////////////////////////////////////////////
206
207
class
StubID
{
208
public
:
209
StubID
(
AtomID
const
& a1,
AtomID
const
& a2,
AtomID
const
& a3 ):
210
atom1
( a1 ),
211
atom2
( a2 ),
212
atom3
( a3 ),
213
center_
()
214
{}
215
216
StubID
(
AtomID
const
&
c
,
AtomID
const
& a1,
AtomID
const
& a2,
AtomID
const
& a3 ):
217
atom1
( a1 ),
218
atom2
( a2 ),
219
atom3
( a3 ),
220
center_
( c )
221
{}
222
223
224
StubID
():
225
atom1
(),
226
atom2
(),
227
atom3
()
228
{}
229
230
AtomID
const
&
231
atom
(
Size
const
index )
const
{
232
switch
( index ) {
233
case
1:
234
return
atom1
;
235
case
2:
236
return
atom2
;
237
case
3:
238
return
atom3
;
239
default
:
240
utility_exit_with_message(
"StubID's have exactly three atoms, 1-3"
);
241
}
242
return
atom1
;
// won't get here
243
}
244
245
AtomID
const
&
246
center
()
const
{
247
return
center_
;
248
}
249
250
bool
valid
()
const
{
251
return
atom1
.
valid
() &&
atom2
.
valid
() &&
atom3
.
valid
() &&
center_
.
valid
();
252
}
253
254
inline
255
friend
256
bool
257
operator<
(
StubID
const
& a,
StubID
const
&
b
)
258
{
259
return
( ( a.
atom1
< b.
atom1
) ||
260
( a.
atom1
== b.
atom1
&& a.
atom2
< b.
atom2
) ||
261
( a.
atom1
== b.
atom1
&& a.
atom2
== b.
atom2
&& a.
atom3
< b.
atom3
) );
262
}
263
264
friend
265
std::ostream &
266
operator <<
(
267
std::ostream & os,
268
StubID
const
&
269
);
270
271
272
public
:
// tmp hack -- phil fix this
273
AtomID
atom1
;
274
AtomID
atom2
;
275
AtomID
atom3
;
276
AtomID
center_
;
277
};
278
279
280
281
/// @brief Globals
282
extern
StubID
const
BOGUS_STUB_ID
;
283
284
285
286
}
// namespace id
287
}
// namespace core
288
289
290
#endif // INCLUDED_core_id_AtomID_HH
Generated on Sat Jun 1 2013 11:32:47 for Rosetta 3.5 by
1.8.4