LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
mdtraj.hpp
1/*
2 This file is part of LOOS.
3
4 LOOS (Lightweight Object-Oriented Structure library)
5 Copyright (c) 2023, Tod D. Romo, Alan Grossfield
6 Department of Biochemistry and Biophysics
7 School of Medicine & Dentistry, University of Rochester
8
9 This package (LOOS) is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation under version 3 of the License.
12
13 This package is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22
23
24#if !(defined LOOS_MDTRAJ_HPP)
25#define LOOS_MDTRAJ_HPP
26
27#include <ios>
28#include <fstream>
29#include <sstream>
30#include <iostream>
31
32#include <stdexcept>
33
34#include <loos_defs.hpp>
35#include <AtomicGroup.hpp>
36#include <H5Cpp.h>
37#include <boost/json.hpp>
38
39
40namespace loos {
41
43
49 class MDTraj : public AtomicGroup {
50 public:
51 MDTraj() : _max_index(0) { }
52 virtual ~MDTraj() {}
53
54 explicit MDTraj(const std::string fname) : _max_index(0), _filename(fname) {
55 read();
56 }
57
58 explicit MDTraj(std::istream &ifs) : _max_index(0), _filename("stream") {
59 throw(LOOSError("Creating an MDTraj from a stream isn't implemented"));
60 }
61
62 static pAtomicGroup create(const std::string& fname) {
63 return(pAtomicGroup(new MDTraj(fname)));
64 }
65
67 virtual MDTraj* clone(void) const;
68
70 MDTraj copy(void) const;
71
72 void read();
73
74
75 private:
76
77 MDTraj(const AtomicGroup& grp) : AtomicGroup(grp) { }
78
79 uint _max_index;
80 std::string _filename;
81
82 std::string getTopology(H5::H5File &file);
83 void topologyToAtoms(const boost::json::value& topology);
84 void topologyToBonds(const boost::json::value& topology);
85
86 };
87
88
89}
90
91#endif
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Generic LOOS exception.
Definition exceptions.hpp:40
Class for reading a MDTraj HDF5 file.
Definition mdtraj.hpp:49
MDTraj copy(void) const
Creates a deep copy (see AtomicGroup::copy() for more info)
Definition mdtraj.cpp:35
virtual MDTraj * clone(void) const
Clones an object for polymorphism (see AtomicGroup::clone() for more info)
Definition mdtraj.cpp:31
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3