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