00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef ORDER_PARAMETER_HPP
00020 #define ORDER_PARAMETER_HPP
00021
00022 #include <map>
00023 #include <utility>
00024 #include <tr1/functional>
00025 #include "Lattice.hpp"
00026 #include "Species.hpp"
00027
00028 namespace Surface {
00029
00047 class OrderParameter: public std::tr1::function<void(Site*)>
00048 {
00049
00050 public:
00054 OrderParameter(Lattice::size_type lattice_width, int multiplicity):
00055 lattice_width_(lattice_width), multiplicity_(multiplicity), energy_counter_(0) { };
00056
00059 void operator()(const Site* site);
00060
00068
00069
00071 double p2x2(const Species& species, const Site::Name& site_name) const;
00072
00074 double p2x1(const Species& species, const Site::Name& site_name) const;
00075
00077 double sqrt3xsqrt3(const Species& species, const Site::Name& site_name) const;
00078
00080
00085
00086
00089 double TotalEnergy() const;
00090
00094 Lattice::size_type Population(const Species& species) const;
00095
00097
00098 private:
00099
00101 class Impl
00102 {
00103 public:
00105 Impl(): p(3), r(3) {};
00106
00108 void operator()(const int row, const int col);
00109
00111 double p2x2() const;
00112
00114 double p2x1() const;
00115
00117 double sqrt3xsqrt3() const;
00118
00119 private:
00120 std::vector<double> p;
00121 std::vector<double> r;
00122 };
00123
00124 typedef std::pair<Species, Site::Name> key;
00125 typedef std::map<key, Impl> Impl_map;
00126
00127 Impl_map impl_map;
00128
00129
00130 Lattice::size_type lattice_width_;
00131
00132 int multiplicity_;
00133
00134 double energy_counter_;
00135
00136 std::map<Species, Lattice::size_type> species_counter_;
00137 };
00138
00139 }
00140
00141 #endif