Loading...
Searching...
No Matches
MOLFile.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_FORMAT_MOLFILE_H
#define BALL_FORMAT_MOLFILE_H
#ifndef BALL_FORMAT_GENERICMOLFILE_H
# include <BALL/FORMAT/genericMolFile.h>
#endif
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
namespace BALL
{
class System;
class Atom;
class Molecule;
class BALL_EXPORT MOLFile
: public GenericMolFile
{
public:
struct BALL_EXPORT Property
{
static const String ATOM_MASS_DIFFERENCE;
static const String ATOM_HYDROGEN_COUNT;
static const String ATOM_STEREO_CARE_BOX;
static const String ATOM_VALENCE;
static const String ATOM_H0_DESIGNATOR;
static const String ATOM_REACTION_COMPONENT_TYPE;
static const String ATOM_REACTION_COMPONENT_NUMBER;
static const String ATOM_INVERSION_RETENTION;
static const String ATOM_EXACT_CHANGE;
static const String BOND_STEREO;
static const String BOND_TOPOLOGY;
static const String BOND_REACTING_CENTER_STATUS;
};
class BALL_EXPORT CountsStruct
{
public:
Size number_of_atoms;
Size number_of_bonds;
Size number_of_atom_lists;
bool chiral;
Size number_of_stext_entries;
Size number_of_reaction_components;
Size number_of_reactants;
Size number_of_products;
Size number_of_intermediates;
String version;
};
class BALL_EXPORT AtomStruct
{
public:
Vector3 position;
String symbol;
Index mass_difference;
Index charge;
Index parity;
Size hydrogen_count;
bool stereo_care_box;
Size valence;
bool H0_designator;
Position reaction_component_type;
Position reaction_component_number;
Position number;
Position inversion_retention;
bool exact_change;
};
class BALL_EXPORT BondStruct
{
public:
Position first_atom;
Position second_atom;
Position type;
Position stereo;
Position topology;
Position reacting_center_status;
};
MOLFile();
MOLFile(const String& filename, File::OpenMode open_mode = std::ios::in);
virtual ~MOLFile();
virtual bool write(const Molecule& molecule);
virtual bool write(const System& system);
virtual bool read(System& system);
virtual Molecule* read();
const MOLFile& operator = (const MOLFile& file);
protected:
static const String counts_format_;
static const String atom_format_;
static const String bond_format_;
Molecule* readCTAB_(std::vector<Atom*>& atom_map);
bool readCountsLine_(CountsStruct& counts);
bool readAtomLine_(AtomStruct& atom);
bool readBondLine_(BondStruct& bond);
void writeCountsLine_(const CountsStruct& counts);
void writeAtomLine_(const AtomStruct& atom);
void writeBondLine_(const BondStruct& bond);
};
} // namespace BALL
#endif // BALL_FORMAT_MOLFILE_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::Atom
Definition atom.h:90
BALL::File::OpenMode
std::ios::openmode OpenMode
Definition file.h:165
BALL::GenericMolFile::GenericMolFile
GenericMolFile()
BALL::MOLFile::AtomStruct
Definition MOLFile.h:91
BALL::MOLFile::AtomStruct::stereo_care_box
bool stereo_care_box
Definition MOLFile.h:99
BALL::MOLFile::AtomStruct::mass_difference
Index mass_difference
Definition MOLFile.h:95
BALL::MOLFile::AtomStruct::reaction_component_number
Position reaction_component_number
Definition MOLFile.h:103
BALL::MOLFile::AtomStruct::charge
Index charge
Definition MOLFile.h:96
BALL::MOLFile::AtomStruct::position
Vector3 position
Definition MOLFile.h:93
BALL::MOLFile::AtomStruct::H0_designator
bool H0_designator
Definition MOLFile.h:101
BALL::MOLFile::AtomStruct::number
Position number
Definition MOLFile.h:104
BALL::MOLFile::AtomStruct::symbol
String symbol
Definition MOLFile.h:94
BALL::MOLFile::AtomStruct::hydrogen_count
Size hydrogen_count
Definition MOLFile.h:98
BALL::MOLFile::AtomStruct::reaction_component_type
Position reaction_component_type
Definition MOLFile.h:102
BALL::MOLFile::AtomStruct::valence
Size valence
Definition MOLFile.h:100
BALL::MOLFile::AtomStruct::inversion_retention
Position inversion_retention
Definition MOLFile.h:105
BALL::MOLFile::AtomStruct::exact_change
bool exact_change
Definition MOLFile.h:106
BALL::MOLFile::AtomStruct::parity
Index parity
Definition MOLFile.h:97
BALL::MOLFile::BondStruct
Definition MOLFile.h:111
BALL::MOLFile::BondStruct::first_atom
Position first_atom
Definition MOLFile.h:113
BALL::MOLFile::BondStruct::reacting_center_status
Position reacting_center_status
Definition MOLFile.h:118
BALL::MOLFile::BondStruct::second_atom
Position second_atom
Definition MOLFile.h:114
BALL::MOLFile::BondStruct::stereo
Position stereo
Definition MOLFile.h:116
BALL::MOLFile::BondStruct::type
Position type
Definition MOLFile.h:115
BALL::MOLFile::BondStruct::topology
Position topology
Definition MOLFile.h:117
BALL::MOLFile::CountsStruct
Definition MOLFile.h:75
BALL::MOLFile::CountsStruct::number_of_atoms
Size number_of_atoms
Definition MOLFile.h:77
BALL::MOLFile::CountsStruct::number_of_bonds
Size number_of_bonds
Definition MOLFile.h:78
BALL::MOLFile::CountsStruct::number_of_atom_lists
Size number_of_atom_lists
Definition MOLFile.h:79
BALL::MOLFile::CountsStruct::number_of_products
Size number_of_products
Definition MOLFile.h:84
BALL::MOLFile::CountsStruct::version
String version
Definition MOLFile.h:86
BALL::MOLFile::CountsStruct::chiral
bool chiral
Definition MOLFile.h:80
BALL::MOLFile::CountsStruct::number_of_reactants
Size number_of_reactants
Definition MOLFile.h:83
BALL::MOLFile::CountsStruct::number_of_stext_entries
Size number_of_stext_entries
Definition MOLFile.h:81
BALL::MOLFile::CountsStruct::number_of_intermediates
Size number_of_intermediates
Definition MOLFile.h:85
BALL::MOLFile::CountsStruct::number_of_reaction_components
Size number_of_reaction_components
Definition MOLFile.h:82
BALL::MOLFile::bond_format_
static const String bond_format_
The format of an entry of the bond block.
Definition MOLFile.h:180
BALL::MOLFile::~MOLFile
virtual ~MOLFile()
Destructor.
BALL::MOLFile::MOLFile
MOLFile(const String &filename, File::OpenMode open_mode=std::ios::in)
BALL::MOLFile::writeCountsLine_
void writeCountsLine_(const CountsStruct &counts)
Write the Counts line.
BALL::MOLFile::write
virtual bool write(const Molecule &molecule)
BALL::MOLFile::read
virtual Molecule * read()
BALL::MOLFile::readBondLine_
bool readBondLine_(BondStruct &bond)
Read a line from the bond block.
BALL::MOLFile::readAtomLine_
bool readAtomLine_(AtomStruct &atom)
Read a line from the atom block.
BALL::MOLFile::readCountsLine_
bool readCountsLine_(CountsStruct &counts)
Read the Counts line of a MOL file.
BALL::MOLFile::read
virtual bool read(System &system)
BALL::MOLFile::writeBondLine_
void writeBondLine_(const BondStruct &bond)
Write a line of the bond block.
BALL::MOLFile::writeAtomLine_
void writeAtomLine_(const AtomStruct &atom)
Write a line of the atom block.
BALL::MOLFile::counts_format_
static const String counts_format_
The format of the counts line.
Definition MOLFile.h:174
BALL::MOLFile::readCTAB_
Molecule * readCTAB_(std::vector< Atom * > &atom_map)
BALL::MOLFile::atom_format_
static const String atom_format_
The format of an entry of the atom block.
Definition MOLFile.h:177
BALL::MOLFile::write
virtual bool write(const System &system)
BALL::MOLFile::MOLFile
MOLFile()
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::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
BALL::MOLFile::Property
Definition MOLFile.h:45
BALL::MOLFile::Property::BOND_REACTING_CENTER_STATUS
static const String BOND_REACTING_CENTER_STATUS
Definition MOLFile.h:70
BALL::MOLFile::Property::BOND_TOPOLOGY
static const String BOND_TOPOLOGY
Definition MOLFile.h:68
BALL::MOLFile::Property::ATOM_HYDROGEN_COUNT
static const String ATOM_HYDROGEN_COUNT
Definition MOLFile.h:49
BALL::MOLFile::Property::ATOM_MASS_DIFFERENCE
static const String ATOM_MASS_DIFFERENCE
Definition MOLFile.h:47
BALL::MOLFile::Property::ATOM_STEREO_CARE_BOX
static const String ATOM_STEREO_CARE_BOX
Definition MOLFile.h:51
BALL::MOLFile::Property::ATOM_H0_DESIGNATOR
static const String ATOM_H0_DESIGNATOR
Definition MOLFile.h:55
BALL::MOLFile::Property::ATOM_REACTION_COMPONENT_NUMBER
static const String ATOM_REACTION_COMPONENT_NUMBER
Definition MOLFile.h:59
BALL::MOLFile::Property::BOND_STEREO
static const String BOND_STEREO
Definition MOLFile.h:66
BALL::MOLFile::Property::ATOM_INVERSION_RETENTION
static const String ATOM_INVERSION_RETENTION
Definition MOLFile.h:61
BALL::MOLFile::Property::ATOM_VALENCE
static const String ATOM_VALENCE
Definition MOLFile.h:53
BALL::MOLFile::Property::ATOM_REACTION_COMPONENT_TYPE
static const String ATOM_REACTION_COMPONENT_TYPE
Definition MOLFile.h:57
BALL::MOLFile::Property::ATOM_EXACT_CHANGE
static const String ATOM_EXACT_CHANGE
Definition MOLFile.h:63
vector3.h