OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
stage
include
ost
mol
impl
atom_impl.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// This file is part of the OpenStructure project <www.openstructure.org>
3
//
4
// Copyright (C) 2008-2011 by the OpenStructure authors
5
//
6
// This library is free software; you can redistribute it and/or modify it under
7
// the terms of the GNU Lesser General Public License as published by the Free
8
// Software Foundation; either version 3.0 of the License, or (at your option)
9
// any later version.
10
// This library is distributed in the hope that it will be useful, but WITHOUT
11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with this library; if not, write to the Free Software Foundation, Inc.,
17
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
//------------------------------------------------------------------------------
19
#ifndef OST_ATOM_IMPL_HH
20
#define OST_ATOM_IMPL_HH
21
22
#include <boost/enable_shared_from_this.hpp>
23
24
#include <
ost/mol/module_config.hh
>
25
#include <
ost/geom/geom.hh
>
26
#include <
ost/mol/entity_visitor_fw.hh
>
27
#include <
ost/mol/impl/atom_prop.hh
>
28
29
#include <
ost/mol/impl/atom_impl_fw.hh
>
30
#include <
ost/mol/impl/residue_impl_fw.hh
>
31
#include <
ost/mol/impl/connector_impl_fw.hh
>
32
#include <
ost/mol/impl/fragment_impl_fw.hh
>
33
#include <
ost/mol/impl/entity_impl_fw.hh
>
34
35
#include <
ost/generic_property.hh
>
36
#include <
ost/mol/property_id.hh
>
37
38
namespace
ost {
namespace
mol {
namespace
impl {
39
49
class
AtomImpl
:
public
GenericPropContainerImpl
,
50
public
boost::enable_shared_from_this<AtomImpl> {
51
public
:
52
AtomImpl
(
const
EntityImplPtr
& ent,
const
ResidueImplPtr
& res,
53
const
String
& name,
const
geom::Vec3
& pos,
const
String
& ele,
54
unsigned
long
index);
55
56
~AtomImpl
();
57
void
Apply
(
EntityVisitor
& h);
58
59
const
String
&
GetName
()
const
{
return
name_;}
60
61
void
SetName
(
const
String
& atom_name) {
62
name_=atom_name;
63
}
64
65
66
const
geom::Vec3
&
GetPos
()
const
{
return
tf_pos_;}
67
68
const
geom::Vec3
&
GetOriginalPos
()
const
{
return
pos_;}
69
70
void
SetTransformedPos
(
const
geom::Vec3
& pos) { tf_pos_=pos; }
71
72
void
SetOriginalPos
(
const
geom::Vec3
& pos) { pos_=pos; }
73
74
ResidueImplPtr
GetResidue
()
const
;
75
76
void
SetPrimaryConnector
(
const
ConnectorImplP
& bp) {
77
prim_connector_=bp;
78
}
79
80
const
ConnectorImplP
&
GetPrimaryConnector
()
const
{
81
return
prim_connector_;
82
}
83
84
const
ConnectorImplList
&
GetSecondaryConnectors
()
const
{
85
return
connector_list_;
86
}
87
88
void
AddSecondaryConnector
(
const
ConnectorImplP
& bp);
89
90
// updates position and then follows secondary connectors
91
void
UpdateFromICS
();
92
93
// derive internal coordinates from position and linkage
94
void
UpdateFromXCS
();
95
96
String
GetQualifiedName
()
const
;
97
98
EntityImplPtr
GetEntity
()
const
;
99
100
int
GetConnectorCount
()
const
{
101
return
connector_list_.size()+(prim_connector_ ? 1 : 0);
102
}
103
104
void
SetVisited
(
bool
f) {set_state_bit(0,f);}
105
bool
IsVisited
()
const
{
return
get_state_bit(0);}
106
107
void
SetTraced
(
bool
f) {set_state_bit(1,f);}
108
bool
IsTraced
()
const
{
return
get_state_bit(1);}
109
110
111
Real
GetBFactor
()
const
{
return
b_factor_; }
112
113
const
String
&
GetElement
()
const
{
return
element_; }
114
115
void
SetElement
(
const
String
& ele)
116
{
117
if
(element_!=ele) {
118
element_=ele;
119
prop_=
impl::AtomProp::GetDefaultProps
(element_);
120
}
121
}
122
bool
HasDefaultProps
()
const
{
return
prop_->
is_default
; }
123
void
SetAnisou
(
const
geom::Mat3
& anisou)
124
{
125
if
(prop_->
is_default
&& prop_->
anisou
!=anisou) {
126
prop_=
new
AtomProp
(*prop_);
127
prop_->
is_default
=
false
;
128
prop_->
has_anisou
=
true
;
129
}
130
131
prop_->
anisou
=anisou;
132
}
133
134
const
geom::Mat3
&
GetAnisou
()
const
135
{
136
return
prop_->
anisou
;
137
}
138
void
SetBFactor
(
Real
factor)
139
{
140
b_factor_=factor;
141
}
142
143
void
SetOccupancy
(
Real
occ)
144
{
145
occupancy_=occ;
146
}
147
148
Real
GetOccupancy
()
const
149
{
150
return
occupancy_;
151
}
152
153
Real
GetRadius
()
const
{
return
prop_->
radius
; }
154
155
Real
GetMass
()
const
{
return
prop_->
mass
; }
156
Real
GetCharge
()
const
{
return
prop_->
charge
; }
157
158
bool
IsHetAtom
() {
return
is_hetatm_; }
159
160
void
SetHetAtom
(
bool
het) { is_hetatm_=het; }
161
162
void
SetMass
(
Real
mass)
163
{
164
if
(prop_->
is_default
&& prop_->
mass
!=mass) {
165
prop_=
new
AtomProp
(*prop_);
166
prop_->
is_default
=
false
;
167
}
168
prop_->
mass
=mass;
169
}
170
171
void
SetRadius
(
Real
radius)
172
{
173
if
(prop_->
is_default
&& prop_->
radius
!=radius) {
174
prop_=
new
AtomProp
(*prop_);
175
prop_->
is_default
=
false
;
176
}
177
prop_->
radius
=radius;
178
}
179
180
void
SetCharge
(
Real
charge)
181
{
182
if
(prop_->
is_default
&& prop_->
charge
!=charge) {
183
prop_=
new
AtomProp
(*prop_);
184
prop_->
is_default
=
false
;
185
}
186
prop_->
charge
=charge;
187
}
188
189
190
unsigned
int
GetState
()
const
191
{
192
return
state_;
193
}
194
195
void
SetState
(
int
state)
196
{
197
state_=state;
198
}
199
200
void
ClearDirectionality
();
202
void
TraceDirectionality
(
FragmentImplP
frag,
ConnectorImplP
conn,
203
int
n,
unsigned
int
& c);
204
205
bool
HasPrevious
()
const
{
return
prim_connector_.get()!=NULL;}
206
207
void
DeleteAllConnectors
();
208
209
void
DeleteConnector
(
const
ConnectorImplP
& conn,
210
bool
delete_other=
true
);
211
212
void
DeleteAllTorsions
();
213
214
String
GetStringProperty
(
Prop::ID
prop_id)
const
;
215
216
Real
GetFloatProperty
(
Prop::ID
prop_id)
const
;
217
218
int
GetIntProperty
(
Prop::ID
prop_id)
const
;
219
220
unsigned
long
GetIndex
()
const
{
return
index_;}
221
void
SetIndex
(
unsigned
long
index) {index_=index;}
222
223
private
:
224
ResidueImplW
res_;
225
String
name_;
226
geom::Vec3
pos_;
227
geom::Vec3
tf_pos_;
228
Real
occupancy_;
229
Real
b_factor_;
230
AtomProp
* prop_;
231
bool
is_hetatm_;
232
String
element_;
233
ConnectorImplP
prim_connector_;
234
ConnectorImplList
connector_list_;
235
FragmentImplP
fragment_;
236
239
geom::Mat3
total_rot_;
240
243
unsigned
int
state_;
244
245
void
set_state_bit(
unsigned
int
bit,
bool
state)
246
{
247
unsigned
int
mask = 0x1<<bit;
248
if
(state) {
249
state_ |= mask;
250
}
else
{
251
state_ &= ~mask;
252
}
253
}
254
255
bool
get_state_bit(
unsigned
int
bit)
const
{
256
unsigned
int
mask = 0x1<<bit;
257
return
(state_ & mask)!=0;
258
}
259
260
unsigned
long
index_;
261
};
262
264
std::ostream&
operator<<
(std::ostream& o,
const
AtomImplPtr
ap);
265
267
bool
ConnectorExists
(
const
AtomImplPtr
& a,
const
AtomImplPtr
& b);
268
270
ConnectorImplP
GetConnector
(
const
AtomImplPtr
& a,
const
AtomImplPtr
& b);
271
272
}}}
// ns
273
274
#endif
275
Generated on Thu Jun 14 2012 18:58:01 for OpenStructure by
1.8.1.1