-
Notifications
You must be signed in to change notification settings - Fork 135
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
Freezing two-body Jastrow parameters does not work #2814
Comments
Thanks for reporting what is clearly a bug, and likely a very longstanding one. If you have noticed issues with any other Jastrow component that would be good to know. When we know the error in this 2-body term we will have to check all the other Jastrow components in case the same error pattern is repeated. |
Yeah I tried some things with the 1-body Jastrow, which is summarized below. I haven't tried anything with a 3-body Jastrow
This segfaults.
This seems to work:
|
I looked into the code in DiffTwoBodyJastrow a little bit. The DiffTwoBodyJastrow class has it's set of variational parameters ( The For the first part (determining active variables), the vector The My guess is the initial offset should be set to the value of the first active variable. As in the following code
|
Detailed disussion on issue QMCPACK#2814
Thanks for the details. There were some other things that needed updated alongside that change. I think this branch has a fix to the issue. For the example above: yes/yes
yes/no
no/yes
I'm not sure what should be done about expanding tests (I also haven't ran the tests for these changes to check if anything breaks), but I wanted to put the changes on a branch in case it helps. |
@shivupa Thanks for working on the fix. If you are happy with your changes please can you make a PR with them?. We can discuss testing in the PR, but since adding tests to catch this problem will take some non-trivial code, we might merge the fix ahead of any tests. We really need tests that try a bunch of combinations and verify that parameter sets either change or are held fixed as expected. This will take new code, and my preference is that we don't hold up a fix that is easily to understand. |
Detailed disussion on issue QMCPACK#2814
Detailed disussion on issue QMCPACK#2814
I am bringing this back again as we really need to work for a project with Ken Jordan and we cannot use Jastrows due to the bug from the builder. |
Adding to the milestone for v3.11.0 release. This is probably a >10 year old bug existing since the first implementation in QMCPACK, but if not too diabolical we should get it fixed since it is holding up science (it should be simple, famous last words). |
Some first steps:
|
Addresses QMCPACK#2814 (at least partially) Add a unit test that will fail in one case where the offsets are not computed correctly. Fix the offset calculation in the case the first function does not have any optimizable parameters.
Second part for fix of QMCPACK#2814 The myVars in this object contains all the variational parameters aggregated from all the radial functions (in their myVars), including the non-active ones. The OffSet variable maps the indices from the radial function myVars to myVars in this object. The output for parameter derivatives should use a contiguous index (i.e. all the non-active parameters removed). This is what the Index value in VariableSet maps (returned by myVars.where). In the code, index k covers all variables in myVars. The index kk is the contiguous index for output. Some of the arrays are indexed with k, but should be indexed with kk instead.
Some updates on how to think about this. There are three levels of variational parameters (called 'variables' in the rest of the description).
There needs to be a map of indices from subcomponent-level variables to component-level variables, and a map of indices from component-level variables to global-level variables. Currently the One solution is to create another block mapping, ( |
Second part of fix for QMCPACK#2814 Construct a second mapping for component-level variational parameters to global-level variational parameters. One potentially signficant change is that this maps the parameters as a block from the component level to the global level. The previous code could be more fine-grained. If there are cases where the subcomponent variables could be a mix of active and inactive, then this code will need updating.
I assume you refer Component to WaveFunctionComponent. |
Yes, by Component I am referring to the WaveFunctionComponent. By component-level variables I mean the aggregation of all the sub-component level variables. |
I think removing the inactive variables from the component-level myVars will fix the issue. |
At @anbenali's request, I am opening an issue. Many thanks to @markdewing for helping with the troubleshooting.
Describe the bug
When a optimizing a two-body Jastrow, setting optimize="no" does not work.
When optimize is yes for both parameters, the optimization works.
If optimize="no" comes before optimize="yes", the optimization fails.
If optimize="no" comes after optimize="yes", the optimization works.
To Reproduce
Steps to reproduce the behavior:
a6aaf95d3461e13751f7d38b5dc1ed52ca3618e6-dirty
cmake -DENABLE_MKL=1 ..
qmcpack Default.qmc.in-wfj.xml
Full input files here
An H2O example with a two-body Jastrow u-u, u-d, d-d = u-u with two parameters each (starting at 0.0, but this doesn't matter):
Results in (after several opt cycles
s014.opt.xml
):Expected behavior
I would expect both the parameters of the second set to be updated. I have tested with more parameters and only the first parameter is only updated.
System:
Laptop Intel i7-7700HQ
Additional context
Following Mark's suggestions, I think I have some idea of where the bug is happening so I'll post what I have found so far.
I think the problem is in
src/QMCWaveFunctions/Jastrow/DiffTwoBodyJastrowOrbital.h
at line 149, theOffSet
variable is pointing to the wrong indices:The first and third case optimize correctly, but the second case does not. Even for the 1 parameter that is being updated I am not sure if the correct derivatives are being used to update that parameter.
The text was updated successfully, but these errors were encountered: