this repository is housed at https://github.com/js850/histogram_reweighting

this repository will contain modules related to histogram reweighting.  

Examples:
combining energy histograms from parallel tempering runs to calculate heat
capacity plots

combining 2d histograms (energy + order parameter. Q) from parallel tempering runs
to calculate free enegy plots F(Q), or average order parameter <Q(T)>

combining and reweighting histograms from biased sampling runs (not implemented)


#############################################################################
The idea behind how histogram reweighting can be viewed as a minimization
procedure is as follows
#############################################################################

from a simulation at temperature T you find the probability of finding energy
E is P(E,T).  We know this can be compared to the density of states n(E) as

    P(E,T) = n(E) exp(-E/T_i) / w_i

Where w_i is a constant that is not known.  The density of 
states is independent of temperature, so we can use it to find
P(E) at any other temperature, or Z(T), etc.  But our estimate of n(E) from
one temperature is not very good.  So we combine P(E,T) multiple simulations
at different temperatures to get a better estimate of n(E).  
Define R the log deviation for each bin from the estimate of the density of states

    R(E,T_i) = log(n_F(E)) - log(w_i) - log( P(E,T_i) * exp(E/T_i) )

we want to make each R(E,T_i) as small as possible.  Define an "energy" function

    CHI2 = sum_E sum_i P(E,T_i) * |R(E,T_i)|^2

Where each R(E,T_i) contributes weight proportional to P(E,T_i) to the sum to
make sure those with better statistics are more heavily weighted.  To solve
the problem we find the set of {n_F(E), w_i} which minimize CHI2
