Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _RD_CONFORMER_H
00011 #define _RD_CONFORMER_H
00012
00013 #include <Geometry/point.h>
00014 #include <RDGeneral/types.h>
00015 #include <boost/smart_ptr.hpp>
00016
00017 namespace RDKit {
00018 class ROMol;
00019
00020
00021 class ConformerException : public std::exception {
00022 public:
00023
00024 ConformerException(const char *msg) : _msg(msg) {};
00025
00026 ConformerException(const std::string msg) : _msg(msg) {};
00027
00028 const char *message () const { return _msg.c_str(); };
00029 ~ConformerException () throw () {};
00030 private:
00031 std::string _msg;
00032 };
00033
00034
00035
00036
00037
00038
00039
00040
00041 class Conformer {
00042 public:
00043
00044 friend class ROMol;
00045
00046
00047 Conformer() : df_is3D(true), d_id(0), dp_mol(NULL) {
00048 d_positions.clear();
00049 };
00050
00051
00052 Conformer(unsigned int numAtoms) : df_is3D(true), d_id(0), dp_mol(NULL) {
00053 if(numAtoms){
00054 d_positions.resize(numAtoms, RDGeom::Point3D(0.0, 0.0, 0.0));
00055 } else {
00056 d_positions.resize(0);
00057 d_positions.clear();
00058 }
00059 };
00060
00061
00062 Conformer(const Conformer &other);
00063
00064
00065 ~Conformer() {};
00066
00067
00068
00069 void resize(unsigned int size) {
00070 d_positions.resize(size);
00071 }
00072
00073
00074 void reserve(unsigned int size) {
00075 d_positions.reserve(size);
00076 }
00077
00078
00079 ROMol &getOwningMol() const {return *dp_mol;}
00080
00081
00082 const RDGeom::POINT3D_VECT &getPositions() const;
00083
00084
00085 RDGeom::POINT3D_VECT &getPositions();
00086
00087
00088 const RDGeom::Point3D &getAtomPos(unsigned int atomId) const;
00089
00090
00091 RDGeom::Point3D &getAtomPos(unsigned int atomId);
00092
00093
00094 inline void setAtomPos(unsigned int atomId, const RDGeom::Point3D &position) {
00095
00096 if (atomId >= d_positions.size()) {
00097 d_positions.resize(atomId+1, RDGeom::Point3D(0.0, 0.0, 0.0));
00098 }
00099 d_positions[atomId] = position;
00100 }
00101
00102
00103 inline unsigned int getId() const {return d_id;}
00104
00105
00106 inline void setId(unsigned int id) {
00107 d_id = id;
00108 }
00109
00110
00111 inline unsigned int getNumAtoms() const {
00112 return d_positions.size();
00113 }
00114
00115 inline bool is3D() const {
00116 return df_is3D;
00117 }
00118 inline void set3D(bool v) {
00119 df_is3D=v;
00120 }
00121 protected:
00122
00123 void setOwningMol(ROMol *mol);
00124
00125
00126 void setOwningMol(ROMol &mol);
00127
00128 private:
00129 bool df_is3D;
00130 unsigned int d_id;
00131 ROMol *dp_mol;
00132 RDGeom::POINT3D_VECT d_positions;
00133 };
00134
00135 typedef boost::shared_ptr<Conformer> CONFORMER_SPTR;
00136 }
00137
00138 #endif