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
302 stars 139 forks source link

Nexus: add example for specifying estimators #5214

Closed aannabe closed 4 days ago

aannabe commented 2 weeks ago

Proposed changes

As discussed previously in persion, a comprehensive example was needed for Nexus that demonstrates how to specify various estimators. Here, I have included Density, SpinDenstiy, EnergyDensity, and 1RDM observables in a single Nexus workflow. The goal is to add all the other estimators too as they mature.

In addition, I added a scripts_postproc directory here that includes some post-processing tools. Currently, I included the 1RDM retrieval and plotting tools adapted from discussions in #1052. For now I think it will be helpful to users, at least as a starting point. Let me know if it's not well-suited for here and I will remove it.

For long run, there should be a centralized place for post-processing tools that analyze the estimators in the stat.h5 file. Whether it should be one large tool that is one-fits-all, or multiple specialized smaller tools could also be discussed. Currently, it seems to be not well handled - for instance, I see that qdens breaks if 1RDM or energy density is present in the same stat.h5 file. I will create an issue for this if the fix is not straightforward.

What type(s) of changes does this code introduce?

Does this introduce a breaking change?

What systems has this change been tested on?

Local machine

Checklist

aannabe commented 2 weeks ago

Pseudos now added.

aannabe commented 2 weeks ago

Note: I tested that spin-density, 1RDM, and energy-density runs in the batched code with the above Nexus inputs. However, the density estimator crashes with the following error: Fatal Error. Aborting at EstimatorManager input:unparsable <estimator> node, name: density type: density in Estimators input. Has the density estimator been ported to the batched code? If not, should I keep it or comment it out for now?

prckent commented 2 weeks ago

I think we decided that since the spindensity estimator was a superset of the density estimator then we didn't need both. However, the error message suggests that is not what is going on here (?). At the very least the error message needs improving. There are other estimators that are close to duplicates of functionality, e.g. the various structure factors.

aannabe commented 2 weeks ago

Looking at src/Estimators/EstimatorManagerInput.cpp there is no if-clause for the density estimator. It looks like it hasn't been ported. I have removed that estimator from the example to avoid confusion. I have also always used the spin-density estimator to get the total charges.

jtkrogel commented 1 week ago

This is good. Thanks Gani!

If you have time, can you also add the momentum distribution? This is the other one that should have support in the batched drivers already.

aannabe commented 1 week ago

Will add the momentum distribution sometime today.

aannabe commented 1 week ago

Added a minimal input for momentum distribution

prckent commented 1 week ago

I agree on the note about blocks. Best to also add a comment to explain, e.g., "Large numbers (100+) of blocks are preferred for effective statistical analysis. In production runs, more steps per block than specified here are additionally preferred for computational efficiency due to the I/O cost of estimators."

aannabe commented 1 week ago

It looks good to me now. Feel free to push to my branch directly if you think the included comments need refinining.

aannabe commented 4 days ago

EnergyDensity was working for me with the same Nexus estimator definition on another system. Maybe there is something I missed. I will investigate today.

prckent commented 4 days ago

Working now after an update & rebuild.

aannabe commented 4 days ago

Thanks. I also did a short VMC run on this system and it runs with the latest develop. The stat.h5 has all the included estimators:

ElecElec                 Group
IonIon                   Group
Kinetic                  Group
LocalECP                 Group
LocalEnergy              Group
LocalEnergy_sq           Group
LocalPotential           Group
MPC                      Group
NEEnergyDensityEstimator Group
NonLocalECP              Group
OneBodyDensityMatrices   Group
SpinDensity              Group
nofk                     Group

PS. The new DFT+U input style using QE v7.4 also works.

prckent commented 4 days ago

Test this please