00001 /********************************************************************** 00002 reaction.h - Handle chemical reactions (i.e., lists of reagents and products). 00003 00004 Copyright (C) 2005 by Chris Morley 00005 00006 This file is part of the Open Babel project. 00007 For more information, see <http://openbabel.sourceforge.net/> 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation version 2 of the License. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 ***********************************************************************/ 00018 00019 #ifndef OB_REACT_H 00020 #define OB_REACT_H 00021 00022 #include <vector> 00023 #include <openbabel/mol.h> 00024 00025 #ifdef USE_BOOST 00026 #include <boost/shared_ptr.hpp> 00027 namespace std{ namespace tr1=::boost; } 00028 #else 00029 #include <tr1/memory> 00030 #endif 00031 00032 namespace OpenBabel 00033 { 00034 00041 class OBReaction : public OBBase 00042 { 00043 private: 00044 std::vector<std::tr1::shared_ptr<OBMol> > _reactants; 00045 std::vector<std::tr1::shared_ptr<OBMol> > _products; 00046 std::tr1::shared_ptr<OBMol> _ts; 00047 std::tr1::shared_ptr<OBMol> _agent; 00048 std::string _title; 00049 std::string _comment; 00050 bool _reversible; 00051 public: 00052 OBReaction() : _reversible(false) 00053 {} 00054 00055 int NumReactants() const 00056 { return _reactants.size(); } 00057 00058 int NumProducts()const 00059 { return _products.size(); } 00060 00061 void AddReactant(const std::tr1::shared_ptr<OBMol> sp) 00062 { _reactants.push_back(sp); } 00063 00064 void AddProduct(const std::tr1::shared_ptr<OBMol> sp) 00065 { _products.push_back(sp); } 00066 00067 void SetTransitionState(const std::tr1::shared_ptr<OBMol> sp) 00068 { _ts = sp; } 00069 00070 void AddAgent(const std::tr1::shared_ptr<OBMol> sp) 00071 { _agent = sp; } 00072 00073 std::tr1::shared_ptr<OBMol> GetReactant(const unsigned i) 00074 { 00075 std::tr1::shared_ptr<OBMol> sp; 00076 if(i<_reactants.size()) 00077 sp = _reactants[i]; 00078 return sp; //returns empty if out of range 00079 } 00080 std::tr1::shared_ptr<OBMol> GetProduct(const unsigned i) 00081 { 00082 std::tr1::shared_ptr<OBMol> sp; 00083 if(i<_products.size()) 00084 sp = _products[i]; 00085 return sp; //returns empty if out of range 00086 } 00087 00088 std::tr1::shared_ptr<OBMol> GetTransitionState()const 00089 { return _ts; } 00090 00091 std::tr1::shared_ptr<OBMol> GetAgent()const 00092 { return _agent; } 00093 00094 std::string GetTitle() const { return _title; } 00095 std::string GetComment() const { return _comment; } 00096 void SetTitle(const std::string& title) { _title=title; } 00097 void SetComment(const std::string& comment) { _comment=comment; } 00098 00099 bool IsReversible() const {return _reversible;} 00100 void SetReversible(bool b=true) {_reversible=b;} 00101 00102 static const char* ClassDescription() 00103 { 00104 return " reactions\n"; 00105 } 00106 }; 00107 00108 00109 } //namespace OpenBabel 00110 #endif 00111
This file is part of the documentation for Open Babel, version 2.2.0.