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 } // namespace RDKit
22 
23 namespace RDKit {
24 
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)
36  : d_trajectory(NULL), d_energy(energy), d_pos(pos) {}
37  /*! \return a const pointer to the parent Trajectory
38  */
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  */
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  */
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
point.h
RDKit::Snapshot::trajectory
const Trajectory * trajectory() const
Definition: Snapshot.h:39
RDGeom::Point3D
Definition: point.h:46
RDKit::Trajectory
Definition: Trajectory.h:21
RDKit::Snapshot::Snapshot
Snapshot(boost::shared_array< double > pos, double energy=0.0)
Constructor.
Definition: Snapshot.h:35
RDKit::SnapshotVect
std::vector< Snapshot > SnapshotVect
Definition: Snapshot.h:19
RDKit
Std stuff.
Definition: Atom.h:30
RDKit::Snapshot
Definition: Snapshot.h:25
RDGeom::Point2D
Definition: point.h:258
RDKIT_TRAJECTORY_EXPORT
#define RDKIT_TRAJECTORY_EXPORT
Definition: export.h:697
RDKit::Snapshot::setEnergy
void setEnergy(double energy)
Sets the energy for this Snapshot.
Definition: Snapshot.h:56
RDKit::Snapshot::getEnergy
double getEnergy() const
Definition: Snapshot.h:52
export.h