25#if !defined(LOOS_PDB_HPP)
37#include <loos_defs.hpp>
38#include <AtomicGroup.hpp>
39#include <exceptions.hpp>
40#include <pdb_remarks.hpp>
43#include <utils_structural.hpp>
71 PDB() : _max_index(0), _show_charge(
false), _auto_ter(
true), _has_cryst(
false),
72 strictness_policy(
false), _missing_q(
false), _missing_b(
false),
73 _missing_segid(
false), _fname(
"<not set>") { }
77 explicit PDB(
const std::string& fname)
78 : _max_index(0), _show_charge(false), _auto_ter(true),
79 _has_cryst(false), strictness_policy(false),
80 _missing_q(false), _missing_b(false), _missing_segid(false),
83 std::ifstream ifs(fname.c_str());
90 explicit PDB(std::istream& ifs)
91 : _max_index(0), _show_charge(false), _auto_ter(true),
92 _has_cryst(false), strictness_policy(false),
93 _missing_q(false), _missing_b(false), _missing_segid(false),
99 static pAtomicGroup create(
const std::string& fname) {
100 return(pAtomicGroup(
new PDB(fname)));
104 virtual PDB*
clone(
void)
const;
107 PDB
copy(
void)
const;
117 void showCharge(
bool b);
120 bool showCharge(
void)
const;
121 bool strict(
void)
const;
122 bool autoTerminate(
void)
const;
125 void strict(
const bool b);
131 void autoTerminate(
bool b);
138 const UnitCell& unitCell(
void);
139 void unitCell(
const UnitCell&);
142 friend std::ostream&
operator<<(std::ostream&,
const PDB&);
144 std::string asString()
const;
147 void read(std::istream& is);
150 class ComparePatoms {
151 bool operator()(
const pAtom& a,
const pAtom& b) {
return(a->id() < b->id()); }
156 PDB(
const AtomicGroup& grp) : AtomicGroup(grp), _show_charge(false), _auto_ter(true), _has_cryst(false) { }
158 bool emptyString(
const std::string&);
160 bool isMissingOccupancies()
const {
return(_missing_q); }
161 bool isMissingBFactors()
const {
return(_missing_b); }
162 bool isMissingSegids()
const {
return(_missing_segid); }
163 bool isMissingFields()
const {
return(_missing_q || _missing_b || _missing_segid); }
167 void parseRemark(
const std::string&);
168 void parseAtomRecord(
const std::string&);
169 void parseConectRecord(
const std::string&);
170 void parseCryst1Record(
const std::string&);
173 std::string atomAsString(
const pAtom p)
const;
176 friend std::ostream& FormatConectRecords(std::ostream&,
const PDB&);
179 pAtom findAtom(
const int i);
187 bool strictness_policy;
188 bool _missing_q, _missing_b, _missing_segid;
192 std::map<int, pAtom> _atomid_to_patom;
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Error while opening a file.
Definition exceptions.hpp:175
PDB reading/writing class.
Definition pdb.hpp:69
PDB(const std::string &fname)
Read in PDB from a filename.
Definition pdb.hpp:77
friend std::ostream & operator<<(std::ostream &, const PDB &)
Output as a PDB.
Definition pdb.cpp:493
void read(std::istream &is)
Read in PDB from an ifstream.
Definition pdb.cpp:333
Remarks & remarks(void)
Accessor for the remarks object...
Definition pdb.cpp:578
PDB copy(void) const
Creates a deep copy (see AtomicGroup::copy() for more info)
Definition pdb.cpp:532
PDB(std::istream &ifs)
Read in a PDB from an ifstream.
Definition pdb.hpp:90
virtual PDB * clone(void) const
Clones an object for polymorphism (see AtomicGroup::clone() for more info)
Definition pdb.cpp:545
static PDB fromAtomicGroup(const AtomicGroup &)
Class method for creating a PDB from an AtomicGroup.
Definition pdb.cpp:549
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3