-
Notifications
You must be signed in to change notification settings - Fork 142
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
Modify DMC branch cutoff and population control #242
Conversation
Clean up the inconsistent defintion of B_SIGMA in SimpleFixedNodeBranch. Renamed to B_SIGMA2 instead. Variance(sigma2) is size-consistent but standard deviation(sigma) is not. The inconsistency caused a bug that the inital branch cutoff calulated from sigma severely limits the branching and biases the warmup.
After the warmup, the first data point put in the histogram was using the histogram mean of the warmup part which biases the stage collecting statistics. Instead use the ensemble average of energy from the last iteration E_now as the first data point.
1, In the E_trial, add back the 1/tau prefactor in the population control term only in warmup. Now the population flucturation is much smaller. After warmup, keep the old scheme. 2, Modify doNotBranch to return the new population after the first iteration for adjusting the E_trial in order to prevent the intial populaion explosion in DMC.
The lines in WalkeControlFactory are replaced by calling setMinMax in the WalkerControlBase. Cleanup WalkerControlFactory.
Can one of the maintainers verify this patch? |
1 similar comment
Can one of the maintainers verify this patch? |
ok to test |
This is a potentially significant change and improvement to the DMC algorithm.
|
I am all for more daylight on the projector (particularly its behavior with varying N and/or Z). We particularly need detailed documentation on exactly what the core DMC algorithm is doing, including the "special sauce". Testing in the large N limit is warranted; sadly it is in exactly this limit that we will have a hard time telling what is correct (the old version, the new version, or neither?). Since we are moving strongly in this direction (very large N) on ECP, it is probably time to have some strict correctness checks of the algorithm in this limit. One possibility would be to solve the NI HEG Hamiltonian (KE only, exact nodes) using a bogus Jastrow factor and let DMC project it away. This could provide insight into the old vs new algorithm as a function of N (and also timestep). |
@ye-luo Could you explain a little more about the change to variance rather than standard deviation? The standard deviation is not size consistent (i.e. does not scale as N) as you say, but I thought the point of the branch cutoff was to filter out the troublesome rare event/heavy tails of the local energy distribution from causing instabilities in the branching weights. From this point of view, it would make sense to have the cutoff be a meaningful representation of distance relative to the width of the local energy distribution. The standard deviation has this property (at least for non-heavy tailed distributions!) while the variance does not. I could see potentially replacing the standard deviation with a percentile based definition instead (avoids heavy tail problem), but I don't yet see how defining the local energy branch cutoff by the variance would give an improvement. |
@jtkrogel Copy paste from my slides The cutoff is to secure the simulation and still effective. The 1/tau cutoff dominates when tau is large. |
I agree that pre- and post-warmup should use the same branch cutoff scheme (with the same N scaling). I just don't understand why it should be sigma^2 since the width of the local energy distribution scales like sqrt(N). On the population control front, I wouldn't expect normal ("looser") control to be a problem so long as discontinuous changes from warmup to production are avoided. Do you have tests that use normal control throughout while including the other changes? I would be hesitant about tight control (1/(g*tau) with g=1, insists that population return to target each generation, on average) due to increased bias. |
@jtkrogel I have updated the description. The branch cutoff scheme was the same after warmup. You were using it for years. The problem is in warmup and leads to more equlibration (a waste of time) after warmup. |
@jtkrogel I had the same hesitation about the tight pop control for the population bias. For this reason, it is only turned on during warmup but not in the main stage and leave more investigation later. |
@jtkrogel I cannot explain you why. I would naturally choose standard deviation (sigma) like you. I think using sigma is fine after equilibration because sigma is only valid on equilibrated ensemble. On the other hand, I still have the 1/tau which is also not size-consistent and I don't have a better solution now. |
@ye-luo So right now we take the min of two quantities, one O(N) and the other O(1) to bound a distribution that grows as O(sqrt(N)). I would think this would lead to either stability problems or bias in the large N limit, which makes me more eager to try something like the HEG tests I mentioned above. |
@jtkrogel I agree that there is clearly a question on the optimal scheme. |
@ye-luo I do not think your changes will affect things adversely, since, as I understand, they are limited mostly to issues of continuity from warmup to production and stability in warmup itself. The rest of my comments should probably be relegated to a discussion beyond this PR. +1 on the changes provided all tests pass. In that light, can you post here the output from qmca -q ev -e XXX on the DMC files pre- and post- changes? Separately, is it worth making a github issue noting needed exploration of N-scaling behavior of the projector? |
@jtkrogel It is definitely worth creating a separate issue to discuss and track this topic. Before change I couldn't run S32 long, it is too expensive. But I saw the equilibration is much shorter after the change. |
S16 is 64 atom cell, right? In this case there is no statistically significant change down to 1 mHa per NiO formula unit, which is good. All ctests pass? |
+1 on the changes for me. |
I'm fine with the changes. It would be good to point out how they relate to the ideas in Zen et al. Phys. Rev. B 93, 241118(R) |
hold on |
1) Fix an inconsistency in branch cutoff in resetRun. 2) Adjust cutoff definition back to min(targetSigma*sigma,2.5/tau) The old code used sqrt(sigma) assuming sigma is variance but the defintion was switching back and forth between standard deviation(sigma) and variance.
UPDATE: I repeated the NiO calculation and got |
The scheme is cutoff=sqrt(variance)*min(targetSigma, sqrt(1.0/tau))
@lshulen @jtkrogel I read the paper and think they are going to the right direction but not using optimal scheme. The paper suggests alpha*sqrt(Nelec/tau) as a cutoff. Based on my estimation, it is too small for the warm up but may be fine for the main stage. alpha=0.2 is empirical and Nelec is not a good reference quantity. I think mine is better. The equation is Now, tau=0.1 you have a control of sqrt(10) sigma. When you have tau=0.01, you get 10 sigma bound. |
@lshulen , @jtkrogel I think that @ye-luo 's discussion points should be a topic of a research paper and not a patch to our production code. I am not keen to have an unpublished algorithm in the production code, but we do need to solve the equilibration issue. What do you prefer to do in the interim? @ye-luo Can we split these issues? |
I am also not keen that we can not run the old algorithm after this patch. I think that this algorithmic change will have to be switchable. |
I'm perfectly happy to have unpublished algorithms in the production
code provided they are documented and are an option. In my opinion, the
best case would be to add an attribute to the DMC tag that allows one to
switch from the current algorithm to Ye's to Dario's.
Luke
…On 06/02/2017 08:53 AM, Paul R. C. Kent wrote:
@lshulen , @jtkrogel I think that @ye-luo 's discussion points should be a topic of a research paper and not a patch to our production code. I am not keen to have an unpublished algorithm in the production code, but we do need to solve the equilibration issue. What do you prefer to do in the interim?
@ye-luo Can we split these issues?
|
@prckent I prefer to have old default scheme(some fixed is necessary), Andrea's and mine switchable and we can investigate more. I had too many code branches to maintain and better to just get this in. |
I am very much in favor of switchability with the current branch cutoff scheme as default (production part, I understand the warmup part is being modified here to match production). I think switching the default requires broader research, perhaps rising to the level of a paper. We could pool ideas and pursue this if there is interest. |
Decision: Make switchable to preserve the "classic" QMCPACK algorithm for DMC. Add new schemes as non-default options, whether research or published (Zen/Alfe). The algorithm switch can encode both population control and green's function related changes. @ye-luo I suggest you update this PR to keep the changes with this discussion. |
BranchingCutoffScheme = classic(default), UMR, ZSGMA, YL
@prckent I added a switch allowing changing branching cutoff schemes. Default is classic. No manual update at this point and should be added when we have more experience with them. |
Ye - After all these updates, please can you clearly summarize what has been changed or not?
Please also add a comment to each section of setBranchCutoff documenting where the formulae are from - UNR paper equation #, you, classic algorithm implemented in QMCPACK,... I am prepared to merge these changes as a development feature provided no one objects on Monday. Research is needed in these different settings, and we need a Zen/Alfe implementation regardless. |
Final changes:
In summary, using the new code with an input file from an old DMC calculation. You will see: |
OK, I will summarize this in the release changelog as
|
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.
+1
I know this is closed now, but I missed the flag name. Camel case primarily appeared in QMCPACK's input in its early history (e.g. timeStep), and was largely replaced in favor of flat text (e.g. timestep) later on as it is more forgiving for users (closer to natural language than CC C++ convention). @ye-luo Can we continue this trend here in the interest of avoiding user input errors, e.g. use "branch_cutoff" instead? |
OK, agree. Ye can you make a new PR? Lets use branch_cutoff |
Sure. I will do branching_cutoff_scheme which matches the internal variable. |
All the short DMC tests pass except short-bccH_1x1x1_ae-dmc_sdj-1-16. See issue #241
A few significant changes:
variance instead ofstandard deviation to be size-consistent.This change affects warmup. After the warmup, the cutoff has ALREADY been determined by variance.Population control (E_trial) in DMC after warm up has NOT been changed.
Whether to use tight control will be decided with more study on the population bias.