QMCPACK / qmcpack

Main repository for QMCPACK, an open-source production level many-body ab initio Quantum Monte Carlo code for computing the electronic structure of atoms, molecules, and solids with full performance portable GPU support
http://www.qmcpack.org
Other
307 stars 139 forks source link

vp.h5 line in opt.xml #4188

Closed ye-luo closed 2 years ago

ye-luo commented 2 years ago

Describe the bug I ran multiple blocks of optimization

<loop max="3">
<loop max="3">
<loop max="2">

I got

grep vp *.opt.xml
NiO-fcc-S1-dmc.s004.opt.xml:<override_variational_parameters href="NiO-fcc-S1-dmc.s004.vp.h5"/></wavefunction>
NiO-fcc-S1-dmc.s006.opt.xml:<override_variational_parameters href="NiO-fcc-S1-dmc.s006.vp.h5"/></wavefunction>
NiO-fcc-S1-dmc.s007.opt.xml:<override_variational_parameters href="NiO-fcc-S1-dmc.s007.vp.h5"/></wavefunction>

I'm wondering why vp.h5 is not written in every opt.xml

PS: also missing a new line before </wavefunction>

markdewing commented 2 years ago

There is no initialization of do_override_output in the constructor, and so it gets turned on/off randomly.

--- a/src/QMCDrivers/WFOpt/QMCCostFunctionBase.cpp
+++ b/src/QMCDrivers/WFOpt/QMCCostFunctionBase.cpp
@@ -57,7 +57,8 @@ QMCCostFunctionBase::QMCCostFunctionBase(ParticleSet& w,
       m_wfPtr(NULL),
       m_doc_out(NULL),
       includeNonlocalH("no"),
-      debug_stream(0)
+      debug_stream(0),
+      do_override_output(false)
 {
ye-luo commented 2 years ago

Ouch.

ye-luo commented 2 years ago

Do you remember why the default is not true? Should the opt.xml not always point to its corresponding vp.h5?

markdewing commented 2 years ago

I think it was off by default so it wouldn't change existing behavior that read the parameters from the opt.xml file.

ye-luo commented 2 years ago

I think I was confused by the variable name. override means if it exist, override happens. After reading the code, it seems mean write the vp.h5 xml line. The xml keyword was "override".

If users copy paste opt.xml, the intention is to used the optimized WF. So having overriding should not change any parameters. If users tend to modify opt.xml by hand, they are responsible to control overriding.

ye-luo commented 2 years ago

Found my earlier issue https://github.com/QMCPACK/qmcpack/issues/3653