Loading...
Searching...
No Matches
MOL2File.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_FORMAT_MOL2FILE_H
#define BALL_FORMAT_MOL2FILE_H
#ifndef BALL_FORMAT_GENERICMOLFILE_H
# include <BALL/FORMAT/genericMolFile.h>
#endif
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#ifndef BALL_KERNEL_ATOMCONTAINER_H
# include <BALL/KERNEL/atomContainer.h>
#endif
namespace BALL
{
class Atom;
class System;
class BALL_EXPORT MOL2File
: public GenericMolFile
{
public:
struct BALL_EXPORT SetStruct
{
String name;
bool is_static;
String obj_type;
String sub_type;
String status;
String comment;
Size number_of_members;
vector<Index> static_members;
String dynamic_rule;
};
static const String TRIPOS;
MOL2File();
MOL2File(const String& filename, File::OpenMode open_mode = std::ios::in);
virtual ~MOL2File();
virtual bool write(const System& system);
virtual bool read(System& system);
virtual Molecule* read();
virtual bool write(const Molecule& molecule);
const MOL2File& operator = (const MOL2File& file);
Size getNumberOfSets() const { return sets_.size(); }
SetStruct& getSet(Position i) { return sets_[i]; }
const SetStruct& getSet(Position i) const { return sets_[i]; }
protected:
void readAtomSection_();
void readBondSection_();
void readMoleculeSection_();
void readSetSection_();
void readSubstructureSection_();
void readCommentSection_();
String getSybylType_(const Atom& atom) const;
bool nextLine_();
void clear_();
bool buildAll_(Molecule& molecule);
bool containsAtomChilds_(AtomContainerConstIterator& frag_it);
struct BALL_EXPORT AtomStruct
{
String name;
Vector3 position;
String type;
Position substructure;
String substructure_name;
float charge;
};
struct BALL_EXPORT BondStruct
{
Position atom1;
Position atom2;
String type;
};
struct BALL_EXPORT MoleculeStruct
{
String name;
Size number_of_atoms;
Size number_of_bonds;
Size number_of_substructures;
Size number_of_features;
Size number_of_sets;
String type;
String charge_type;
String comment;
};
struct BALL_EXPORT SubstructureStruct
{
String name;
Size root_atom;
String substructure_type;
Size dictionary_type;
String chain;
String sub_type;
Size inter_bonds;
String comment;
};
struct BALL_EXPORT CommentStruct
{
String name;
String value;
};
vector<AtomStruct> atoms_;
vector<BondStruct> bonds_;
vector<SetStruct> sets_;
vector<SubstructureStruct> substructures_;
vector<CommentStruct> comments_;
MoleculeStruct molecule_;
Size number_of_lines_;
static const Size MAX_LENGTH_;
char buffer_[4096];
String line_;
bool found_next_header_;
};
} // namespace BALL
#endif // BALL_FORMAT_MOL2FILE_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
atomContainer.h
BALL::Atom
Definition atom.h:90
BALL::File::OpenMode
std::ios::openmode OpenMode
Definition file.h:165
BALL::GenericMolFile::GenericMolFile
GenericMolFile()
BALL::MOL2File::bonds_
vector< BondStruct > bonds_
Definition MOL2File.h:189
BALL::MOL2File::write
virtual bool write(const System &system)
BALL::MOL2File::getSet
SetStruct & getSet(Position i)
Return the i-th TRIPOS set. NOTE: no range checking is performed.
Definition MOL2File.h:108
BALL::MOL2File::atoms_
vector< AtomStruct > atoms_
Definition MOL2File.h:188
BALL::MOL2File::read
virtual Molecule * read()
BALL::MOL2File::buildAll_
bool buildAll_(Molecule &molecule)
BALL::MOL2File::comments_
vector< CommentStruct > comments_
Definition MOL2File.h:192
BALL::MOL2File::MOL2File
MOL2File(const String &filename, File::OpenMode open_mode=std::ios::in)
BALL::MOL2File::substructures_
vector< SubstructureStruct > substructures_
Definition MOL2File.h:191
BALL::MOL2File::readBondSection_
void readBondSection_()
BALL::MOL2File::readSetSection_
void readSetSection_()
BALL::MOL2File::MAX_LENGTH_
static const Size MAX_LENGTH_
Definition MOL2File.h:196
BALL::MOL2File::getSybylType_
String getSybylType_(const Atom &atom) const
BALL::MOL2File::found_next_header_
bool found_next_header_
Definition MOL2File.h:199
BALL::MOL2File::write
virtual bool write(const Molecule &molecule)
BALL::MOL2File::nextLine_
bool nextLine_()
BALL::MOL2File::clear_
void clear_()
BALL::MOL2File::molecule_
MoleculeStruct molecule_
Definition MOL2File.h:193
BALL::MOL2File::buffer_
char buffer_[4096]
Definition MOL2File.h:197
BALL::MOL2File::sets_
vector< SetStruct > sets_
Definition MOL2File.h:190
BALL::MOL2File::MOL2File
MOL2File()
BALL::MOL2File::readCommentSection_
void readCommentSection_()
BALL::MOL2File::getSet
const SetStruct & getSet(Position i) const
Return the i-th TRIPOS set, const version. NOTE: no range checking is performed.
Definition MOL2File.h:111
BALL::MOL2File::number_of_lines_
Size number_of_lines_
Definition MOL2File.h:195
BALL::MOL2File::containsAtomChilds_
bool containsAtomChilds_(AtomContainerConstIterator &frag_it)
BALL::MOL2File::~MOL2File
virtual ~MOL2File()
Destructor.
BALL::MOL2File::readSubstructureSection_
void readSubstructureSection_()
BALL::MOL2File::readMoleculeSection_
void readMoleculeSection_()
BALL::MOL2File::readAtomSection_
void readAtomSection_()
BALL::MOL2File::getNumberOfSets
Size getNumberOfSets() const
Return the number of TRIPOS-Sets defined in this instance.
Definition MOL2File.h:105
BALL::MOL2File::TRIPOS
static const String TRIPOS
Definition MOL2File.h:56
BALL::MOL2File::line_
String line_
Definition MOL2File.h:198
BALL::MOL2File::read
virtual bool read(System &system)
BALL::Molecule
Definition molecule.h:31
BALL::String
Definition string.h:57
BALL::System
Definition KERNEL/system.h:40
genericMolFile.h
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
BALL::AtomContainerConstIterator
ConstBidirectionalIterator< Composite, AtomContainer, Composite::CompositeIterator, AtomContainerIteratorTraits > AtomContainerConstIterator
Definition atomContainerIterator.h:94
BALL::MOL2File::AtomStruct
Definition MOL2File.h:140
BALL::MOL2File::AtomStruct::type
String type
Definition MOL2File.h:143
BALL::MOL2File::AtomStruct::charge
float charge
Definition MOL2File.h:146
BALL::MOL2File::AtomStruct::substructure
Position substructure
Definition MOL2File.h:144
BALL::MOL2File::AtomStruct::name
String name
Definition MOL2File.h:141
BALL::MOL2File::AtomStruct::substructure_name
String substructure_name
Definition MOL2File.h:145
BALL::MOL2File::AtomStruct::position
Vector3 position
Definition MOL2File.h:142
BALL::MOL2File::BondStruct
Definition MOL2File.h:150
BALL::MOL2File::BondStruct::atom2
Position atom2
Definition MOL2File.h:152
BALL::MOL2File::BondStruct::atom1
Position atom1
Definition MOL2File.h:151
BALL::MOL2File::BondStruct::type
String type
Definition MOL2File.h:153
BALL::MOL2File::CommentStruct
Definition MOL2File.h:182
BALL::MOL2File::CommentStruct::name
String name
Definition MOL2File.h:183
BALL::MOL2File::CommentStruct::value
String value
Definition MOL2File.h:184
BALL::MOL2File::MoleculeStruct
Definition MOL2File.h:157
BALL::MOL2File::MoleculeStruct::type
String type
Definition MOL2File.h:164
BALL::MOL2File::MoleculeStruct::comment
String comment
Definition MOL2File.h:166
BALL::MOL2File::MoleculeStruct::number_of_substructures
Size number_of_substructures
Definition MOL2File.h:161
BALL::MOL2File::MoleculeStruct::number_of_features
Size number_of_features
Definition MOL2File.h:162
BALL::MOL2File::MoleculeStruct::name
String name
Definition MOL2File.h:158
BALL::MOL2File::MoleculeStruct::charge_type
String charge_type
Definition MOL2File.h:165
BALL::MOL2File::MoleculeStruct::number_of_bonds
Size number_of_bonds
Definition MOL2File.h:160
BALL::MOL2File::MoleculeStruct::number_of_sets
Size number_of_sets
Definition MOL2File.h:163
BALL::MOL2File::MoleculeStruct::number_of_atoms
Size number_of_atoms
Definition MOL2File.h:159
BALL::MOL2File::SetStruct
A class used for storing TRIPOS sets.
Definition MOL2File.h:37
BALL::MOL2File::SetStruct::sub_type
String sub_type
Definition MOL2File.h:41
BALL::MOL2File::SetStruct::name
String name
Definition MOL2File.h:38
BALL::MOL2File::SetStruct::status
String status
Definition MOL2File.h:42
BALL::MOL2File::SetStruct::comment
String comment
Definition MOL2File.h:43
BALL::MOL2File::SetStruct::number_of_members
Size number_of_members
Definition MOL2File.h:44
BALL::MOL2File::SetStruct::is_static
bool is_static
Definition MOL2File.h:39
BALL::MOL2File::SetStruct::obj_type
String obj_type
Definition MOL2File.h:40
BALL::MOL2File::SetStruct::static_members
vector< Index > static_members
Definition MOL2File.h:46
BALL::MOL2File::SetStruct::dynamic_rule
String dynamic_rule
Definition MOL2File.h:47
BALL::MOL2File::SubstructureStruct
Definition MOL2File.h:170
BALL::MOL2File::SubstructureStruct::root_atom
Size root_atom
Definition MOL2File.h:172
BALL::MOL2File::SubstructureStruct::substructure_type
String substructure_type
Definition MOL2File.h:173
BALL::MOL2File::SubstructureStruct::inter_bonds
Size inter_bonds
Definition MOL2File.h:177
BALL::MOL2File::SubstructureStruct::name
String name
Definition MOL2File.h:171
BALL::MOL2File::SubstructureStruct::chain
String chain
Definition MOL2File.h:175
BALL::MOL2File::SubstructureStruct::dictionary_type
Size dictionary_type
Definition MOL2File.h:174
BALL::MOL2File::SubstructureStruct::comment
String comment
Definition MOL2File.h:178
BALL::MOL2File::SubstructureStruct::sub_type
String sub_type
Definition MOL2File.h:176
vector3.h