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
scoring
etable
count_pair
CountPairFactory.cc
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/scoring/etable/count_pair/CountPairFactory.fwd.hh
11
/// @brief
12
/// @author Andrew Leaver-Fay (leaverfa@email.unc.edu)
13
14
// Unit Headers
15
#include <
core/scoring/etable/count_pair/CountPairFactory.hh
>
16
17
// Package Headers
18
#include <
core/scoring/etable/count_pair/types.hh
>
19
#include <
core/scoring/etable/count_pair/CountPairAll.hh
>
20
#include <
core/scoring/etable/count_pair/CountPairFunction.hh
>
21
// AUTO-REMOVED #include <core/scoring/etable/count_pair/CountPairNone.hh>
22
#include <
core/scoring/etable/count_pair/CountPair1B.hh
>
23
#include <
core/scoring/etable/count_pair/CountPairIntraRes.hh
>
24
#include <
core/scoring/etable/count_pair/CountPairGeneric.hh
>
25
26
#include <
core/scoring/etable/count_pair/CountPairCrossover3.hh
>
27
#include <
core/scoring/etable/count_pair/CountPairCrossover4.hh
>
28
29
30
// Project Headers
31
#include <
core/chemical/ResidueConnection.hh
>
32
#include <
core/conformation/Residue.hh
>
33
// AUTO-REMOVED #include <core/conformation/PseudoBond.hh>
34
#include <
core/scoring/etable/atom_pair_energy_inline.hh
>
35
36
//Auto Headers
37
#include <
core/scoring/etable/Etable.hh
>
38
#include <utility/vector1.hh>
39
40
41
namespace
core {
42
namespace
scoring {
43
namespace
etable {
44
namespace
count_pair {
45
46
CountPairFunctionOP
47
CountPairFactory::create_count_pair_function
(
48
conformation::Residue
const
& res1,
49
conformation::Residue
const
& res2,
50
CPCrossoverBehavior
crossover
51
)
52
{
53
CPResidueConnectionType
connection =
determine_residue_connection
( res1, res2 );
54
CountPairFunctionOP
cpfxn;
55
56
if
( connection !=
CP_NO_BONDS
)
57
{
58
switch
( connection ) {
59
case
CP_NO_BONDS
:
60
utility_exit();
61
break
;
62
case
CP_ONE_BOND
: {
63
// scope for res1connat, res2connat initializations
64
assert( res1.
connections_to_residue
( res2 ).size() == 1 );
65
assert( res2.
connections_to_residue
( res1 ).size() == 1 );
66
67
Size
res1connat = res1.
residue_connection
( res1.
connections_to_residue
( res2 )[ 1 ] ).atomno();
68
Size
res2connat = res2.
residue_connection
( res2.
connections_to_residue
( res1 )[ 1 ] ).atomno();
69
switch
( crossover ) {
70
case
CP_CROSSOVER_3
:
71
cpfxn =
new
CountPair1B< CountPairCrossover3 >
( res1, res1connat, res2, res2connat );
72
break
;
73
case
CP_CROSSOVER_4
:
74
cpfxn =
new
CountPair1B< CountPairCrossover4 >
( res1, res1connat, res2, res2connat );
75
break
;
76
}
77
}
78
break
;
79
default
: {
80
CountPairGenericOP
gcpfxn =
new
CountPairGeneric
( res1, res2 );
81
gcpfxn->set_crossover( crossover ==
CP_CROSSOVER_3
? 3 : 4 );
82
cpfxn = gcpfxn;
83
}
84
break
;
85
}
86
}
else
{
87
cpfxn =
new
CountPairAll
;
88
}
89
return
cpfxn;
90
}
91
92
93
/// @details Instantiate a count-pair function on the *stack* and rely on an
94
/// invoker to call a function of the newly created count-pair function. The
95
/// count-pair function is removed from the stack without new or delete having
96
/// been called.
97
void
98
CountPairFactory::create_count_pair_function_and_invoke
(
99
conformation::Residue
const
& res1,
100
conformation::Residue
const
& res2,
101
CPCrossoverBehavior
crossover,
102
Invoker
& invoker
103
)
104
{
105
CPResidueConnectionType
connection =
determine_residue_connection
( res1, res2 );
106
107
if
( connection !=
CP_NO_BONDS
)
108
{
109
switch
( connection ) {
110
case
CP_NO_BONDS
:
111
utility_exit();
112
break
;
113
case
CP_ONE_BOND
: {
114
// scope for res1connat, res2connat initializations
115
assert( res1.
connections_to_residue
( res2 ).size() == 1 );
116
assert( res2.
connections_to_residue
( res1 ).size() == 1 );
117
118
Size
res1connat = res1.
residue_connection
( res1.
connections_to_residue
( res2 )[ 1 ] ).atomno();
119
Size
res2connat = res2.
residue_connection
( res2.
connections_to_residue
( res1 )[ 1 ] ).atomno();
120
switch
( crossover ) {
121
case
CP_CROSSOVER_3
: {
122
CountPair1B< CountPairCrossover3 >
cpfxn( res1, res1connat, res2, res2connat );
123
invoker.
invoke
( cpfxn );
124
}
125
break
;
126
case
CP_CROSSOVER_4
: {
127
CountPair1B< CountPairCrossover4 >
cpfxn( res1, res1connat, res2, res2connat );
128
invoker.
invoke
( cpfxn );
129
}
130
break
;
131
}
132
}
133
break
;
134
default
: {
135
CountPairGeneric
gcpfxn( res1, res2 );
136
gcpfxn.
set_crossover
( crossover ==
CP_CROSSOVER_3
? 3 : 4 );
137
invoker.
invoke
( gcpfxn );
138
}
139
break
;
140
}
141
}
else
{
142
CountPairAll
cpfxn;
143
invoker.
invoke
( cpfxn );
144
}
145
}
146
147
CPResidueConnectionType
148
CountPairFactory::determine_residue_connection
(
149
conformation::Residue
const
& res1,
150
conformation::Residue
const
& res2
151
)
152
{
153
if
( res1.
is_pseudo_bonded
( res2.
seqpos
() )) {
154
return
CP_MULTIPLE_BONDS_OR_PSEUDOBONDS
;
155
}
else
if
( res1.
is_bonded
(res2) ) {
156
if
( res1.
connections_to_residue
( res2 ).size() == 1 ) {
157
return
CP_ONE_BOND
;
158
}
else
{
159
return
CP_MULTIPLE_BONDS_OR_PSEUDOBONDS
;
160
}
161
}
162
163
return
CP_NO_BONDS
;
164
}
165
166
167
CountPairFunctionOP
168
CountPairFactory::create_intrares_count_pair_function
(
169
conformation::Residue
const
& res,
170
CPCrossoverBehavior
crossover
171
)
172
{
173
CountPairFunctionOP
cpfxn;
174
175
switch
( crossover ) {
176
case
CP_CROSSOVER_3
:
177
cpfxn =
new
CountPairIntraRes< CountPairCrossover3 >
( res );
178
break
;
179
case
CP_CROSSOVER_4
:
180
cpfxn =
new
CountPairIntraRes< CountPairCrossover4 >
( res );
181
break
;
182
}
183
184
return
cpfxn;
185
186
}
187
188
}
// namespace count_pair
189
}
// namespace etable
190
}
// namespace scoring
191
}
// namespace core
192
193
Generated on Sat Jun 1 2013 11:36:47 for Rosetta 3.5 by
1.8.4