File: Trajectory.h

package info (click to toggle)
rdkit 201809.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,688 kB
  • sloc: cpp: 230,509; python: 70,501; java: 6,329; ansic: 5,427; sql: 1,899; yacc: 1,739; lex: 1,243; makefile: 445; xml: 229; fortran: 183; sh: 123; cs: 93
file content (109 lines) | stat: -rw-r--r-- 4,597 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//
// 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 = NULL);
    /*! \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);

}
#endif