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