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
optimization
DOF_Node.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/kinematics/DOF_Node.hh
11
/// @brief Kinematics
12
/// @author Phil Bradley
13
14
15
#ifndef INCLUDED_core_optimization_DOF_Node_hh
16
#define INCLUDED_core_optimization_DOF_Node_hh
17
18
// Unit headers
19
#include <
core/optimization/DOF_Node.fwd.hh
>
20
21
// Project headers
22
#include <
core/id/TorsionID.hh
>
23
#include <
core/id/DOF_ID.hh
>
24
25
#include <
core/types.hh
>
// Vector
26
27
// // Numeric headers
28
#include <numeric/xyzVector.hh>
29
30
// Utility headers
31
#include <utility/pointer/ReferenceCount.hh>
32
#include <utility/vector1.hh>
33
34
35
namespace
core {
36
namespace
optimization {
37
38
39
class
DOF_Node
:
public
utility::pointer::ReferenceCount
40
{
41
public
:
42
//typedef numeric::xyzVector< Real > Vector;
43
typedef
id::AtomID
AtomID
;
44
typedef
utility::vector1< AtomID >
AtomIDs
;
45
typedef
id::DOF_ID
DOF_ID
;
46
typedef
id::TorsionID
TorsionID
;
47
typedef
id::DOF_Type
DOF_Type
;
48
49
50
public
:
51
inline
52
Vector
&
53
F1
() {
return
F1_
; };
54
55
inline
56
Vector
&
57
F2
() {
return
F2_
; }
58
59
inline
60
Vector
const
&
61
F1
()
const
{
return
F1_
; };
62
63
inline
64
Vector
const
&
65
F2
()
const
{
return
F2_
; }
66
67
inline
68
int
69
rsd
()
const
{
return
id
.atom_id().rsd(); }
70
71
inline
72
int
73
atomno
()
const
{
return
id
.atom_id().atomno(); }
74
75
inline
76
AtomID
const
&
77
atom_id
()
const
{
return
id
.atom_id(); }
78
79
inline
80
DOF_Type
81
type
()
const
{
return
id
.type(); }
82
83
inline
84
DOF_ID
const
&
85
dof_id
()
const
{
return
id
; }
86
87
inline
88
int
depth
()
const
;
89
90
inline
91
AtomIDs
const
&
92
atoms
()
const
93
{
94
return
atoms_
;
95
}
96
97
inline
98
DOF_NodeCOP
99
parent
()
const
100
{
101
return
parent_
;
102
}
103
104
inline
105
void
106
clear_atoms
() {
107
atoms_
.clear();
// don't deallocate space -- makes DOF_Nodes reusable.
108
}
109
110
///
111
inline
112
void
113
add_atom
(
AtomID
const
& atom )
114
{
115
atoms_
.push_back( atom );
116
}
117
118
119
/// get the rosetta torsion id for this DOF
120
/**
121
This may not exist, of course. But it's useful to know what it
122
is when calculating derivatives of terms like rama/dunbrack/paa
123
**/
124
TorsionID
const
&
125
torsion_id
()
const
126
{
127
return
torsion_id_
;
128
}
129
130
131
/// set the rosetta torsion id for this DOF
132
/**
133
This may not exist, of course. But it's useful to know what it
134
is when calculating derivatives of terms like rama/dunbrack/paa
135
**/
136
void
137
torsion_id
(
138
id::TorsionID
const
& id_in
139
)
140
{
141
torsion_id_
= id_in;
142
}
143
144
145
/// sum derivative contributions down the tree
146
inline
147
void
148
link_vectors
()
149
{
150
if
(
parent_
) {
151
parent_
->F1() +=
F1_
;
152
parent_
->F2() +=
F2_
;
153
}
154
}
155
156
// constructor
157
DOF_Node
(
158
DOF_ID
const
& id_in,
159
DOF_NodeOP
parent_in
160
):
161
utility::pointer::ReferenceCount(),
162
F1_
(0.0),
163
F2_
(0.0),
164
depth_
(-1),
165
id
( id_in ),
166
parent_
( parent_in ),
167
torsion_id_
(
id
::
BOGUS_TORSION_ID
)
168
{}
169
170
void
171
set_id
(
DOF_ID
const
& setting ) {
172
id
= setting;
173
}
174
175
void
176
set_parent
(
DOF_NodeOP
setting )
177
{
178
assert( setting() !=
this
);
// an object in an OP should never point to itself
179
parent_
= setting;
180
}
181
182
private
:
183
Vector
F1_
;
184
Vector
F2_
;
185
mutable
int
depth_
;
186
DOF_ID
id
;
187
AtomIDs
atoms_
;
188
DOF_NodeOP
parent_
;
189
TorsionID
torsion_id_
;
190
191
192
friend
193
inline
194
bool
195
operator<
(
DOF_Node
const
& t1,
DOF_Node
const
& t2 ) {
196
return
( t1.
depth
() > t2.
depth
() );
// check that this gives correct sort
197
}
198
199
200
};
// DOF_Node
201
202
203
inline
204
int
205
DOF_Node::depth
()
const
206
{
207
if
(
parent_
== 0 ) {
208
depth_
= 0;
209
}
else
if
(
depth_
< 0 ) {
210
depth_
=
parent_
->depth() + 1;
211
}
212
assert(
depth_
>= 0 );
213
return
depth_
;
214
}
215
216
217
}
// namespace kinematics
218
}
// namespace core
219
220
221
#endif // INCLUDED_core_kinematics_min_HH
Generated on Sat Jun 1 2013 11:33:09 for Rosetta 3.5 by
1.8.4