BALL  1.5.0
MOL2File.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_FORMAT_MOL2FILE_H
6 #define BALL_FORMAT_MOL2FILE_H
7 
8 #ifndef BALL_FORMAT_GENERICMOLFILE_H
10 #endif
11 
12 #ifndef BALL_MATHS_VECTOR3_H
13 # include <BALL/MATHS/vector3.h>
14 #endif
15 
16 #ifndef BALL_KERNEL_ATOMCONTAINER_H
18 #endif
19 
20 namespace BALL
21 {
22  class Atom;
23  class System;
24 
31  : public GenericMolFile
32  {
33  public:
34 
37  {
39  bool is_static;
45 
46  vector<Index> static_members;
48  };
49 
53 
56  static const String TRIPOS;
58 
62 
66 
70  MOL2File(const String& filename, File::OpenMode open_mode = std::ios::in);
71 
73  virtual ~MOL2File();
74 
76 
80 
84  virtual bool write(const System& system);
85 
89  virtual bool read(System& system);
90 
94  virtual Molecule* read();
95 
99  virtual bool write(const Molecule& molecule);
100 
102  const MOL2File& operator = (const MOL2File& file);
103 
105  Size getNumberOfSets() const { return sets_.size(); }
106 
108  SetStruct& getSet(Position i) { return sets_[i]; }
109 
111  const SetStruct& getSet(Position i) const { return sets_[i]; }
112 
114 
115  protected:
116 
118 
120 
122 
124 
126 
128 
129  String getSybylType_(const Atom& atom) const;
130 
131  bool nextLine_();
132 
133  void clear_();
134 
135  bool buildAll_(Molecule& molecule);
136 
138 
140  {
146  float charge;
147  };
148 
150  {
154  };
155 
157  {
167  };
168 
170  {
179  };
180 
182  {
185  };
186 
187 
188  vector<AtomStruct> atoms_;
189  vector<BondStruct> bonds_;
190  vector<SetStruct> sets_;
191  vector<SubstructureStruct> substructures_;
192  vector<CommentStruct> comments_;
194 
196  static const Size MAX_LENGTH_;
197  char buffer_[4096];
200  };
201 } // namespace BALL
202 
203 #endif // BALL_FORMAT_MOL2FILE_H
Definition: constants.h:13
char Atom[5]
Definition: PDBdefs.h:257
vector< BondStruct > bonds_
Definition: MOL2File.h:189
virtual bool write(const System &system)
vector< AtomStruct > atoms_
Definition: MOL2File.h:188
bool buildAll_(Molecule &molecule)
vector< CommentStruct > comments_
Definition: MOL2File.h:192
const SetStruct & getSet(Position i) const
Return the i-th TRIPOS set, const version. NOTE: no range checking is performed.
Definition: MOL2File.h:111
MOL2File(const String &filename, File::OpenMode open_mode=std::ios::in)
vector< SubstructureStruct > substructures_
Definition: MOL2File.h:191
void readBondSection_()
void readSetSection_()
static const Size MAX_LENGTH_
Definition: MOL2File.h:196
String getSybylType_(const Atom &atom) const
bool found_next_header_
Definition: MOL2File.h:199
virtual bool write(const Molecule &molecule)
SetStruct & getSet(Position i)
Return the i-th TRIPOS set. NOTE: no range checking is performed.
Definition: MOL2File.h:108
MoleculeStruct molecule_
Definition: MOL2File.h:193
vector< SetStruct > sets_
Definition: MOL2File.h:190
void readCommentSection_()
Size number_of_lines_
Definition: MOL2File.h:195
bool containsAtomChilds_(AtomContainerConstIterator &frag_it)
virtual ~MOL2File()
Destructor.
void readSubstructureSection_()
virtual Molecule * read()
void readMoleculeSection_()
void readAtomSection_()
Size getNumberOfSets() const
Return the number of TRIPOS-Sets defined in this instance.
Definition: MOL2File.h:105
static const String TRIPOS
Definition: MOL2File.h:56
String line_
Definition: MOL2File.h:198
virtual bool read(System &system)
A class used for storing TRIPOS sets.
Definition: MOL2File.h:37
vector< Index > static_members
Definition: MOL2File.h:46
std::ios::openmode OpenMode
Definition: file.h:165
#define BALL_EXPORT
Definition: COMMON/global.h:50