qmcpack icon indicating copy to clipboard operation
qmcpack copied to clipboard

Estimator Input Handling behaviors to drop in version==batch

Open PDoakORNL opened this issue 2 years ago • 1 comments

There are too many unpredictable behaviors in estimator input parsing . Here is a list that I intend to remove and what if any behavior will replace them.

Inconsistent <estimator> name and type attribute handling.

I think across the code tag attribute name is supposed to be user choice and identify a particular object defined in the content of the xml tag. This holds for estimators except those derived from ScalarEstimatorBase. For these it is used instead of the type attribute to select the type of estimator at runtime. Scalar estimators ignore type. This sort of inconsistency complicates code and the input file should have clear logic even if a long time user is inconvenienced.

Proposed changes:

  • The type attribute should be the type.
  • The name should be free choice and used identify this estimator.
  • If the name is absent set it to match type.

An estimator without a name is assumed to be a LocalEnergyEstimator.

You can write

<estimator/>
<!-- or -->o
<estimator type="spindensity" report="yes">
           <parameter name="grid"> 10 10 10 </parameter>
</estimator>

and either means

<estimator name="LocalEnergy" hdf5="yes"/>

In Legacy not specifying any unnamed estimator or estimator named "LocalEnergy" or "eLocal" results in LocalEnergyOnlyEstimator being created the first time getMainEstimator() is called. Whichever scalar estimator tag appears last becomes the MainEstimator.

Proposed Changes:

  • If EstimatorManagerInput contains no scalar estimator input when it is passed to the constructor of the EstimatorManager a LocalEnergyEstimator is created to be the MainEstimator.
  • No defaulting nameless estimators to name = "LocalEnergy".
  • An estimator with only a type will set its name to type.
  • An estimator with no type and a name equal to a known type will set its type = name. (For backwards compatibility)
  • LocalEnergyOnlyEstimator is eliminated.
  • Any scalar estimator of the same name was added in a later estimator tag it would overwrite the estimator with this name previously. This is no longer supported or necessary since estimator manager does not persist across qmc sections.

Adding a

Additional context

PDoakORNL avatar Apr 06 '22 18:04 PDoakORNL

No defaulting nameless estimators to name = "LocalEnergy". If there is no name and no type, abort

If there is either name or type, assign one to the other.

I would like to stress the last point. If estimator has a name collision, abort.

ye-luo avatar May 17 '22 18:05 ye-luo