-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of OPES in Colvars #709
base: master
Are you sure you want to change the base?
Conversation
Hi @giacomofiorin and @jhenin! It seems that in the latex document the default value cannot be an equation. Otherwise the HTML files are not generated. For example, I want to add the following key description: \item %
\labelkey{opes_metad|kernel_cutoff}
\keydef
{kernel{\textunderscore}cutoff}{%
\texttt{opes{\textunderscore}metad}}{%
Truncate kernels at this distance, in units of $\sigma$}{%
positive decimal}{%
$\sqrt{2*\mathrm{barrier}/k_\mathrm{B}T/(1-1/\gamma)}$}{%
If the value of $(\boldsymbol{\xi}-\boldsymbol{\xi}')^T \Sigma^{-1}(\boldsymbol{\xi}-\boldsymbol{\xi}')$ is larger than the square of this value, then $G(\boldsymbol{\xi}, \boldsymbol{\xi}')$ is evaluated as zero.} What is the proper way to do it to generate the HTML document? Update: |
Thanks for bringing OPES to Colvars! |
Nice to see you! Your idea of OPES is really amazing! |
bb33891
to
17dac3b
Compare
We should probably rename them to something clearer. |
The code is mainly based on OPESmetad.cpp in PLUMED. The exploration mode and parallelization over multiple nodes are not implemented yet.
1. Describe what are in the .kernels.dat 2. Document briefly the approaches of manually estimating the PMF
PLUMED does not write "min_" and "max_" for periodic CVs.
I cannot rely on std::isinf since "-ffinite-math" in GCC or clang can make the function always return false.
This commit also adds the output of bias temperature computed from the bias factor.
[update-doc]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a quick round looking mostly at the documentation. The added source file is very large, so I'll take a look at the differences between PLUMED's version and this one.
One thing that really stands out is that the user is presented with a lot of restrictions, which for the most part come from the fact that biases are distributed among SMP threads. However, there isn't a huge performance gain from distributing biases. I think it would be okay to run all biases in sequence whenever a special dependency is present, as we do already in several cases:
Lines 1016 to 1042 in a587282
if (proxy->check_smp_enabled() == COLVARS_OK && !biases_need_main_thread) { | |
if (use_scripted_forces && !scripting_after_biases) { | |
// calculate biases and scripted forces in parallel | |
error_code |= proxy->smp_biases_script_loop(); | |
} else { | |
// calculate biases in parallel | |
error_code |= proxy->smp_biases_loop(); | |
} | |
} else { | |
if (use_scripted_forces && !scripting_after_biases) { | |
error_code |= calc_scripted_forces(); | |
} | |
// Straight loop over biases on a single thread | |
cvm::increase_depth(); | |
for (bi = biases_active()->begin(); bi != biases_active()->end(); bi++) { | |
error_code |= (*bi)->update(); | |
if (cvm::get_error()) { | |
cvm::decrease_depth(); | |
return error_code; | |
} | |
} | |
cvm::decrease_depth(); | |
} |
I'll comment on #712: would implementing that change allow to remove the restrictions that this OPES implementation has compared to the PLUMED one, which people are already familiar with?
\texttt{opes{\textunderscore}metad}}{% | ||
Set the identifier for this replica (required only for independent jobs)}{% | ||
string}{% | ||
replica index (only if MPI\cvnamdonly{ or Charm++} is used)}{% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is multiple-walkers supported without MPI/Charm++?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Multiple-walkers OPES requires MPI or Charm++.
\end{tabular} | ||
\end{table} | ||
|
||
\cvsubsubsec{General options}{sec:colvarbias_opes_general_options} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If FILE
is not needed because Colvars restarts from a single checkpoint file, then this could be maybe clarified somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. (see 3dec310)
\texttt{opes{\textunderscore}metad}}{% | ||
Merge kernels if closer than this threshold, in units of $\sigma$}{% | ||
positive decimal}{% | ||
1.0}{% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This keyword is listed as mandatory/compulsory in PLUMED, so maybe it shouldn't have a default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Compulsory keywords in PLUMED could have default values (see https://www.plumed.org/doc-master/user-doc/html/_o_p_e_s__m_e_t_a_d__e_x_p_l_o_r_e.html):
COMPRESSION_THRESHOLD ( default=1 ) merge kernels if closer than this threshold, in units of sigma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Whether the code runs in parallel by OpenMP/ckloop or in serial only affects the performance, and switching between serial and parallel implementations is designed to be almost transparent, although I haven't tested the OpenMP/ckloop code paths yet. I am not sure how you plan to further parallelize Colvars, although I personally incline to a more fine-grained approach of parallelization (using SMP threads for calculating rotations, summing hills and possibly building neighbor list). That being said, this PR only supports the serial code path for the time being, but once you make a decision to switch to a more fine-grained SMP parallelization, I could quickly test the parallelized code path. |
Performance aside, I was referring specifically to the ability to "chain two biases", which should be straightforward to achieve as long as the order of computation is respected. Would that ability allow a more complete (and thus easier to use) OPES implementation? |
I think the current OPES implementation should be OK for common scenarios. If one wants to apply the biasing potential on As for chaining two biases, I think it would be really useful, not only for OPES, but also for metadynamics. The metadynamics in Colvars currently does not support the calculation of |
This PR intends to implement the OPES method in Colvars as requested by Chris Chipot. Basically I just followed all the logic in OPESmetad.cpp of the PLUMED implementation, with some Colvars specific modifications.
Things still need to be done(Done):Advanced features (and any of their combinations):
Limitations: