1 // 2 // Copyright (C) 2003-2016 Sereina Riniker, Paolo Tosco 3 // 4 // @@ All Rights Reserved @@ 5 // This file is part of the RDKit. 6 // The contents are covered by the terms of the BSD license 7 // which is included in the file license.txt, found at the root 8 // of the RDKit source tree. 9 // 10 11 #include <RDGeneral/export.h> 12 #ifndef __RD_SNAPSHOT_H__ 13 #define __RD_SNAPSHOT_H__ 14 #include <Geometry/point.h> 15 #include <boost/shared_array.hpp> 16 17 namespace RDKit { 18 class Snapshot; 19 class Trajectory; 20 typedef std::vector<Snapshot> SnapshotVect; 21 } // namespace RDKit 22 23 namespace RDKit { 24 25 class RDKIT_TRAJECTORY_EXPORT Snapshot { 26 friend class Trajectory; 27 28 public: 29 /*! \brief Constructor 30 \param pos is a pointer to an array of (numPoints * dimension) doubles; 31 numPoints and dimension must match the Trajectory which is going to 32 contain this Snapshot 33 \param energy is the energy associated with this set of coordinates 34 */ 35 Snapshot(boost::shared_array<double> pos, double energy = 0.0) d_trajectory(nullptr)36 : d_trajectory(nullptr), d_energy(energy), d_pos(pos) {} 37 /*! \return a const pointer to the parent Trajectory 38 */ trajectory()39 const Trajectory *trajectory() const { return d_trajectory; } 40 /*! \param pointNum is the atom number whose coordinates will be retrieved 41 \return the coordinates at pointNum as a Point2D object; 42 requires the Trajectory dimension to be == 2 43 */ 44 RDGeom::Point2D getPoint2D(unsigned int pointNum) const; 45 /*! \param pointNum is the atom number whose coordinates will be retrieved 46 \return the coordinates at pointNum as a Point3D object; 47 requires the Trajectory dimension to be >= 2 48 */ 49 RDGeom::Point3D getPoint3D(unsigned int pointNum) const; 50 /*! \return the energy for this Snapshot 51 */ getEnergy()52 double getEnergy() const { return d_energy; }; 53 /*! \brief Sets the energy for this Snapshot 54 \param energy the energy value assigned to this Snapshot 55 */ setEnergy(double energy)56 void setEnergy(double energy) { d_energy = energy; } 57 58 private: 59 // Pointer to the parent Trajectory object 60 const Trajectory *d_trajectory; 61 // Energy for this set of coordinates 62 double d_energy; 63 // shared array to Snapshot coordinates 64 boost::shared_array<double> d_pos; 65 }; 66 67 } // namespace RDKit 68 #endif 69