Skip to content
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

Port spin density observable #2840

Merged
merged 22 commits into from
Jan 11, 2021

Conversation

PDoakORNL
Copy link
Contributor

@PDoakORNL PDoakORNL commented Jan 6, 2021

Proposed changes

This is a port of the legacy SpinDensity estimator from the legacy architecture. It is the beginning of the strip down refactor of OperatorBase as well. SpinDensityNew derives from OperatorEstBase which manages a generic buffer of QMCTraits::RealType for the derived OperatorEstimators. This replaces the use of Collectables as the data store for these estimators.

This sort of estimator is now instantiated under the "control" of EstimatorManagerNew and is accumulated when other estimators are accumulated not when the Hamiltonian is evaluated.

Right now each SpinDensity new gets its own copy of the accumulator data structure, a pending PR will address the issue of large SpinDensities.

MPI reduction occurs between ranks 1 time per estimator per block for SpinDensity.

I will provide additional documention of the new estimator design soon. I'm beginning work on the DensityMatrix estimator now. But this is as much as I think should be reviewed at once.

@jtkrogel Right now qdens will not work with the hdf5 output because (as far as I can tell) it needs to be able to understand the input.xml which it does not. I tried to modify nexus to allow this but there is something I'm not grasping about qmcpack_input.py and qdens.

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

port of SpinDensity from QMCHamiltonian based legacy driver architecture to unified batched driver architecture and management by EstimatorManagerNew and not QMCHamiltonian.

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

Leconte

Checklist

  • Yes. This PR is up to date with current the current state of 'develop'
  • Yes. Code added or changed in the PR has been clang-formatted
  • Yes This PR adds some tests to cover some new code, or to catch a bug that is being fixed
  • Yes Some documentation has been added (if appropriate)

Copy link
Contributor

@ye-luo ye-luo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a discussion with Peter over the phone yesterday. variant and C++17 will be avoided.
I left other issues in-source review here.

src/Estimators/EstimatorManagerCrowd.cpp Outdated Show resolved Hide resolved
src/Estimators/EstimatorManagerNew.cpp Outdated Show resolved Hide resolved
src/Estimators/EstimatorManagerNew.cpp Outdated Show resolved Hide resolved
src/Estimators/OperatorEstBase.h Outdated Show resolved Hide resolved
src/Estimators/SpinDensityInput.cpp Outdated Show resolved Hide resolved
src/Estimators/SpinDensityNew.h Outdated Show resolved Hide resolved
src/Estimators/tests/test_manager_mpi.cpp Show resolved Hide resolved
sdi.readXML(node);
SpeciesSet species_set;
int ispecies = species_set.addSpecies("C");
int iattribute = species_set.addAttribute("membersize");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the version of clang-format you used? This issue should have been fixed.

Copy link
Contributor Author

@PDoakORNL PDoakORNL Jan 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 was used.
Then I tried version 7,10,12 (develop)

src/Particle/ParticleSet.h Outdated Show resolved Hide resolved
@jtkrogel
Copy link
Contributor

jtkrogel commented Jan 7, 2021

Please send me an email with your input and output files. I will make a separate PR to address the needs of qdens.

@jtkrogel
Copy link
Contributor

jtkrogel commented Jan 7, 2021

How are you testing the correctness of the new implementation?

Copy link
Contributor Author

@PDoakORNL PDoakORNL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ready to go. Short of starting over and doing a minimal change version still attached to QMCHamiltonian and Collectables there is only the skeleton of the datalocality handling which I'd like to stay there since I'm going to immediately be using them for the density matrices and the huge spindenisty implementation.

src/Estimators/EstimatorManagerCrowd.cpp Show resolved Hide resolved
@PDoakORNL
Copy link
Contributor Author

As far as testing that this produces the same result as the original out side of running the full app and comparing a statistical result it is not easy since SpinDensity has absolutely no unit testing and depends on the assumption of a tight coupling to a single walker state machine as is the norm for the estimators.

What should be trivial, accumulating once and checking the data structure is quite painful. But I expect I will have to write a couple of unit tests for the original to be sure. Outside of that a statistical test with the full app seems like all that can be done.

This PR is just an iterative step so I can stop rebasing against develop and review is not delayed by to much code to review.

ye-luo
ye-luo previously approved these changes Jan 8, 2021
@prckent
Copy link
Contributor

prckent commented Jan 11, 2021

Are there any outstanding questions about this PR?

Copy link
Contributor

@ye-luo ye-luo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just re-approve due to rebase.

@ye-luo
Copy link
Contributor

ye-luo commented Jan 11, 2021

@jtkrogel Does this PR look good to you?

@prckent
Copy link
Contributor

prckent commented Jan 11, 2021

(I understand this PR is a step along the way, so provided there are no major objections on the direction, I hope we can merge.)

@ye-luo ye-luo merged commit 8f8c613 into QMCPACK:develop Jan 11, 2021
@PDoakORNL PDoakORNL deleted the port_spin_density_observable branch February 23, 2022 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants