LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
charmm.hpp
1/*
2 This file is part of LOOS.
3
4 LOOS (Lightweight Object-Oriented Structure library)
5 Copyright (c) 2008, 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_CHARMM_HPP)
25#define LOOS_CHARMM_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
37
38namespace loos {
39
41
48 class CHARMM : public AtomicGroup {
49 public:
50 CHARMM() : _max_index(0) { }
51 virtual ~CHARMM() {}
52
53 explicit CHARMM(const std::string fname) : _max_index(0), _filename(fname) {
54 std::ifstream ifs(fname.c_str());
55 if (!ifs) {
56 throw(FileOpenError(fname));
57 }
58 read(ifs);
59 }
60
61 explicit CHARMM(std::istream &ifs) : _max_index(0), _filename("stream") {
62 read(ifs);
63 }
64
65 static pAtomicGroup create(const std::string& fname) {
66 return(pAtomicGroup(new CHARMM(fname)));
67 }
68
70 virtual CHARMM* clone(void) const;
71
73 CHARMM copy(void) const;
74
75 void read(std::istream& is);
76
77
78 private:
79
80 CHARMM(const AtomicGroup& grp) : AtomicGroup(grp) { }
81
82 uint _max_index;
83 std::string _filename;
84
85 };
86
87
88}
89
90#endif
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Class for reading a CHARMM coordinate file.
Definition charmm.hpp:48
CHARMM copy(void) const
Creates a deep copy (see AtomicGroup::copy() for more info)
Definition charmm.cpp:36
virtual CHARMM * clone(void) const
Clones an object for polymorphism (see AtomicGroup::clone() for more info)
Definition charmm.cpp:32
void read(std::istream &is)
Definition charmm.cpp:51
Error while opening a file.
Definition exceptions.hpp:175
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3