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

add mw_ APIs to RotatedSPO #4701

Merged
merged 15 commits into from
Aug 18, 2023
Merged

Conversation

camelto2
Copy link
Contributor

Proposed changes

In the case where we go straight from an optimization into a VMC/DMC in the same run, or with WF evaluation during optimization we want to be able to utilize mw_ APIs and offload when using RotatedSPOs. Currently, since RotatedSPOs inherits from SPOSet and doesn't have any mw_ APIs defined, it will just fall back to the single walker APIs. This PR adds the resource management and mw_ APIs to RotatedSPOs, which simply call its underlying SPOSet's resource and mw_ APIs.

I made a unit test to check that these mw_ APIs have the correct behavior by introducing two "dummy" SPOSets, one that has mw_ APIs defined and one that doesn't. A RotatedSPO for the dummy SPO which doesn't have any mw_ specialization does RotatedSPOs::mw_XXX which calls underlying SPO::mw_XXX. Since it isn't defined, it defaults to loop over single walker APIs. But in the case where the underlying SPOSet does have mw_ defined, we want it to have the appropriate behavior. The dummy test SPOSets I created set different values in different APIs to ensure that the appropriate code paths are being followed for mw_evaluateValue. I assumed it would be sufficient to test only that one, but can add more if needed.

Also, if there is a better way to test this, let me know and I can make some changes.

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

Delete the items that do not apply

  • New feature

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

macOS

Checklist

Update the following with a yes where the items apply. If you're unsure about any of them, don't hesitate to ask. This is
simply a reminder of what we are going to look for before merging your code.

  • 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 tests to cover any new code, or to catch a bug that is being fixed
  • No. Documentation has been added (if appropriate)

ye-luo
ye-luo previously approved these changes Aug 17, 2023
@ye-luo
Copy link
Contributor

ye-luo commented Aug 17, 2023

Test this please

@ye-luo ye-luo enabled auto-merge August 17, 2023 16:33
@ye-luo ye-luo disabled auto-merge August 17, 2023 16:37
src/QMCWaveFunctions/RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/RotatedSPOs.h Outdated Show resolved Hide resolved
src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
/// Use global rotation or history list
bool use_global_rot_ = true;

friend opt_variables_type& testing::getMyVarsFull(RotatedSPOs& rot);
friend std::vector<std::vector<RealType>>& testing::getHistoryParams(RotatedSPOs& rot);
};

static RefVectorWithLeader<SPOSet> extractPhiRefList(const RefVectorWithLeader<SPOSet>& spo_list);
Copy link
Contributor

Choose a reason for hiding this comment

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

This still needs to be a member, static member.

Copy link
Contributor

Choose a reason for hiding this comment

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

And still under private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp Outdated Show resolved Hide resolved
@ye-luo
Copy link
Contributor

ye-luo commented Aug 17, 2023

Test this please

@ye-luo ye-luo enabled auto-merge (squash) August 17, 2023 23:34
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.

LGTM. Thank you!

@ye-luo ye-luo merged commit 134896b into QMCPACK:develop Aug 18, 2023
@prckent prckent mentioned this pull request Aug 18, 2023
@camelto2 camelto2 deleted the mw_APIs_for_rotatedSPO branch August 21, 2023 15:10
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.

2 participants