Open anotherjoshsmith opened 6 years ago
you should definitely have weights for your histogram construction. When doing reweighting from MetaD runs, there will be data read in from COLVAR or elsewhere that form the basis for calculating weights. I would pre-populate a vector of 1s to match your COLVAR and always do it as weighted w/default that value.
Another thing to take care is that the weights can get numerically out of hand if you are dealing w/exponentials, so there may be a need at some point to shift energies by a scalar (if they are used in MetaD or TV style reweighting
The current make_2d_free_energy_surface
method (crudely yanked from a previous analysis script) calculates and normalizes weights from a static 'pb.bias' column, then proceeds to create the np.histogram2d
and with weights converted to free energy. I just want to refactor this into two functions: one which creates a 'normalized_weights' column from static 'xxxx.bias', and another which creates the plot.
A default 'weights' column is a good idea to open up the possibility of analysis with unbiased trajectories. However, if someone feeds a COLVAR DataFrame based on a biased simulation, but the 'weights' are all 1s , the resultant FES would be "not even wrong" ;) I'd prefer the make_2d_free_energy_surface
method throws an error if someone tries to use it without first generating appropriate weights. I can be easily add a default 'weights' = 1
for COLVAR files from unbiased simulations by requesting that the user add an unbiased=True
argument to the plm.read_colvar
method.
@pfaendtner Do you have a good reference I can check out which discusses the numerical issue and potential fix w/ scalar shift?
Ideally, we'll neatly separate analysis and visualization methods. It seems more appropriate to normalize the weight before sending the COLVAR DataFrame to
make_2d_free_energy_surface
(especially if we're appending a 'normalized_weight' column ).