Loading...
Searching...
No Matches
reaction.h
Go to the documentation of this file.
/**********************************************************************
reaction.h - Handle chemical reactions (i.e., lists of reagents and products).
Copyright (C) 2005 by Chris Morley
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_REACT_H
#define OB_REACT_H
#include <vector>
#include <openbabel/shared_ptr.h>
#include <openbabel/base.h>
namespace OpenBabel
{
class OBMol;
class OBReaction : public OBBase
{
private:
std::vector<obsharedptr<OBMol> > _reactants;
std::vector<obsharedptr<OBMol> > _products;
std::vector<obsharedptr<OBMol> > _agents;
obsharedptr<OBMol> _ts;
std::string _title;
std::string _comment;
bool _reversible;
public:
OBReaction() : _reversible(false)
{}
int NumReactants() const
{ return static_cast<int> (_reactants.size()); }
int NumProducts()const
{ return static_cast<int> (_products.size()); }
int NumAgents() const
{
return static_cast<int> (_agents.size());
}
void AddReactant(const obsharedptr<OBMol> sp)
{ _reactants.push_back(sp); }
void AddProduct(const obsharedptr<OBMol> sp)
{ _products.push_back(sp); }
void SetTransitionState(const obsharedptr<OBMol> sp)
{ _ts = sp; }
void AddAgent(const obsharedptr<OBMol> sp)
{ _agents.push_back(sp); }
obsharedptr<OBMol> GetReactant(const unsigned i)
{
obsharedptr<OBMol> sp;
if(i<_reactants.size())
sp = _reactants[i];
return sp; //returns empty if out of range
}
obsharedptr<OBMol> GetProduct(const unsigned i)
{
obsharedptr<OBMol> sp;
if(i<_products.size())
sp = _products[i];
return sp; //returns empty if out of range
}
obsharedptr<OBMol> GetAgent(const unsigned i)
{
obsharedptr<OBMol> sp;
if (i<_agents.size())
sp = _agents[i];
return sp; //returns empty if out of range
}
obsharedptr<OBMol> GetTransitionState()const
{ return _ts; }
std::string GetTitle() const { return _title; }
std::string GetComment() const { return _comment; }
void SetTitle(const std::string& title) { _title=title; }
void SetComment(const std::string& comment) { _comment=comment; }
bool IsReversible() const {return _reversible;}
void SetReversible(bool b=true) {_reversible=b;}
static const char* ClassDescription()
{
return " reactions\n";
}
bool Clear()
{
_reactants.clear();
_products.clear();
_agents.clear();
_ts.reset();
_title.clear();
_comment.clear();
_reversible = false;
return true;
}
};
} //namespace OpenBabel
#endif
base.h
Base classes to build a graph.
OpenBabel::OBBase
Base Class.
Definition base.h:240
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel::OBReaction::SetComment
void SetComment(const std::string &comment)
Definition reaction.h:102
OpenBabel::OBReaction::GetComment
std::string GetComment() const
Definition reaction.h:100
OpenBabel::OBReaction::NumReactants
int NumReactants() const
Definition reaction.h:51
OpenBabel::OBReaction::SetTitle
void SetTitle(const std::string &title)
Definition reaction.h:101
OpenBabel::OBReaction::NumAgents
int NumAgents() const
Definition reaction.h:57
OpenBabel::OBReaction::GetTransitionState
obsharedptr< OBMol > GetTransitionState() const
Definition reaction.h:96
OpenBabel::OBReaction::AddReactant
void AddReactant(const obsharedptr< OBMol > sp)
Definition reaction.h:62
OpenBabel::OBReaction::IsReversible
bool IsReversible() const
Definition reaction.h:104
OpenBabel::OBReaction::GetTitle
std::string GetTitle() const
Definition reaction.h:99
OpenBabel::OBReaction::AddProduct
void AddProduct(const obsharedptr< OBMol > sp)
Definition reaction.h:65
OpenBabel::OBReaction::GetProduct
obsharedptr< OBMol > GetProduct(const unsigned i)
Definition reaction.h:81
OpenBabel::OBReaction::SetTransitionState
void SetTransitionState(const obsharedptr< OBMol > sp)
Definition reaction.h:68
OpenBabel::OBReaction::GetAgent
obsharedptr< OBMol > GetAgent(const unsigned i)
Definition reaction.h:88
OpenBabel::OBReaction::NumProducts
int NumProducts() const
Definition reaction.h:54
OpenBabel::OBReaction::GetReactant
obsharedptr< OBMol > GetReactant(const unsigned i)
Definition reaction.h:74
OpenBabel::OBReaction::SetReversible
void SetReversible(bool b=true)
Definition reaction.h:105
OpenBabel::OBReaction::ClassDescription
static const char * ClassDescription()
Definition reaction.h:107
OpenBabel::OBReaction::AddAgent
void AddAgent(const obsharedptr< OBMol > sp)
Definition reaction.h:71
OpenBabel::OBReaction::Clear
bool Clear()
Clear any and all data associated with this object.
Definition reaction.h:112
OpenBabel::OBReaction::OBReaction
OBReaction()
Definition reaction.h:48
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
shared_ptr.h
Shared pointer.
obsharedptr
#define obsharedptr
Definition shared_ptr.h:25