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
protocols
flexpack
interaction_graph
OTFFlexbbInteractionGraph.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 protocols/flexpack/interaction_graph/OTFFlexbbIteractionGraph.hh
11
/// @brief Declaration for on-the-fly flexible-backbone-packing interaction graph interface & base classes
12
/// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13
14
#ifndef INCLUDED_protocols_flexpack_interaction_graph_OTFFlexbbInteractionGraph_hh
15
#define INCLUDED_protocols_flexpack_interaction_graph_OTFFlexbbInteractionGraph_hh
16
17
//#ifndef DEBUG_OTF_FLEXBB_ENERGIES
18
//#define DEBUG_OTF_FLEXBB_ENERGIES // disable this line for speed
19
//#endif
20
21
22
/// Unit headers
23
#include <
protocols/flexpack/interaction_graph/OTFFlexbbInteractionGraph.fwd.hh
>
24
25
/// Package headers
26
#include <
protocols/flexpack/interaction_graph/FlexbbInteractionGraph.hh
>
27
// AUTO-REMOVED #include <protocols/flexpack/rotamer_set/FlexbbRotamerSet.fwd.hh>
28
#include <
protocols/flexpack/OtherContextScoreFunction.hh
>
/// CREATE THE .FWD.HH FILE
29
30
/// Project headers
31
#include <
core/conformation/Residue.fwd.hh
>
32
#include <
core/pose/Pose.fwd.hh
>
33
#include <
core/scoring/ScoreFunction.fwd.hh
>
34
#include <
core/types.hh
>
35
36
#ifdef WIN32
37
#include <
core/conformation/Residue.hh
>
38
#endif
39
/// ObjexxFCL headers
40
#include <ObjexxFCL/FArray4D.hh>
41
42
#include <utility/vector1.hh>
43
44
45
namespace
protocols {
46
namespace
flexpack {
47
namespace
interaction_graph {
48
49
class
OTFFlexbbNode
:
public
FlexbbNode
50
{
51
public
:
52
typedef
FlexbbNode
parent
;
53
typedef
core::conformation::Residue
Residue
;
54
typedef
core::conformation::ResidueCOP
ResidueCOP
;
55
typedef
core::Size
Size
;
56
typedef
core::PackerEnergy
PackerEnergy
;
57
typedef
core::Real
Real
;
58
typedef
core::Vector
Vector
;
59
typedef
core::DistanceSquared
DistanceSquared
;
60
61
public
:
62
63
OTFFlexbbNode
(
OTFFlexbbInteractionGraph
*,
int
node_id,
int
num_states );
64
virtual
~OTFFlexbbNode
();
65
virtual
void
print
()
const
;
66
67
virtual
unsigned
int
count_dynamic_memory
()
const
;
68
69
Residue
const
&
70
rotamer
(
int
index )
const
{
71
return
*
rotamers_
[ index ];
72
}
73
74
void
set_rotamer
(
int
state,
ResidueCOP
rotamer
);
75
void
declare_all_rotamers_initialized
();
76
77
Real
bounding_radius_for_rotamers
(
int
aatype,
int
bb )
const
;
78
79
bool
rotamer_is_proline
(
int
state )
const
{
return
rotamer_is_proline_
[ state ]; }
80
bool
rotamer_is_glycine
(
int
state )
const
{
return
rotamer_is_glycine_
[ state ]; }
81
82
protected
:
83
/// Downcast pointers to incident edges, adjacent nodes, and the owning graph
84
inline
85
OTFFlexbbEdge
const
*
get_incident_otfflexbb_edge
(
int
index )
const
;
86
87
inline
88
OTFFlexbbEdge
*
get_incident_otfflexbb_edge
(
int
index );
89
90
inline
91
OTFFlexbbNode
const
*
get_adjacent_otfflexbb_node
(
int
index )
const
;
92
93
inline
94
OTFFlexbbNode
*
get_adjacent_otfflexbb_node
(
int
index );
95
96
inline
97
OTFFlexbbInteractionGraph
const
*
get_otfflexbbig_owner
()
const
;
98
99
inline
100
OTFFlexbbInteractionGraph
*
get_otfflexbbig_owner
();
101
102
private
:
103
utility::vector1< ResidueCOP >
rotamers_
;
104
utility::vector1< utility::vector1< Real >
>
bounding_volumes_for_bb_for_aa_
;
105
utility::vector1< unsigned char >
rotamer_is_proline_
;
106
utility::vector1< unsigned char >
rotamer_is_glycine_
;
107
108
};
109
110
class
OTFFlexbbEdge
:
public
FlexbbEdge
111
{
112
public
:
113
typedef
FlexbbEdge
parent
;
114
typedef
core::conformation::Residue
Residue
;
115
typedef
ObjexxFCL::FArray2D< PackerEnergy >
FArray2D_PackerEnergy
;
116
117
public
:
118
OTFFlexbbEdge
(
OTFFlexbbInteractionGraph
* owner,
int
node1,
int
node2 );
119
virtual
~OTFFlexbbEdge
();
120
121
PackerEnergy
122
compute_samebbconf_alternate_state_energy_first_node
();
123
124
PackerEnergy
125
compute_samebbconf_alternate_state_energy_second_node
();
126
127
PackerEnergy
128
compute_altbbconf_alternate_state_energy
();
129
130
void
131
otfedge_note_substitution_accepted
();
132
133
virtual
unsigned
int
count_dynamic_memory
()
const
;
134
135
void
136
set_ProCorrection_values
(
137
int
node_not_necessarily_proline,
138
int
state,
139
int
other_bb,
140
PackerEnergy
bb_nonprobb_E,
141
PackerEnergy
bb_probb_E,
142
PackerEnergy
sc_nonprobb_E,
143
PackerEnergy
sc_probb_E
144
);
145
146
void
147
set_GlyCorrection_values
(
148
int
node_not_necessarily_glycine,
149
int
state,
150
int
other_bb,
151
PackerEnergy
bb_nonglybb_E,
152
PackerEnergy
bb_glybb_E,
153
PackerEnergy
sc_nonglybb_E,
154
PackerEnergy
sc_glybb_E
155
);
156
157
virtual
void
prepare_for_simulated_annealing
();
158
159
void
note_long_range_interactions_exist
();
160
161
void
print_alt_energies
()
const
;
162
163
protected
:
164
165
/// Downcasts
166
inline
167
OTFFlexbbNode
const
*
get_otfflexbb_node
(
int
index )
const
;
168
169
inline
170
OTFFlexbbNode
*
get_otfflexbb_node
(
int
index );
171
172
inline
173
OTFFlexbbInteractionGraph
const
*
get_otfflexbbig_owner
()
const
;
174
175
inline
176
OTFFlexbbInteractionGraph
*
get_otfflexbbig_owner
();
177
178
protected
:
179
180
Residue
const
&
181
alt_rot
(
int
which_node
)
const
{
182
return
get_otfflexbb_node
( which_node )->
rotamer
(
nodes_alt_state
( which_node ) );
183
}
184
185
void
186
zero_state_on_node
(
int
which_node
);
187
188
private
:
189
190
//// @brief Is a particular state proline? Used as a signal for proline correction terms.
191
inline
192
bool
state_is_proline
(
int
which_node
,
int
state )
const
;
193
194
inline
195
bool
196
state_is_glycine
(
int
which_node
,
int
state )
const
;
197
198
int
compact_bbindex
(
int
index )
const
{
return
nodes_part_of_same_flexseg
() ? 1 : index; }
199
200
/// If this flag is "true" then the two tables below are not allocated, and instead
201
/// sc/bb and bb/bb energies are calculated alongside sc/sc energies in the OTF
202
/// calculations. Slower, but uses less memory.
203
bool
compute_bbbb_and_scbb_otf_
;
204
205
PackerEnergy
all_vs_bb_energy_curr_conf_
[ 2 ];
206
PackerEnergy
procorr_curr_conf_
[ 2 ];
207
PackerEnergy
glycorr_curr_conf_
[ 2 ];
208
PackerEnergy
scsc_energy_curr_conf_
;
209
210
PackerEnergy
all_vs_bb_energy_alt_conf_
[ 2 ];
211
PackerEnergy
procorr_alt_conf_
[ 2 ];
212
PackerEnergy
glycorr_alt_conf_
[ 2 ];
213
PackerEnergy
scsc_energy_alt_conf_
;
214
215
// if both nodes are flexible, they store their "1 body" sc/bb and bb/bb energies here.
216
// This is relatively expensive. I'm considering an alternative that computes
217
// sc/bb and bb/bb energies on the fly as well...
218
// Farray indexed ( state_this, compact bb_other )
219
// compact == if the edge connects two nodes that are part of the same flexible segment, then
220
// the backbone index is always "1" and the dimension for anything that's indexed by the backbone
221
// is 1 (thereby occupying less memory).
222
FArray2D_PackerEnergy
all_vs_bb_energies_
[ 2 ];
223
224
// if either node becomes proline, add in the proline correction for the state on the other node.
225
/// Farray indexed ( state_this, compact bb_other )
226
FArray2D_PackerEnergy
procorr_energies_
[ 2 ];
227
228
229
// if either node becomes glycine, add in the glycine correction for the state on the other node.
230
/// Farray indexed ( state_this, compact bb_other )
231
FArray2D_PackerEnergy
glycorr_energies_
[ 2 ];
232
233
ObjexxFCL::FArray4D< unsigned char >
sr_aa_neighbors_
;
// indexed ( aa1, aa2, non-compact bb1, compact bb2 )
234
bool
lr_energies_exist_
;
235
236
core::pose::PoseCOP
pose_
;
237
core::scoring::ScoreFunctionCOP
sfxn_
;
238
};
239
240
class
OTFFlexbbInteractionGraph
:
public
FlexbbInteractionGraph
241
{
242
public
:
243
typedef
FlexbbInteractionGraph
parent
;
244
typedef
core::Real
Real
;
245
typedef
core::pose::PoseOP
PoseOP
;
246
typedef
core::pose::PoseCOP
PoseCOP
;
247
typedef
core::pose::Pose
Pose
;
248
typedef
core::scoring::ScoreFunctionOP
ScoreFunctionOP
;
249
typedef
core::scoring::ScoreFunctionCOP
ScoreFunctionCOP
;
250
typedef
core::scoring::ScoreFunction
ScoreFunction
;
251
252
253
public
:
254
255
OTFFlexbbInteractionGraph
(
int
num_nodes );
256
virtual
~OTFFlexbbInteractionGraph
();
257
258
virtual
void
initialize
(
core::pack::rotamer_set::RotamerSetsBase
const
& );
259
260
void
261
set_ProCorrection_values_for_edge
(
262
int
node1,
263
int
node2,
264
int
node_not_necessarily_proline,
265
int
state,
266
int
other_bb,
267
PackerEnergy
bb_nonprobb_E,
268
PackerEnergy
bb_probb_E,
269
PackerEnergy
sc_nonprobb_E,
270
PackerEnergy
sc_probb_E
271
);
272
273
void
274
set_GlyCorrection_values_for_edge
(
275
int
node1,
276
int
node2,
277
int
node_not_necessarily_glycine,
278
int
state,
279
int
other_bb,
280
PackerEnergy
bb_nonglybb_E,
281
PackerEnergy
bb_glybb_E,
282
PackerEnergy
sc_nonglybb_E,
283
PackerEnergy
sc_glybb_E
284
);
285
286
virtual
unsigned
int
count_dynamic_memory
()
const
;
287
288
/// @brief Pose must be set before any edges are added to the graph.
289
virtual
void
set_pose
(
Pose
const
& pose );
290
/// @brief Score function must be set before any edges are added to the graph.
291
virtual
void
set_scorefxn
(
ScoreFunction
const
& sfxn );
292
293
/// @brief Edges request the pose and the score function at the time of their creation.
294
PoseCOP
get_pose
()
const
;
295
ScoreFunctionCOP
get_scorefxn
()
const
;
296
297
/// @brief Informs the edge connecting nodes 1 and 2 that they require long range interactions.
298
/// Note -- the edge must already exist.
299
void
note_long_range_interactions_exist_for_edge
(
int
node1,
int
node2 );
300
301
void
debug_note_considered_substitution
(
core::conformation::Residue
const
& alt_rotamer,
int
index );
302
void
debug_note_projected_deltaE_of_considered_substitution
(
PackerEnergy
deltaE,
PackerEnergy
node_alt_total,
bool
require_match =
true
);
303
void
debug_note_accepted_substitution
();
304
void
debug_note_rejected_substitution
();
305
306
protected
:
307
/// Downcasts
308
OTFFlexbbNode
const
*
get_otfflexbb_node
(
int
index )
const
309
{
return
static_cast<
OTFFlexbbNode
const
*
>
(
get_node
( index )); }
310
311
OTFFlexbbNode
*
get_otfflexbb_node
(
int
index )
312
{
return
static_cast<
OTFFlexbbNode
*
>
(
get_node
( index )); }
313
314
OTFFlexbbEdge
const
*
find_otfflexbb_edge
(
int
node1,
int
node2 )
const
315
{
316
core::pack::interaction_graph::EdgeBase
const
* edge =
find_edge
( node1, node2 );
317
if
( edge )
return
static_cast<
OTFFlexbbEdge
const
*
>
( edge );
318
else
return
0;
319
}
320
321
OTFFlexbbEdge
*
find_otfflexbb_edge
(
int
node1,
int
node2 )
322
{
323
core::pack::interaction_graph::EdgeBase
* edge =
find_edge
( node1, node2 );
324
if
( edge )
return
static_cast<
OTFFlexbbEdge
*
>
( edge );
325
else
return
0;
326
}
327
328
OTFFlexbbEdge
const
*
cast_otfflexbb_edge
(
EdgeBase
const
* edge )
const
329
{ assert(
mine
( edge ) );
return
static_cast<
OTFFlexbbEdge
const
*
>
( edge ); }
330
331
OTFFlexbbEdge
*
cast_otfflexbb_edge
(
EdgeBase
* edge )
332
{ assert(
mine
( edge ) );
return
static_cast<
OTFFlexbbEdge
*
>
( edge ); }
333
334
335
private
:
336
337
PoseOP
pose_
;
338
ScoreFunctionOP
sfxn_
;
339
OtherContextScoreFunctionOP
oc_sfxn_
;
340
341
/// For debugging purposes
342
PoseOP
current_pose_
;
343
Real
current_pose_energy_
;
344
PoseOP
alternate_pose_
;
345
Real
alternate_pose_energy_
;
346
347
utility::vector1< Size >
changing_seqpos_
;
348
utility::vector1< core::conformation::ResidueOP >
alt_rots_
;
349
utility::vector1< int >
alt_rot_inds_
;
350
351
utility::vector1< Size >
resid_2_moltenres_
;
352
utility::vector1< Size >
moltenres_2_resid_
;
353
};
354
355
inline
356
OTFFlexbbEdge
const
*
OTFFlexbbNode::get_incident_otfflexbb_edge
(
int
index )
const
357
{
return
static_cast<
OTFFlexbbEdge
const
*
>
(
get_incident_edge
( index )); }
358
359
inline
360
OTFFlexbbEdge
*
OTFFlexbbNode::get_incident_otfflexbb_edge
(
int
index )
361
{
return
static_cast<
OTFFlexbbEdge
*
>
(
get_incident_edge
( index )); }
362
363
inline
364
OTFFlexbbNode
const
*
OTFFlexbbNode::get_adjacent_otfflexbb_node
(
int
index )
const
365
{
return
static_cast<
OTFFlexbbNode
const
*
>
(
get_adjacent_node
( index )); }
366
367
inline
368
OTFFlexbbNode
*
OTFFlexbbNode::get_adjacent_otfflexbb_node
(
int
index )
369
{
return
static_cast<
OTFFlexbbNode
*
>
(
get_adjacent_node
( index )); }
370
371
inline
372
OTFFlexbbInteractionGraph
const
*
OTFFlexbbNode::get_otfflexbbig_owner
()
const
373
{
return
static_cast<
OTFFlexbbInteractionGraph
const
*
>
(
get_owner
()); }
374
375
inline
376
OTFFlexbbInteractionGraph
*
OTFFlexbbNode::get_otfflexbbig_owner
()
377
{
return
static_cast<
OTFFlexbbInteractionGraph
*
>
(
get_owner
()); }
378
379
380
/// Downcasts
381
inline
382
OTFFlexbbNode
const
*
OTFFlexbbEdge::get_otfflexbb_node
(
int
index )
const
383
{
return
static_cast<
OTFFlexbbNode
const
*
>
(
get_node
( index )); }
384
385
inline
386
OTFFlexbbNode
*
OTFFlexbbEdge::get_otfflexbb_node
(
int
index )
387
{
return
static_cast<
OTFFlexbbNode
*
>
(
get_node
( index )); }
388
389
inline
390
OTFFlexbbInteractionGraph
const
*
OTFFlexbbEdge::get_otfflexbbig_owner
()
const
391
{
return
static_cast<
OTFFlexbbInteractionGraph
const
*
>
(
get_owner
()); }
392
393
inline
394
OTFFlexbbInteractionGraph
*
OTFFlexbbEdge::get_otfflexbbig_owner
()
395
{
return
static_cast<
OTFFlexbbInteractionGraph
*
>
(
get_owner
()); }
396
397
398
}
399
}
400
}
401
402
#endif
Generated on Sat Jun 1 2013 11:50:23 for Rosetta 3.5 by
1.8.4