tiwarylab / SGOOP

Spectral Gap Optimization of Parameters
MIT License
17 stars 7 forks source link

Setting up hyper-parameters #1

Open sbhakat opened 3 years ago

sbhakat commented 3 years ago

I was trying to plot SGOOP vectors (SGOOP1 vs SGOOP2) and plot timescales from a maxcal.traj. I have 28 reaction co-ordinates and they are already sin and cos transformed. I got a bit lost with the SGOOPs Github profile. I am exactly not sure how you set the following

"""Auxiliary Variables"""
SG = 5             # List of Spectral Gaps
RC = 28             # List of Reaction Coordinates
P = 2              # List of probabilites on RC
SEE = 5            # SGOOP Eigen exp
SEV = 5            # SGOOP Eigen values
SEVE = 5           # SGOOP Eigen vectors

Also I am a bit confused on how to plot SGOOP1 vs SGOOP2 and how to plot the population vs timescale plot (as highlighted in Figure 14 of https://www.annualreviews.org/doi/pdf/10.1146/annurev-physchem-071119-040206 or more specifically Timescale vs SGOOP index).

My notebook and maxcal.traj can be accessed here https://www.dropbox.com/sh/jtxjo2ydwvod3n7/AABAA4jkEGMUU03RsUAlZl1za?dl=0

Will be great if I can get any help in this regard!!

Best, SB

zwsmith200 commented 3 years ago

My apologies for the confusion, these are not hyper-parameters but are lists that will be used to store the results for repeated runs of SGOOP. The only parameter tuning that you should have to do is changing the number of wells in sgoop.py and changing the basinhopping parameters which you can read about here: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.basinhopping.html.

For plotting the free energy, trajectory, or anything else related to the first and second reaction coordinates you should optimize them using basinhopping then once you have the linear combinations take the dot product of them with your data. There is an example of this for making a 1D histogram in sgoop.md_prob and this dot product can be used to do the same analysis you would do on any other trajectory of collective variable values. It is also important to note that in order to get the second reaction coordinate you have to change your basinhopping optimization function to use sgoop.biased_eval instead of sgoop.rc_eval so you can "wash out" the first reaction coordinate in your calculation.

As for a plot to see the spectral gap we inspect the exponent of the eigenvalues (stored in SEE) and as a sanity check we also inspect the eigenvectors (in SEVE) to make sure they are consistent with our expectations. This is not exactly what is shown in Figure 14 but is the easiest way to inspect the gap with SGOOP.

If there is confusion about the optimization process and basinhopping I would advise looking through the tutorial a bit and reading the scipy documentation but I am also happy to address further concerns.

sbhakat commented 3 years ago

Thanks for the answer. It is bit difficult to follow as there are many notebooks and I am not sure which one to look for a full demo. Lets take this notebook for example https://github.com/tiwarylab/SGOOP/blob/master/SGOOP%20Tutorial/Unbiased%20Loop.ipynb . I am not sure where is the input maxcal.traj. Is this some global function which automatically takes into account when you are calling import sgoop? Also why are you using [-1,-1,1,1] as initial guess during optimization (is it something to do with sin and cos modification of dihedral)?