RDKit
Open-source cheminformatics and machine learning.
Snapshot.h
Go to the documentation of this file.
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 #ifndef __RD_SNAPSHOT_H__
12 #define __RD_SNAPSHOT_H__
13 #include <Geometry/point.h>
14 #include <boost/shared_array.hpp>
15 
16 namespace RDKit {
17  class Snapshot;
18  class Trajectory;
19  typedef std::vector<Snapshot> SnapshotVect;
20 }
21 
22 namespace RDKit {
23 
24 class Snapshot {
25  friend class Trajectory;
26  public:
27  /*! \brief Constructor
28  \param pos is a pointer to an array of (numPoints * dimension) doubles;
29  numPoints and dimension must match the Trajectory which is going to
30  contain this Snapshot
31  \param energy is the energy associated with this set of coordinates
32  */
33  Snapshot(boost::shared_array<double> pos, double energy = 0.0) :
34  d_trajectory(NULL),
35  d_energy(energy),
36  d_pos(pos) {}
37  /*! \return a const pointer to the parent Trajectory
38  */
39  const Trajectory *trajectory() const {
40  return d_trajectory;
41  }
42  /*! \param pointNum is the atom number whose coordinates will be retrieved
43  \return the coordinates at pointNum as a Point2D object;
44  requires the Trajectory dimension to be == 2
45  */
46  RDGeom::Point2D getPoint2D(unsigned int pointNum) const;
47  /*! \param pointNum is the atom number whose coordinates will be retrieved
48  \return the coordinates at pointNum as a Point3D object;
49  requires the Trajectory dimension to be >= 2
50  */
51  RDGeom::Point3D getPoint3D(unsigned int pointNum) const;
52  /*! \return the energy for this Snapshot
53  */
54  double getEnergy() const {
55  return d_energy;
56  };
57  /*! \brief Sets the energy for this Snapshot
58  \param energy the energy value assigned to this Snapshot
59  */
60  void setEnergy(double energy) {
61  d_energy = energy;
62  }
63  private:
64  // Pointer to the parent Trajectory object
65  const Trajectory *d_trajectory;
66  // Energy for this set of coordinates
67  double d_energy;
68  // shared array to Snapshot coordinates
69  boost::shared_array<double> d_pos;
70 };
71 
72 }
73 #endif
double getEnergy() const
Definition: Snapshot.h:54
Snapshot(boost::shared_array< double > pos, double energy=0.0)
Constructor.
Definition: Snapshot.h:33
RDGeom::Point3D getPoint3D(unsigned int pointNum) const
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
void setEnergy(double energy)
Sets the energy for this Snapshot.
Definition: Snapshot.h:60
std::vector< Snapshot > SnapshotVect
Definition: Snapshot.h:18
RDGeom::Point2D getPoint2D(unsigned int pointNum) const
const Trajectory * trajectory() const
Definition: Snapshot.h:39