OpenStructure
atom_base.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_BASE_HH
20 #define OST_ATOM_BASE_HH
21 
22 #include <ost/mol/module_config.hh>
23 #include <ost/geom/vec3.hh>
25 #include <ost/generic_property.hh>
26 
27 #include "property_id.hh"
28 
29 namespace ost { namespace mol {
30 
48 public:
49  AtomBase();
50  AtomBase(const impl::AtomImplPtr& impl);
51 public:
53 
54 
55 
56 
57 
58 
59 
60  operator bool() const { return this->IsValid(); }
63  bool IsValid() const { return Impl().get()!=0; }
69  const String& GetName() const;
70 
80  void SetName(const String& atom_name);
81 
83  const geom::Vec3& GetPos() const;
84 
86  const geom::Vec3& GetOriginalPos() const;
88  geom::Vec3 GetAltPos(const String& alt_group) const;
89 
90  std::vector<String> GetAltGroupNames() const;
91 
93 
99  String GetQualifiedName() const;
100 
102  String GetStringProperty(Prop::ID prop_id) const;
103 
105  Real GetFloatProperty(Prop::ID prop_id) const;
106 
108  int GetIntProperty(Prop::ID prop_id) const;
109 
111  unsigned long GetIndex() const;
112 
114  Real GetRadius() const;
115 
117  const String& GetElement() const;
118 
120  bool IsHetAtom() const;
121 
125  Real GetBFactor() const;
126 
127 
128  void SetBFactor(Real factor);
129 
130  void SetOccupancy(Real occ);
131 
132 
133  void SetCharge(Real charge);
134 
135  void SetMass(Real mass);
136 
137  void SetHetAtom(bool het);
138 
139  void SetRadius(Real radius);
140 
141 
142  const geom::Mat3& GetAnisou() const;
143 
144  void SetAnisou(const geom::Mat3& anisou);
148  Real GetMass() const;
149 
151  Real GetCharge() const;
152 
154  Real GetOccupancy() const;
155 
159  const impl::AtomImplPtr& Impl() const;
160 
162  impl::AtomImplPtr& Impl();
163 
164 
165  void SetElement(const String& element);
166 protected:
167 
168  GenericPropContainerImpl* GpImpl();
169 
170  const GenericPropContainerImpl* GpImpl() const;
171 
172  void CheckValidity() const;
174 };
175 
176 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os,
177  const AtomBase& atom);
178 }} // ns
179 
180 #endif // OST_ATOM_BASE_HH
181