Generated on Tue Dec 16 13:34:02 2008 for ell-3.0.0 by doxygen 1.5.1

src/ell/SC_PartitionFunction.cc

Go to the documentation of this file.
00001 #include "ell/StateCollector.hh"
00002 
00003 #include <cmath>
00004 
00005 namespace ell
00006 {
00007     
00008     SC_PartitionFunction::SC_PartitionFunction()
00009       : SC_Counting(), Z(0.0)
00010     {
00011     }
00012     
00013     SC_PartitionFunction::~SC_PartitionFunction()
00014     {
00015     }
00016 
00017     
00018     void
00019     SC_PartitionFunction::
00020 	add(const State& s)
00021     {
00022           // increase the partition function
00023         Z += exp( - s.getEnergy() / LandscapeTopology::BOLTZMANN_KT );
00024           // store the state
00025         SC_Counting::add(s);
00026     }
00027 
00028     
00029     double
00030     SC_PartitionFunction::
00031 	getZ( void ) const
00032     {
00033         return Z;
00034     }
00035     
00036     double
00037     SC_PartitionFunction::
00038 	getEnergy( void ) const
00039     {
00040         return - LandscapeTopology::BOLTZMANN_KT * log( Z );
00041     }
00042     
00043 
00044 }
00045 
00046 
00047 
00048 namespace ell
00049 {
00050     
00051     SC_PartitionFunction_Shifted::
00052 	SC_PartitionFunction_Shifted( const LandscapeTopology& lt )
00053       : SC_Counting()
00054         , Z_shifted(0.0)
00055         , MIN_E( lt.getMFEState()->getEnergy() )
00056     {
00057     }
00058     
00059     SC_PartitionFunction_Shifted::
00060 	SC_PartitionFunction_Shifted( const double MinE )
00061       : Z_shifted(0.0)
00062         , MIN_E( MinE )
00063     {
00064     }
00065     
00066     SC_PartitionFunction_Shifted::
00067 	~SC_PartitionFunction_Shifted()
00068     {
00069     }
00070 
00071     
00072     void
00073     SC_PartitionFunction_Shifted::
00074 	add(const State& s)
00075     {
00076         assertbiu(s.getEnergy() >= MIN_E
00077             , "the used MIN_E is HIGHER than the energy of the collected State");
00078           // increase the shifted partition function
00079         Z_shifted += exp( (MIN_E - s.getEnergy()) 
00080                             / LandscapeTopology::BOLTZMANN_KT );
00081           // store the state
00082         SC_Counting::add(s);
00083     }
00084 
00085     
00086     double
00087     SC_PartitionFunction_Shifted::
00088 	getZ( void ) const
00089     {
00090         return Z_shifted / exp( MIN_E / LandscapeTopology::BOLTZMANN_KT );
00091     }
00092     
00093     double
00094     SC_PartitionFunction_Shifted::
00095 	getEnergy( void ) const
00096     {
00097         return MIN_E - LandscapeTopology::BOLTZMANN_KT * log( Z_shifted );
00098     }
00099     
00100 
00101 }