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
pack
dunbrack
DunbrackEnergy.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/pack/dunbrack/DunbrackEnergy.cc
11
/// @brief Dunbrack energy method implementation
12
/// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13
14
// Unit headers
15
#include <
core/pack/dunbrack/DunbrackEnergy.hh
>
16
#include <
core/pack/dunbrack/DunbrackEnergyCreator.hh
>
17
18
// Package Headers
19
#include <
core/scoring/EnergyMap.hh
>
20
#include <
core/pack/dunbrack/RotamerLibrary.hh
>
21
#include <
core/pack/dunbrack/RotamerLibraryScratchSpace.hh
>
22
23
#include <
core/scoring/ScoreType.hh
>
24
25
// Project headers
26
#include <
core/chemical/VariantType.hh
>
27
#include <
core/conformation/Residue.hh
>
28
#include <
core/pose/Pose.hh
>
29
30
#include <
core/id/TorsionID.hh
>
31
32
// Utility headers
33
#include <numeric/conversions.hh>
34
35
#include <utility/vector1.hh>
36
37
38
39
namespace
core {
40
namespace
pack {
41
namespace
dunbrack {
42
43
using namespace
scoring;
44
using namespace
scoring::methods;
45
46
/// @details This must return a fresh instance of the DunbrackEnergy class,
47
/// never an instance already in use
48
scoring::methods::EnergyMethodOP
49
DunbrackEnergyCreator::create_energy_method
(
50
scoring::methods::EnergyMethodOptions
const
&
51
)
const
{
52
return
new
DunbrackEnergy
;
53
}
54
55
scoring::ScoreTypes
56
DunbrackEnergyCreator::score_types_for_method
()
const
{
57
ScoreTypes
sts;
58
sts.push_back(
fa_dun
);
59
sts.push_back(
fa_dun_dev
);
60
sts.push_back(
fa_dun_rot
);
61
sts.push_back(
fa_dun_semi
);
62
return
sts;
63
}
64
65
66
67
/// ctor
68
DunbrackEnergy::DunbrackEnergy
() :
69
parent
( new
DunbrackEnergyCreator
)
70
{}
71
72
DunbrackEnergy::~DunbrackEnergy
() {}
73
74
/// clone
75
EnergyMethodOP
76
DunbrackEnergy::clone
()
const
77
{
78
return
new
DunbrackEnergy
;
79
}
80
81
/////////////////////////////////////////////////////////////////////////////
82
// methods for ContextIndependentOneBodyEnergies
83
/////////////////////////////////////////////////////////////////////////////
84
85
/// @details Allocate the scratch space object on the stack to
86
/// alieviate thread-safety concerns. Scratch does not use new.
87
void
88
DunbrackEnergy::residue_energy
(
89
conformation::Residue
const
& rsd,
90
pose::Pose
const
&,
91
scoring::EnergyMap
& emap
92
)
const
93
{
94
// ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
95
if
( rsd.
has_variant_type
(
core::chemical::REPLONLY
)){
96
return
;
97
}
98
99
//
100
//static boost::detail::atomic_count count_present( 0 );
101
//++count_present;
102
//std::cout << "D" << count_present << std::flush;
103
104
if
( rsd.
is_virtual_residue
() )
return
;
105
106
/* old emap[ fa_dun ] = rot_lib_.rotamer_energy( rsd ); */
107
pack::dunbrack::SingleResidueRotamerLibraryCAP
rotlib =
RotamerLibrary::get_instance
().
get_rsd_library
( rsd.
type
() ) ;
108
if
( rotlib ) {
109
dunbrack::RotamerLibraryScratchSpace
scratch;
110
emap[
fa_dun
] += rotlib->rotamer_energy( rsd, scratch );
111
emap[
fa_dun_rot
] += scratch.
fa_dun_rot
();
112
emap[
fa_dun_semi
] += scratch.
fa_dun_semi
();
113
emap[
fa_dun_dev
] += scratch.
fa_dun_dev
();
114
}
115
//--count_present;
116
//std::cout << "D" << count_present << std::flush;
117
118
}
119
120
bool
DunbrackEnergy::defines_dof_derivatives
(
pose::Pose
const
& )
const
{
return
true
; }
121
122
Real
123
DunbrackEnergy::eval_residue_dof_derivative
(
124
conformation::Residue
const
& rsd,
125
ResSingleMinimizationData
const
& ,
//min_data,
126
id::DOF_ID
const
& ,
// dof_id,
127
id::TorsionID
const
& tor_id,
128
pose::Pose
const
& ,
//pose,
129
scoring::ScoreFunction
const
& ,
//sfxn,
130
scoring::EnergyMap
const
& weights
131
)
const
132
{
133
// ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
134
if
( rsd.
has_variant_type
(
core::chemical::REPLONLY
)){
135
return
0.0;
136
}
137
138
Real
deriv(0.0);
139
Real
deriv_dev(0.0);
140
Real
deriv_rot(0.0);
141
Real
deriv_semi(0.0);
142
if
( tor_id.
valid
() ) {
143
assert( rsd.
seqpos
() == tor_id.
rsd
() );
144
//utility::vector1< Real > dE_dbb, dE_dchi;
145
// std::cerr << __FILE__<< ' ' << __LINE__ << ' ' << tor_id.rsd() << std::endl;
146
pack::dunbrack::SingleResidueRotamerLibraryCAP
rotlib =
147
RotamerLibrary::get_instance
().
get_rsd_library
( rsd.
type
() );
148
if
( rsd.
is_protein
() && rotlib ) {
149
dunbrack::RotamerLibraryScratchSpace
scratch;
150
rotlib->rotamer_energy_deriv( rsd, scratch );
151
if
( tor_id.
type
() ==
id::BB
&& tor_id.
torsion
() <=
dunbrack::DUNBRACK_MAX_BBTOR
) {
152
deriv = scratch.
dE_dbb
()[ tor_id.
torsion
() ];
153
deriv_dev = scratch.
dE_dbb_dev
()[ tor_id.
torsion
() ];
154
deriv_rot = scratch.
dE_dbb_rot
()[ tor_id.
torsion
() ];
155
deriv_semi = scratch.
dE_dbb_semi
()[ tor_id.
torsion
() ];
156
}
else
if
( tor_id.
type
() ==
id::CHI
&& tor_id.
torsion
() <=
dunbrack::DUNBRACK_MAX_SCTOR
) {
157
deriv = scratch.
dE_dchi
()[ tor_id.
torsion
() ];
158
deriv_dev = scratch.
dE_dchi_dev
()[ tor_id.
torsion
() ];
159
deriv_semi = scratch.
dE_dchi_semi
()[ tor_id.
torsion
() ];
160
}
161
}
162
}
163
return
numeric::conversions::degrees( weights[
fa_dun
] * deriv + weights[
fa_dun_dev
] * deriv_dev + weights[
fa_dun_rot
] * deriv_rot + weights[
fa_dun_semi
] * deriv_semi);
164
}
165
166
167
///
168
Real
169
DunbrackEnergy::eval_dof_derivative
(
170
id::DOF_ID
const
&,
// dof_id,
171
id::TorsionID
const
& tor_id,
172
pose::Pose
const
& pose,
173
scoring::ScoreFunction
const
&,
174
scoring::EnergyMap
const
& weights
175
)
const
176
{
177
// ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
178
if
( pose.
residue
( tor_id.
rsd
() ).has_variant_type(
core::chemical::REPLONLY
)){
179
return
0.0;
180
}
181
182
//
183
//static boost::detail::atomic_count count_present( 0 );
184
//++count_present;
185
//std::cout << "dD" << count_present << std::flush;
186
187
Real
deriv(0.0);
188
Real
deriv_dev(0.0);
189
Real
deriv_rot(0.0);
190
Real
deriv_semi(0.0);
191
if
( tor_id.
valid
() ) {
192
//utility::vector1< Real > dE_dbb, dE_dchi;
193
// std::cerr << __FILE__<< ' ' << __LINE__ << ' ' << tor_id.rsd() << std::endl;
194
pack::dunbrack::SingleResidueRotamerLibraryCAP
rotlib =
195
RotamerLibrary::get_instance
().
get_rsd_library
( pose.
residue
( tor_id.
rsd
() ).type() );
196
197
if
( pose.
residue
( tor_id.
rsd
() ).is_virtual_residue() )
return
0.0;
198
199
if
( rotlib ) {
200
dunbrack::RotamerLibraryScratchSpace
scratch;
201
rotlib->rotamer_energy_deriv
202
( pose.
residue
( tor_id.
rsd
() ), scratch );
203
204
/// ASSUMPTION: Derivatives for amino acids only!
205
if
( pose.
residue_type
( tor_id.
rsd
() ).is_protein() ) {
206
if
( tor_id.
type
() ==
id::BB
&& tor_id.
torsion
() <=
dunbrack::DUNBRACK_MAX_BBTOR
) {
207
deriv = scratch.
dE_dbb
()[ tor_id.
torsion
() ];
208
deriv_dev = scratch.
dE_dbb_dev
()[ tor_id.
torsion
() ];
209
deriv_rot = scratch.
dE_dbb_rot
()[ tor_id.
torsion
() ];
210
deriv_semi = scratch.
dE_dbb_semi
()[ tor_id.
torsion
() ];
211
}
else
if
( tor_id.
type
() ==
id::CHI
&& tor_id.
torsion
() <=
dunbrack::DUNBRACK_MAX_SCTOR
) {
212
deriv = scratch.
dE_dchi
()[ tor_id.
torsion
() ];
213
deriv_dev = scratch.
dE_dchi_dev
()[ tor_id.
torsion
() ];
214
deriv_semi = scratch.
dE_dchi_semi
()[ tor_id.
torsion
() ];
215
}
216
}
217
}
218
}
219
//--count_present;
220
//std::cout << "dD" << count_present << std::flush;
221
return
numeric::conversions::degrees( weights[
fa_dun
] * deriv + weights[
fa_dun_dev
] * deriv_dev + weights[
fa_dun_rot
] * deriv_rot + weights[
fa_dun_semi
] * deriv_semi );
222
}
223
224
/// @brief DunbrackEnergy is context independent; indicates that no context graphs are required
225
void
226
DunbrackEnergy::indicate_required_context_graphs
(
227
utility::vector1< bool >
&
/*context_graphs_required*/
228
)
const
229
{}
230
core::Size
231
DunbrackEnergy::version
()
const
232
{
233
return
1;
// Initial versioning
234
}
235
236
237
238
}
// dunbrack
239
}
// pack
240
}
// core
241
Generated on Sat Jun 1 2013 11:33:14 for Rosetta 3.5 by
1.8.4