Trajectory.h
Go to the documentation of this file.
//
// Copyright (C) 2003-2016 Sereina Riniker, Paolo Tosco
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <RDGeneral/export.h>
#ifndef RD_TRAJECTORY_H
#define RD_TRAJECTORY_H
#include <vector>
#include "Snapshot.h"
namespace RDKit {
class ROMol;
class RDKIT_TRAJECTORY_EXPORT Trajectory {
public:
/*! \brief Constructor
\param dimension represents the dimensionality of this Trajectory's
coordinate tuples; this is normally 2 (2D coordinates) or 3 (3D
coordinates) \param numPoints is the number of coordinate tuples associated
to each Snapshot \param snapshotVect (optional, defaults to NULL) is a
pointer to a SnapshotVect used to initialize the Trajectory; if not NULL,
the Trajectory takes ownership of the SnapshotVect
*/
Trajectory(unsigned int dimension, unsigned int numPoints,
SnapshotVect *snapshotVect = nullptr);
/*! \brief Copy constructor
*/
Trajectory(const Trajectory &other);
/*! \return the dimensionality of this Trajectory's coordinate tuples
*/
unsigned int dimension() const { return d_dimension; }
/*! \return the number of coordinate tuples associated to each Snapshot
*/
unsigned int numPoints() const { return d_numPoints; }
/*! \return the number of Snapshots associated to this Trajectory
*/
size_t size() const { return d_snapshotVect->size(); }
/*! \brief Appends a Snapshot to this Trajectory
\param s is the Snapshot to be added; the Trajectory
takes ownership of the snapshot coordinates
\return the zero-based index position of the added Snapshot
*/
unsigned int addSnapshot(const Snapshot &s);
/*! \param snapshotNum is the zero-based index of the retrieved Snapshot
\return a const reference to the relevant Snapshot in the Trajectory
*/
const Snapshot &getSnapshot(unsigned int snapshotNum) const;
/*! \brief Inserts a Snapshot into this Trajectory
\param snapshotNum is the zero-based index of the Trajectory's Snapshot
before which the Snapshot s will be inserted
\param s is the Snapshot to be inserted; the Trajectory
takes ownership of the snapshot coordinates
\return the zero-based index position of the inserted Snapshot
*/
unsigned int insertSnapshot(unsigned int snapshotNum, Snapshot s);
/*! \brief Removes a Snapshot from this Trajectory
\param snapshotNum is the zero-based index of Snapshot to be removed
\return the zero-based index position of the Snapshot after the
removed one; if the last Snapshot was removed, it returns the
size of the trajectory
*/
unsigned int removeSnapshot(unsigned int snapshotNum);
//! Clear all Snapshots from a Trajectory
void clear() { d_snapshotVect->clear(); }
//! Add conformations from the Trajectory to a molecule
/*!
\param mol - ROMol to which Conformers with coordinates from the Trajectory
will be added; the Trajectory must have numPoints() == mol.getNumAtoms()
\param from - the first Snapshot that will be added as a Conformer; defaults
to -1 (first available) \param to - the last Snapshot that will be added as
a Conformer; defaults to -1 (all) \return the number of conformations added
*/
unsigned int addConformersToMol(ROMol &mol, int from = -1, int to = -1);
private:
// dimensionality of this Trajectory's coordinates;
// this is normally 2 (2D coordinates) or 3 (3D coordinates)
const unsigned int d_dimension;
// number of coordinate tuples associated to each Snapshot
const unsigned int d_numPoints;
// smart_ptr to vector holding the Snapshots for this Trajectory
boost::shared_ptr<SnapshotVect> d_snapshotVect;
};
/*! \brief Reads coordinates from an AMBER trajectory file
into the traj Trajectory object
\return the number of Snapshot objects read in
*/
RDKIT_TRAJECTORY_EXPORT unsigned int readAmberTrajectory(
const std::string &fName, Trajectory &traj);
/*! \brief Reads coordinates from a GROMOS trajectory file
into the traj Trajectory object
\return the number of Snapshot objects read in
*/
RDKIT_TRAJECTORY_EXPORT unsigned int readGromosTrajectory(
const std::string &fName, Trajectory &traj);
} // namespace RDKit
#endif
Snapshot.h
RDKit::ROMol
Definition: ROMol.h:178
RDKit::Snapshot
Definition: Snapshot.h:26
RDKit::Trajectory
Definition: Trajectory.h:21
RDKit::Trajectory::removeSnapshot
unsigned int removeSnapshot(unsigned int snapshotNum)
Removes a Snapshot from this Trajectory.
RDKit::Trajectory::clear
void clear()
Clear all Snapshots from a Trajectory.
Definition: Trajectory.h:71
RDKit::Trajectory::addConformersToMol
unsigned int addConformersToMol(ROMol &mol, int from=-1, int to=-1)
Add conformations from the Trajectory to a molecule.
RDKit::Trajectory::addSnapshot
unsigned int addSnapshot(const Snapshot &s)
Appends a Snapshot to this Trajectory.
RDKit::Trajectory::size
size_t size() const
Definition: Trajectory.h:44
RDKit::Trajectory::getSnapshot
const Snapshot & getSnapshot(unsigned int snapshotNum) const
RDKit::Trajectory::Trajectory
Trajectory(const Trajectory &other)
Copy constructor.
RDKit::Trajectory::Trajectory
Trajectory(unsigned int dimension, unsigned int numPoints, SnapshotVect *snapshotVect=nullptr)
Constructor.
RDKit::Trajectory::dimension
unsigned int dimension() const
Definition: Trajectory.h:38
RDKit::Trajectory::numPoints
unsigned int numPoints() const
Definition: Trajectory.h:41
RDKit::Trajectory::insertSnapshot
unsigned int insertSnapshot(unsigned int snapshotNum, Snapshot s)
Inserts a Snapshot into this Trajectory.
export.h
RDKIT_TRAJECTORY_EXPORT
#define RDKIT_TRAJECTORY_EXPORT
Definition: export.h:489
RDKit
Std stuff.
Definition: Abbreviations.h:18
RDKit::readGromosTrajectory
RDKIT_TRAJECTORY_EXPORT unsigned int readGromosTrajectory(const std::string &fName, Trajectory &traj)
Reads coordinates from a GROMOS trajectory file into the traj Trajectory object.
RDKit::readAmberTrajectory
RDKIT_TRAJECTORY_EXPORT unsigned int readAmberTrajectory(const std::string &fName, Trajectory &traj)
Reads coordinates from an AMBER trajectory file into the traj Trajectory object.
RDKit::SnapshotVect
std::vector< Snapshot > SnapshotVect
Definition: Snapshot.h:20