00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef DIFFUSION_HPP
00020 #define DIFFUSION_HPP
00021
00022 #include <vector>
00023 #include <string>
00024 #include <ostream>
00025 #include <cassert>
00026
00027 #include "Geometry.hpp"
00028 #include "Reaction.hpp"
00029 #include "Bridge.hpp"
00030 #include "Site.hpp"
00031
00032 namespace Surface { class Species; }
00033
00034 namespace Reactions {
00035
00041 class Diffusion: public Reaction
00042 {
00043 public:
00049 Diffusion(const Name& name,
00050 const Surface::Species& species,
00051 const Interactions::TwoBody::Geometry& two_body_interactions,
00052 const double preexponential_factor):
00053 name_(name), species_(species),
00054 preexponential_factor_(preexponential_factor),
00055 time_(0.0), origin_ptr_(0), destination_ptr_(0),
00056 two_body_interactions_ptr_(&two_body_interactions)
00057 { };
00058
00059 private:
00061 Diffusion(const Diffusion& other,
00062 Surface::Site* origin_ptr,
00063 Surface::Site* destination_ptr):
00064 name_(other.name_), species_(other.species_),
00065 preexponential_factor_(other.preexponential_factor_),
00066 time_(other.time_),
00067 origin_ptr_(origin_ptr), destination_ptr_(destination_ptr),
00068 two_body_interactions_ptr_(&(origin_ptr->two_body_interactions(*(other.two_body_interactions_ptr_))))
00069 { if (Enabled()) UpdateTime(); }
00070
00071 Diffusion(const Diffusion&);
00072 Diffusion& operator=(const Diffusion&);
00073
00074 public:
00076 ~Diffusion()
00077 { origin_ptr_ = destination_ptr_ = 0; }
00078
00079 Name name() const
00080 { return name_; }
00081
00082 void UpdateTime();
00083
00084 double Time() const
00085 { return time_; }
00086
00087 bool Enabled() const
00088 { return origin_ptr_->species() == species_ && destination_ptr_->empty(); }
00089
00090 void operator()() {
00091 if (!Enabled()) return;
00092
00093 origin_ptr_->Clear();
00094 destination_ptr_->set_species(species_);
00095 }
00096
00097 EventContainer GetEvents(const Surface::Site* origin) const;
00098
00099 SitePtrContainer site_container() const {
00100 SitePtrContainer site_ptr_container(1, origin_ptr_);
00101 site_ptr_container.insert(site_ptr_container.end(),
00102 two_body_interactions_ptr_->neighbor_container().begin(),
00103 two_body_interactions_ptr_->neighbor_container().end());
00104 return site_ptr_container;
00105 }
00106
00107 private:
00109 double ActivationEnergy() const;
00110
00112 double InteractionEnergyBridge() const;
00113
00114 Name name_;
00115 Surface::Species species_;
00116 double preexponential_factor_;
00117 double time_;
00118 Surface::Site* origin_ptr_;
00119 Surface::Site* destination_ptr_;
00120 const Interactions::TwoBody::Geometry* const two_body_interactions_ptr_;
00121 };
00122
00123 }
00124
00125
00126
00127
00128 #endif