25#if !defined(LOOS_AMBER_HPP)
35#include <boost/algorithm/string.hpp>
36#include <boost/tokenizer.hpp>
38#include <loos_defs.hpp>
39#include <AtomicGroup.hpp>
40#include <LineReader.hpp>
63 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
67 FormatSpec() : repeat(1), type(
'?'), width(0), precision(0) { }
76 AmberLineReader(std::istream& is) :
LineReader(is) { }
77 AmberLineReader(std::istream& is, std::string& s) :
LineReader(is, s) { }
79 virtual void stripComment(std::string& s)
const {
80 if (s.compare(0, 8,
"%COMMENT") == 0)
87 Amber() : natoms(0), nres(0), nbonh(0), mbona(0) { }
91 explicit Amber(
const std::string& fname)
92 : natoms(0), nres(0), nbonh(0), mbona(0) {
93 std::ifstream ifs(fname.c_str());
101 explicit Amber(std::istream& ifs)
102 : natoms(0), nres(0), nbonh(0), mbona(0), reader(ifs) {
106 static pAtomicGroup create(
const std::string& fname) {
107 return(pAtomicGroup(
new Amber(fname)));
113 return(
new Amber(*
this));
125 void read(std::istream& ifs);
128 std::string
title()
const {
return(_title); }
134 FormatSpec parseFormat(
const std::string& expected_types,
const std::string& where);
138 void parseResidueLabels();
139 void parseResiduePointers();
140 void assignResidues(
void);
141 void parseBonds(
const uint);
142 void parsePointers();
144 void parseAtomNames();
145 void parseBoxDimensions();
146 void parseAmoebaRegularBondNumList();
147 void parseAmoebaRegularBondList(
const uint);
154 std::vector<T> readBlock(
const int field_width) {
157 std::string line = reader.
line();
158 if (line[0] ==
'%') {
162 std::istringstream iss(line);
164 while (iss >> std::setw(field_width) >> d)
176 uint natoms, nres, nbonh, mbona, _amoeba_regular_bond_num_list;
178 std::vector<std::string> residue_labels;
179 std::vector<uint> residue_pointers;
181 AmberLineReader reader;
Class for reading in AMBER parmtop/coord files...
Definition amber.hpp:60
std::string title() const
Return the title.
Definition amber.hpp:128
virtual Amber * clone(void) const
Clones an object for polymorphism...
Definition amber.hpp:112
void read(std::istream &ifs)
Parse the parmtop file.
Definition amber.cpp:300
Amber(const std::string &fname)
Read in a parmtop file.
Definition amber.hpp:91
Amber copy(void) const
Deep copy.
Definition amber.hpp:117
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
AtomicGroup copy(void) const
Creates a deep copy of this group.
Definition AtomicGroup.cpp:59
Error while opening a file.
Definition exceptions.hpp:175
Class for reading line-by-line from a file while tracking line numbers and stripping comments.
Definition LineReader.hpp:39
virtual bool getNext()
Get the next line from the file, returning true if successful.
Definition LineReader.cpp:38
virtual std::string line() const
The currently read line.
Definition LineReader.cpp:62
virtual std::istream & stream() const
Access the internal stream pointer.
Definition LineReader.cpp:30
virtual std::string name() const
Access the name associated with the internal stream.
Definition LineReader.cpp:33
virtual void push_back(const std::string &s)
Put a line back onto the file (virtually)
Definition LineReader.cpp:58
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3