Loading...
Searching...
No Matches
data.h
Go to the documentation of this file.
/**********************************************************************
data.h - Global data and resource file parsers.
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
This file is part of the Open Babel project.
For more information, see <http://openbabel.org/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifndef OB_DATA_H
#define OB_DATA_H
#include <openbabel/babelconfig.h>
#include <stdio.h>
#include <cstring>
#include <fstream>
#include <vector>
#include <string>
#include <cstring>
namespace OpenBabel
{
class OBAtom;
class OBMol;
class OBAPI OBGlobalDataBase
{
protected:
bool _init;
const char *_dataptr;
std::string _filename;
std::string _dir;
std::string _subdir;
std::string _envvar;
public:
OBGlobalDataBase(): _init(false), _dataptr(nullptr) { }
virtual ~OBGlobalDataBase() {}
void Init();
virtual size_t GetSize() { return 0;}
void SetReadDirectory(char *dir) { _dir = dir; }
void SetEnvironmentVariable(char *var) { _envvar = var; }
virtual void ParseLine(const char*) {}
};
class OBAPI OBAtomHOF
{
private:
std::string _element,_method,_desc,_unit;
double _T,_value;
int _charge;
int _multiplicity;
public:
OBAtomHOF(std::string element,int charge,
std::string method,std::string desc,
double T,double value,int multiplicity,
std::string unit)
{
_element = element;
_charge = charge;
_method = method;
_desc = desc;
_T = T;
_value = value;
_multiplicity = multiplicity;
_unit = unit;
}
~OBAtomHOF() {}
std::string Element() { return _element; }
int Charge() { return _charge; }
std::string Method() { return _method; }
std::string Desc() { return _desc; }
double T() { return _T; }
double Value() { return _value; }
int Multiplicity() { return _multiplicity; }
std::string Unit() { return _unit; }
};
class OBAPI OBAtomicHeatOfFormationTable : public OBGlobalDataBase
{
std::vector<OBAtomHOF> _atomhof;
public:
OBAtomicHeatOfFormationTable(void);
~OBAtomicHeatOfFormationTable() {}
size_t GetSize() { return _atomhof.size(); }
void ParseLine(const char*);
int GetHeatOfFormation(std::string elem,
int charge,
std::string method,
double T, double *dhof0,
double *dhofT,double *S0T);
};
// class introduction in data.cpp
class OBAPI OBTypeTable : public OBGlobalDataBase
{
int _linecount;
unsigned int _ncols,_nrows;
int _from,_to;
std::vector<std::string> _colnames;
std::vector<std::vector<std::string> > _table;
public:
OBTypeTable(void);
~OBTypeTable() {}
void ParseLine(const char*);
size_t GetSize() { return _table.size(); }
bool SetFromType(const char*);
bool SetToType(const char*);
bool Translate(char *to, const char *from); // to, from
bool Translate(std::string &to, const std::string &from); // to, from
std::string Translate(const std::string &from);
std::string GetFromType();
std::string GetToType();
};
OB_EXTERN OBTypeTable ttab;
class OBAPI OBResidueData : public OBGlobalDataBase
{
int _resnum;
std::vector<std::string> _resname;
std::vector<std::vector<std::string> > _resatoms;
std::vector<std::vector<std::pair<std::string,int> > > _resbonds;
//variables used only temporarily for parsing resdata.txt
std::vector<std::string> _vatmtmp;
std::vector<std::pair<std::string,int> > _vtmp;
public:
OBResidueData();
void ParseLine(const char*);
size_t GetSize() { return _resname.size(); }
bool SetResName(const std::string &);
int LookupBO(const std::string &);
int LookupBO(const std::string &, const std::string&);
bool LookupType(const std::string &,std::string&,int&);
bool AssignBonds(OBMol &);
};
OB_EXTERN OBResidueData resdat;
} // end namespace OpenBabel
#endif //DATA_H
OB_EXTERN
#define OB_EXTERN
Definition atom.h:27
OpenBabel::OBAtomHOF::OBAtomHOF
OBAtomHOF(std::string element, int charge, std::string method, std::string desc, double T, double value, int multiplicity, std::string unit)
Initialize Heat of Formation for atom.
Definition data.h:103
OpenBabel::OBAtomHOF::Charge
int Charge()
Return the formal charge.
Definition data.h:123
OpenBabel::OBAtomHOF::Value
double Value()
Return the (energy) value.
Definition data.h:131
OpenBabel::OBAtomHOF::Desc
std::string Desc()
Return specification of the measurement/calculation type.
Definition data.h:127
OpenBabel::OBAtomHOF::Unit
std::string Unit()
Return the (energy) unit.
Definition data.h:135
OpenBabel::OBAtomHOF::Multiplicity
int Multiplicity()
Return the multiplicity.
Definition data.h:133
OpenBabel::OBAtomHOF::Element
std::string Element()
Return the chemical element.
Definition data.h:121
OpenBabel::OBAtomHOF::T
double T()
Return the temperature.
Definition data.h:129
OpenBabel::OBAtomHOF::~OBAtomHOF
~OBAtomHOF()
Destructor.
Definition data.h:119
OpenBabel::OBAtomHOF::Method
std::string Method()
Return the method used for the measurement/calculation.
Definition data.h:125
OpenBabel::OBAtom
Atom class.
Definition atom.h:72
OpenBabel::OBAtomicHeatOfFormationTable::~OBAtomicHeatOfFormationTable
~OBAtomicHeatOfFormationTable()
Destructor.
Definition data.h:157
OpenBabel::OBAtomicHeatOfFormationTable::OBAtomicHeatOfFormationTable
OBAtomicHeatOfFormationTable(void)
Constructor.
Definition data.cpp:51
OpenBabel::OBAtomicHeatOfFormationTable::GetSize
size_t GetSize()
Definition data.h:160
OpenBabel::OBGlobalDataBase::SetEnvironmentVariable
void SetEnvironmentVariable(char *var)
Set the environment variable to use before calling Init().
Definition data.h:70
OpenBabel::OBGlobalDataBase::_dir
std::string _dir
Data directory for file if _envvar fails.
Definition data.h:54
OpenBabel::OBGlobalDataBase::OBGlobalDataBase
OBGlobalDataBase()
Constructor.
Definition data.h:60
OpenBabel::OBGlobalDataBase::_init
bool _init
Whether the data been read already.
Definition data.h:51
OpenBabel::OBGlobalDataBase::_dataptr
const char * _dataptr
Default data table if file is unreadable.
Definition data.h:52
OpenBabel::OBGlobalDataBase::SetReadDirectory
void SetReadDirectory(char *dir)
Set the directory before calling Init().
Definition data.h:68
OpenBabel::OBGlobalDataBase::_subdir
std::string _subdir
Subdirectory (if using environment variable).
Definition data.h:55
OpenBabel::OBGlobalDataBase::GetSize
virtual size_t GetSize()
Definition data.h:66
OpenBabel::OBGlobalDataBase::~OBGlobalDataBase
virtual ~OBGlobalDataBase()
Destructor.
Definition data.h:62
OpenBabel::OBGlobalDataBase::_envvar
std::string _envvar
Environment variable to check first.
Definition data.h:56
OpenBabel::OBGlobalDataBase::_filename
std::string _filename
File to search for.
Definition data.h:53
OpenBabel::OBGlobalDataBase::ParseLine
virtual void ParseLine(const char *)
Specified by particular table classes (parses an individual data line).
Definition data.h:72
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel::OBResidueData
Table of common biomolecule residues (for PDB or other files).
Definition data.h:233
OpenBabel::OBResidueData::OBResidueData
OBResidueData()
Definition data.cpp:430
OpenBabel::OBResidueData::GetSize
size_t GetSize()
Definition data.h:248
OpenBabel::OBResidueData::ParseLine
void ParseLine(const char *)
Specified by particular table classes (parses an individual data line).
Definition data.cpp:558
OpenBabel::OBTypeTable
Atom Type Translation Table.
Definition data.h:187
OpenBabel::OBTypeTable::OBTypeTable
OBTypeTable(void)
Definition data.cpp:246
OpenBabel::OBTypeTable::~OBTypeTable
~OBTypeTable()
Definition data.h:197
OpenBabel::OBTypeTable::GetSize
size_t GetSize()
Definition data.h:202
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
OpenBabel::resdat
OB_EXTERN OBResidueData resdat
Global OBResidueData biomolecule residue database.
Definition data.h:270
OpenBabel::ttab
OB_EXTERN OBTypeTable ttab
Definition data.h:225