00001 /* Copyright 2004 00002 Stanford University 00003 00004 This file is part of the DSR PDB Library. 00005 00006 The DSR PDB Library is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU Lesser General Public License as published by 00008 the Free Software Foundation; either version 2.1 of the License, or (at your 00009 option) any later version. 00010 00011 The DSR PDB Library is distributed in the hope that it will be useful, but 00012 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00014 License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with the DSR PDB Library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00019 MA 02111-1307, USA. */ 00020 00021 #ifndef DSR_PDB_ATOM_H 00022 #define DSR_PDB_ATOM_H 00023 00024 #include <dsrpdb/Point.h> 00025 #include <dsrpdb/PDB_index.h> 00026 #include <string> 00027 00028 namespace dsrpdb { 00030 class Atom { 00031 friend class Residue; 00032 public: 00034 typedef PDB_index<Atom> Index; 00035 00037 enum Type {INVALID, C,N,H,O, S}; 00038 00040 inline Atom(); 00042 00045 inline Index index() const; 00047 inline void set_index(Index i); 00048 //inline Atom_label label() const; 00050 inline const Point &cartesian_coords() const; 00052 inline void set_cartesian_coords(const Point &pt); 00053 inline bool operator<(const Atom &o) const; 00054 inline bool operator==(const Atom& al) const; 00055 inline bool operator!=(const Atom& al) const; 00057 inline float occupancy() const ; 00059 inline void set_occupancy(float o); 00061 inline float temperature_factor() const; 00063 inline void set_temperature_factor(float f); 00065 inline const char *segment_id() const; 00067 inline void set_segment_id(const char *c); 00069 inline const char* element() const; 00071 inline void set_element(const char *c); 00073 inline const char *charge() const; 00075 inline void set_charge(const char*c); 00077 inline Type type() const; 00079 inline void set_type(Type t); 00080 protected: 00081 Index index_; 00082 Type type_; 00083 Point coordinates_; 00084 float occupancy_, temp_factor_; 00085 std::string segID_, element_, charge_; 00086 }; 00087 00088 inline Atom::Index Atom::index() const { 00089 assert(index_); 00090 return index_; 00091 } 00092 00093 inline void Atom::set_index(Atom::Index i) { 00094 assert(i); 00095 index_=i; 00096 } 00097 00098 inline Atom::Type Atom::type() const {return type_;} 00099 00100 inline void Atom::set_type(Atom::Type t) {type_=t;} 00101 00102 inline const Point &Atom::cartesian_coords() const { 00103 return coordinates_; 00104 } 00105 00106 inline void Atom::set_cartesian_coords(const Point &pt){ 00107 coordinates_=pt; 00108 } 00109 00110 inline bool Atom::operator<(const Atom &o) const { 00111 if (index_ < o.index_) return true; 00112 else if (index_ > o.index_) return false; 00113 else return type_ < o.type_; 00114 } 00115 00116 inline bool Atom::operator==(const Atom &o) const { 00117 if (index_ != o.index_) return false; 00118 else return type_ == o.type_; 00119 } 00120 00121 inline bool Atom::operator!=(const Atom &o) const { 00122 return !operator==(o); 00123 } 00124 00125 inline float Atom::occupancy() const { 00126 return occupancy_; 00127 } 00128 00129 inline void Atom::set_occupancy(float o) { 00130 occupancy_=o; 00131 } 00132 00133 inline float Atom::temperature_factor() const { 00134 return temp_factor_; 00135 } 00136 00137 inline void Atom::set_temperature_factor(float f) { 00138 temp_factor_=f; 00139 } 00140 00141 inline const char *Atom::segment_id() const { 00142 return segID_.c_str(); 00143 } 00144 00145 inline void Atom::set_segment_id(const char *c) { 00146 segID_=c; 00147 } 00148 00149 inline const char* Atom::element() const { 00150 return element_.c_str(); 00151 } 00152 00153 inline void Atom::set_element(const char *c) { 00154 element_=c; 00155 } 00156 00157 inline const char *Atom::charge() const { 00158 return charge_.c_str(); 00159 } 00160 00161 inline void Atom::set_charge(const char*c) { 00162 charge_=c; 00163 } 00164 00165 inline Atom::Atom(): type_(Atom::INVALID) { 00166 } 00167 /*Atom::Atom(Atom_label label): label_(label){ 00168 index_=0; 00169 occupancy_=1.0; temp_factor_=0.0; 00170 }*/ 00171 00172 } 00173 #endif