MTK++ Latest version: 0.2.0
Reads and writes SDF format files. More...
#include <mtkpp/src/Parsers/sdfParser.h>
Public Member Functions | |
sdfParser () | |
sdfParser Constructor | |
~sdfParser () | |
sdfParser Destructor | |
void | Read (const std::string &i, collection *c, const bool &bohr=false) |
Read SDF formatted files. | |
int | ReadMolecule (std::ifstream &os, molecule *m, const bool &bohr=false) |
Read a molecule from a sd files. | |
int | numMolecules (const std::string &i) |
Determine the number of molecules in an sd file. | |
void | Write (const std::string &o, collection *c) |
Write SDF formatted file. | |
void | Write (std::ostream &os, molecule *m) |
Write SDF formatted file. | |
virtual void | Read () |
Read function. | |
virtual void | Write () |
Write function. | |
std::ofstream & | OpenFile (std::string fileName) |
Write function. | |
std::string | determineElement (std::string &name) |
Preceive element symbol from the atom name. | |
void | setError (int i) |
Error handling within Parsers. | |
bool | getError () |
Error handling within dcParser. | |
void | setErrorMessage (std::string s) |
Error handling within Parsers. | |
std::string | getErrorMessage () |
Error handling within Parsers. | |
Protected Types | |
typedef std::vector< molecule * > ::iterator | moleculeIterator |
molecule iterator | |
typedef std::vector < submolecule * >::iterator | subMoleculeIterator |
submolecule iterator | |
typedef std::vector< atom * > ::iterator | atomIterator |
atom iterator | |
typedef std::map< int, Bond * > ::iterator | BondMapIterator |
Bond Map Iterator. | |
Protected Member Functions | |
bool | ReadAtomLine (std::string &fileline, AtomLine *pthisAtom) |
int | getAtom (int i) |
Get atom. | |
Protected Attributes | |
collection * | pCollection |
collection pointer | |
molecule * | pMolecule |
molecule pointer | |
submolecule * | pSubMolecule |
submolecule pointer | |
atom * | pAtom |
atom pointer | |
Bond * | pBond |
Bond pointer. | |
atom * | pBondAtom1 |
atom pointer used in bonding section | |
atom * | pBondAtom2 |
atom pointer used in bonding section | |
std::map< int, int > | itsAtomMap |
internal atom mapping local to molParser | |
connections * | pConnections |
std::map< int, Bond * > | moleculeBondMap |
Bond Map. | |
std::ofstream | outputFileStream |
Output File Stream. | |
bool | bError |
Error occured. | |
std::string | errorMessage |
Error message. | |
unsigned int | NUM_INDENTS_PER_SPACE |
Reads and writes SDF format files.
1,2,2,5,5-Pentamethyl-3-imidazoline 3-oxide CDK 1/18/06,2:25 NMRShiftDB 2189 http://www.nmrshiftdb.org:8080/portal/_kbohn_Fri Nov 08 10:04:07 11 11 0 0 0 0 0 0 0 0999 V2000 -0.0897 1.5477 -0.1004 N 0 0 0 0 0 0 0 0 0 0 0 0 0.0827 0.2946 0.0756 C 0 0 0 0 0 0 0 0 0 0 0 0 -1.2603 -0.3941 0.1731 C 0 0 0 0 0 0 0 0 0 0 0 0 -2.2226 0.5932 -0.3763 N 0 0 0 0 0 0 0 0 0 0 0 0 -1.5189 1.8781 -0.1370 C 0 0 0 0 0 0 0 0 0 0 0 0 -1.9639 2.4834 1.1958 C 0 0 0 0 0 0 0 0 0 0 0 0 -1.8006 2.8552 -1.2801 C 0 0 0 0 0 0 0 0 0 0 0 0 0.9570 2.4917 -0.2359 O 0 0 0 0 0 0 0 0 0 0 0 0 -1.2676 -1.6724 -0.6676 C 0 0 0 0 0 0 0 0 0 0 0 0 -1.5939 -0.7107 1.6323 C 0 0 0 0 0 0 0 0 0 0 0 0 -3.3909 0.5845 0.5141 C 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 0 0 0 0 5 6 1 0 0 0 0 5 7 1 0 0 0 0 2 3 1 0 0 0 0 1 8 1 0 0 0 0 3 4 1 0 0 0 0 3 9 1 0 0 0 0 4 5 1 0 0 0 0 3 10 1 0 0 0 0 5 1 1 0 0 0 0 4 11 1 0 0 0 0 M CHG 1 1 1 M CHG 1 8 -1 M END > <Spectrum 13C 0> 132.1;0.0D;1|23.3;0.0Q;8|23.3;0.0Q;9|23.5;0.0Q;5|23.5;0.0Q;6|26.1;0.0Q;10|60.5;0.0S;2|90.0;0.0S;4| > <Field Strength [MHz]> 0:50.328 > <Solvent> 0:Acetone-D6 ((CD3)2CO) > <Temperature [K]> 0:298 $$$$
typedef std::vector<molecule*>::iterator MTKpp::sdfParser::moleculeIterator [protected] |
molecule iterator
typedef std::vector<submolecule*>::iterator MTKpp::sdfParser::subMoleculeIterator [protected] |
submolecule iterator
typedef std::vector<atom*>::iterator MTKpp::sdfParser::atomIterator [protected] |
atom iterator
typedef std::map<int, Bond*>::iterator MTKpp::sdfParser::BondMapIterator [protected] |
Bond Map Iterator.
MTKpp::sdfParser::sdfParser | ( | ) |
sdfParser Constructor
References pBond, pBondAtom1, pBondAtom2, pConnections, pMolecule, and pSubMolecule.
MTKpp::sdfParser::~sdfParser | ( | ) |
sdfParser Destructor
References pConnections.
void MTKpp::sdfParser::Read | ( | const std::string & | i, |
collection * | c, | ||
const bool & | bohr = false |
||
) |
Read SDF formatted files.
i | Input file |
c | collection pointer |
bohr | Convert coordinates to Bohr or not |
References MTKpp::submolecule::addAtom(), MTKpp::molecule::addBond(), MTKpp::atom::addBondedAtom(), MTKpp::collection::addMolecule(), MTKpp::molecule::addProperty(), MTKpp::molecule::addSubMolecule(), MTKpp::ANG2BOHR, MTKpp::connections::assignAngles(), MTKpp::connections::assignImpropers(), MTKpp::connections::assignTorsions(), MTKpp::AtomLine::element, MTKpp::molecule::getAtom(), MTKpp::elements::getElement(), MTKpp::collection::getNumberMolecules(), MTKpp::molecule::getNumSubMolecules(), MTKpp::molecule::inFileType, pAtom, pBond, pBondAtom1, pBondAtom2, pConnections, MTKpp::collection::pElements, pMolecule, pSubMolecule, ReadAtomLine(), MTKpp::atom::setCoords(), MTKpp::atom::setElement(), MTKpp::atom::setFileID(), MTKpp::atom::setFormalCharge(), MTKpp::molecule::setMolId(), MTKpp::molecule::setName(), MTKpp::submolecule::setName(), MTKpp::submolecule::setSubMolId(), MTKpp::molecule::setTotalCharge(), MTKpp::splitString(), MTKpp::string2UInt(), MTKpp::AtomLine::x, MTKpp::AtomLine::y, and MTKpp::AtomLine::z.
Referenced by main().
int MTKpp::sdfParser::ReadMolecule | ( | std::ifstream & | os, |
molecule * | m, | ||
const bool & | bohr = false |
||
) |
Read a molecule from a sd files.
os | input stream |
m | molecule pointer |
bohr | Convert coordinates to Bohr or not |
References MTKpp::submolecule::addAtom(), MTKpp::molecule::addBond(), MTKpp::atom::addBondedAtom(), MTKpp::molecule::addProperty(), MTKpp::molecule::addSubMolecule(), MTKpp::ANG2BOHR, MTKpp::connections::assignAngles(), MTKpp::connections::assignImpropers(), MTKpp::connections::assignTorsions(), MTKpp::AtomLine::element, MTKpp::molecule::getAtom(), MTKpp::elements::getElement(), MTKpp::collection::getNumberMolecules(), MTKpp::molecule::getNumSubMolecules(), MTKpp::molecule::getParent(), MTKpp::molecule::inFileType, pAtom, pBond, pBondAtom1, pBondAtom2, pCollection, pConnections, MTKpp::collection::pElements, pSubMolecule, ReadAtomLine(), MTKpp::atom::setCoords(), MTKpp::atom::setElement(), MTKpp::atom::setFileID(), MTKpp::molecule::setMolId(), MTKpp::molecule::setName(), MTKpp::submolecule::setName(), MTKpp::submolecule::setSubMolId(), MTKpp::AtomLine::x, MTKpp::AtomLine::y, and MTKpp::AtomLine::z.
Referenced by main().
int MTKpp::sdfParser::numMolecules | ( | const std::string & | i | ) |
Determine the number of molecules in an sd file.
i | Input file |
void MTKpp::sdfParser::Write | ( | const std::string & | o, |
collection * | c | ||
) |
Write SDF formatted file.
o | Output file |
c | collection pointer |
References MTKpp::Bond::atom1, MTKpp::Bond::atom2, MTKpp::molecule::getAtomList(), MTKpp::molecule::getBondMap(), MTKpp::atom::getColIndex(), MTKpp::atom::getElement(), MTKpp::atom::getFormalCharge(), MTKpp::collection::getMoleculeList(), MTKpp::molecule::getName(), MTKpp::molecule::getNumAtoms(), MTKpp::molecule::getNumBonds(), MTKpp::molecule::getProperties(), MTKpp::atom::getX(), MTKpp::atom::getY(), MTKpp::atom::getZ(), itsAtomMap, moleculeBondMap, pAtom, pBond, pMolecule, MTKpp::Bond::stereo, MTKpp::element::symbol, MTKpp::Bond::topology, and MTKpp::Bond::type.
Referenced by main().
void MTKpp::sdfParser::Write | ( | std::ostream & | os, |
molecule * | m | ||
) |
Write SDF formatted file.
os | Output stream |
m | molecule pointer |
References MTKpp::Bond::atom1, MTKpp::Bond::atom2, MTKpp::molecule::getAtomList(), MTKpp::molecule::getBondMap(), MTKpp::atom::getColIndex(), MTKpp::atom::getElement(), MTKpp::atom::getFormalCharge(), MTKpp::molecule::getName(), MTKpp::molecule::getNumAtoms(), MTKpp::molecule::getNumBonds(), MTKpp::molecule::getProperties(), MTKpp::atom::getX(), MTKpp::atom::getY(), MTKpp::atom::getZ(), itsAtomMap, moleculeBondMap, pAtom, pBond, MTKpp::Bond::stereo, MTKpp::element::symbol, MTKpp::Bond::topology, and MTKpp::Bond::type.
bool MTKpp::sdfParser::ReadAtomLine | ( | std::string & | fileline, |
AtomLine * | pthisAtom | ||
) | [protected] |
\ Read a single line of the input file
fileline | Actual line |
pthisAtom | AtomLine struct to temporary store atom info |
References MTKpp::AtomLine::element, MTKpp::FieldExists(), MTKpp::removeCharacter(), MTKpp::AtomLine::x, MTKpp::AtomLine::y, and MTKpp::AtomLine::z.
Referenced by Read(), and ReadMolecule().
int MTKpp::sdfParser::getAtom | ( | int | i | ) | [protected] |
void MTKpp::baseParser::Read | ( | ) | [virtual, inherited] |
Read function.
Referenced by MTKpp::acParser::Read(), and MTKpp::molParser::Read().
void MTKpp::baseParser::Write | ( | ) | [virtual, inherited] |
Write function.
Referenced by MTKpp::gaussianParser::Write(), MTKpp::molParser::Write(), MTKpp::zmatParser::Write(), and MTKpp::dcParser::Write().
std::ofstream & MTKpp::baseParser::OpenFile | ( | std::string | fileName | ) | [inherited] |
std::string MTKpp::baseParser::determineElement | ( | std::string & | name | ) | [inherited] |
Preceive element symbol from the atom name.
References MTKpp::GetAlphaChar(), and MTKpp::removeCharacter().
Referenced by MTKpp::pdbParser::Read(), and MTKpp::prepParser::readFragment().
void MTKpp::baseParser::setError | ( | int | i | ) | [inline, inherited] |
Error handling within Parsers.
i | error |
References MTKpp::baseParser::bError.
Referenced by MTKpp::dcParser::dcParser(), MTKpp::prepParser::openFile(), MTKpp::paramParser::paramParser(), MTKpp::pamParser::Read(), MTKpp::pdbParser::Read(), MTKpp::prepParser::Read(), MTKpp::dcParser::Read(), MTKpp::dcParser::ReadElecEnergy(), MTKpp::dcParser::ReadHOF(), MTKpp::stdLibParser::stdLibParser(), and MTKpp::prepParser::Write().
bool MTKpp::baseParser::getError | ( | ) | [inline, inherited] |
Error handling within dcParser.
References MTKpp::baseParser::bError.
Referenced by main().
void MTKpp::baseParser::setErrorMessage | ( | std::string | s | ) | [inline, inherited] |
Error handling within Parsers.
s | error message |
References MTKpp::baseParser::errorMessage.
Referenced by MTKpp::prepParser::openFile(), MTKpp::paramParser::paramParser(), MTKpp::pamParser::Read(), MTKpp::pdbParser::Read(), MTKpp::prepParser::Read(), MTKpp::dcParser::ReadElecEnergy(), MTKpp::dcParser::ReadHOF(), MTKpp::stdLibParser::stdLibParser(), and MTKpp::prepParser::Write().
std::string MTKpp::baseParser::getErrorMessage | ( | ) | [inline, inherited] |
Error handling within Parsers.
References MTKpp::baseParser::errorMessage.
Referenced by main().
collection* MTKpp::sdfParser::pCollection [protected] |
collection pointer
Referenced by ReadMolecule().
molecule* MTKpp::sdfParser::pMolecule [protected] |
molecule pointer
Referenced by Read(), sdfParser(), and Write().
submolecule* MTKpp::sdfParser::pSubMolecule [protected] |
submolecule pointer
Referenced by Read(), ReadMolecule(), and sdfParser().
atom* MTKpp::sdfParser::pAtom [protected] |
atom pointer
Referenced by Read(), ReadMolecule(), and Write().
Bond* MTKpp::sdfParser::pBond [protected] |
Bond pointer.
Referenced by Read(), ReadMolecule(), sdfParser(), and Write().
atom* MTKpp::sdfParser::pBondAtom1 [protected] |
atom pointer used in bonding section
Referenced by Read(), ReadMolecule(), and sdfParser().
atom* MTKpp::sdfParser::pBondAtom2 [protected] |
atom pointer used in bonding section
Referenced by Read(), ReadMolecule(), and sdfParser().
std::map<int, int> MTKpp::sdfParser::itsAtomMap [protected] |
connections* MTKpp::sdfParser::pConnections [protected] |
Referenced by Read(), ReadMolecule(), sdfParser(), and ~sdfParser().
std::map<int, Bond*> MTKpp::sdfParser::moleculeBondMap [protected] |
std::ofstream MTKpp::baseParser::outputFileStream [protected, inherited] |
Output File Stream.
Referenced by MTKpp::baseParser::OpenFile().
bool MTKpp::baseParser::bError [protected, inherited] |
Error occured.
Referenced by MTKpp::baseParser::baseParser(), MTKpp::baseParser::getError(), and MTKpp::baseParser::setError().
std::string MTKpp::baseParser::errorMessage [protected, inherited] |
Error message.
Referenced by MTKpp::baseParser::baseParser(), MTKpp::baseParser::getErrorMessage(), MTKpp::prepParser::openFile(), MTKpp::paramParser::paramParser(), MTKpp::pamParser::Read(), MTKpp::pdbParser::Read(), MTKpp::prepParser::Read(), MTKpp::prepParser::readFragment(), MTKpp::baseParser::setErrorMessage(), MTKpp::stdLibParser::stdLibParser(), and MTKpp::prepParser::Write().
unsigned int MTKpp::baseParser::NUM_INDENTS_PER_SPACE [protected, inherited] |
Referenced by MTKpp::baseParser::baseParser().
Generated on Fri Dec 23 2011 09:28:58 for MTK++ by Doxygen 1.7.5.1