-
Notifications
You must be signed in to change notification settings - Fork 139
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
FreeOrbital SPOSet #4084
FreeOrbital SPOSet #4084
Conversation
also K -> kvecs
Test this please |
Replace ElectronGas with something without ifdef is long wanted. |
Thanks. An easy to address point: Why not retain the naming of ElectronGas or similar? Do you have a more general non-electron gas usage despite all the electron gas plumbing and formulae? Repurposing "Particle" here is not ideal because we already have things like ParticleSets which refer to very different things. We are trying to remove these sources of confusion from the codebase. |
I would like to see deterministic tests added for this code, with very good coverage obtained. This should be easy to achieve given the existing stochastic tests. (On my phone, so apologies if I missed them) |
Because the single-particle orbitals for the electron gas can be free, localized (Wigner crystal), or something else.
Can you give more detail on the kind of tests you are looking for? |
Now I remember: the free orbitals can be used in a simulation with boson or boltzmann statistics. |
Paul: the deterministic tests I was referring to use a fixed random seed and a very short run to enable fully deterministic and reproducibile results. Typically they are just a few moves, just enough to hit different code paths. These tests don't demonstrate correctness but do demonstrate consistency. We run them in the CI and recommend users run all the deterministic tests when installing qmcpack (ctest -L deterministic). They are the only way we have found to reliably keep features alive, e.g. ensuring that someone doesn't accidentally break this code . If we have a deterministic test then it will fail in CI and the attempt to break this code in future will fail. We also run sanitizers with the deterministic tests to catch memory leaks etc. The standard way to make these is to adopt a short test. See e.g. https://github.com/QMCPACK/qmcpack/blob/develop/tests/solids/diamondC_1x1x1_pp/det_qmc_short.in.xml and https://github.com/QMCPACK/qmcpack/blob/develop/tests/solids/diamondC_1x1x1_pp/CMakeLists.txt .The former has
|
How about FreeParticleOrbitals? |
Good news, coverage is actually still very decent :-) https://app.codecov.io/gh/QMCPACK/qmcpack/compare/4084/tree/src/QMCWaveFunctions/ElectronGas (You might need to authenticate with your GitHub ID). For simplicity I suggest we put this item on the list of things to verify after this PR is in. The goal would be to craft an extra test or remove some unused legacy code to get the coverage >>80%. If there are vestigial functions from some old usage these should definitely go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems only a few requested change got missed. Very close to merge.
void updateKLists(const ParticleLayout& lattice, | ||
RealType kc, | ||
unsigned ndim, | ||
const PosType& twist = PosType(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still missing documentation for twist. Say something about how twist affects KLists.
src/Particle/LongRange/KContainer.h
Outdated
@@ -81,7 +81,7 @@ class KContainer : public QMCTraits | |||
*/ | |||
void findApproxMMax(const ParticleLayout& lattice, unsigned ndim); | |||
/** construct the container for k-vectors */ | |||
void BuildKLists(const ParticleLayout& lattice, bool useSphere); | |||
void BuildKLists(const ParticleLayout& lattice, PosType twist, bool useSphere); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paul-St-Young did you miss this one?
src/Particle/LongRange/StructFact.h
Outdated
@@ -71,6 +70,9 @@ class StructFact : public QMCTraits | |||
/// accessor of StorePerParticle | |||
bool isStorePerParticle() const { return StorePerParticle; } | |||
|
|||
/// accessor of k_lists_ | |||
const KContainer getKLists() const { return k_lists_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still incorrect. "const KContainer&"
Test this please |
for (int ldim=0;ldim<ndim;ldim++) | ||
{ | ||
CHECK(klists.kpts[ik][ldim] == gvecs[ik][ldim]); | ||
CHECK(klists.kpts[ik][ldim]*blat == klists.kpts_cart[ik][ldim]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failure are from missing Approx. Please double check all the CHECK. Also this file seems needing clang-format.
((ggg[j2])[la])(lb, la) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[lb] * (kvecs[ik])[la]; | ||
((ggg[j1])[la])(la, lb) = ((ggg[j1])[la])(lb, la); | ||
((ggg[j2])[la])(la, lb) = ((ggg[j2])[la])(lb, la); | ||
((ggg[j1])[lb])(la, la) = ((ggg[j1])[la])(lb, la); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My eyes hurt with excessive () around hess and ggg
Test this please |
@ye-luo sorry I missed some of your requests. They should all be addressed now. |
@PDoakORNL unit tests for the KContainer have been added. |
Test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(deleted comments)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now LGTM assuming that all the tests pass. @ye-luo should still sign off. Thanks for all the updates.
Test this please |
Proposed changes
This PR consolidates the ElectronGas folder into a single SPOSet object "FreeParticle".
This merges real and complex code paths into one file.
While mostly a refactor, this PR has the side effect of enabling simulation of the 2D electron gas, because it reuses
KContainer
, wherendim
was recently introduced #3852.I updated all the unit tests. One test needed to be dropped: "det_heg.rpa.rs5.xml" in the real build.
The dropped test uses twisted boundary condition, which the real code was never meant to support.
What type(s) of changes does this code introduce?
Does this introduce a breaking change?
Electron gas with twisted boundary condition can no longer be executed by the real code.
One must compile the complex code to use a twist.
What systems has this change been tested on?
workstation
Checklist