-
Notifications
You must be signed in to change notification settings - Fork 144
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
1rdm with spinor support #4807
Merged
Merged
1rdm with spinor support #4807
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
da41925
initial implementation
camelto2 86737a8
forgot switch in generateSamples
camelto2 9531313
add break
camelto2 4427709
forgot to resize array in composite SPOSet
camelto2 edf4c8b
fix generateSampleRatios for spinor moves
camelto2 a7103f3
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 28482c4
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 7498a3b
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 22a03c6
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 c1c8478
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 89976db
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 05f2dd6
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 608009e
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 2fbd83c
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 c7bb140
Merge branch 'QMCPACK:develop' into 1rdm_spinor
camelto2 e8bc465
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 2534c73
Merge remote-tracking branch 'origin/1rdm_spinor' into 1rdm_spinor
camelto2 b765edb
initial unit test, making sure 1RDM actually does something with spins
camelto2 0b8aa2f
guard spinor wave functions for complex
camelto2 0ed8cec
fix const and address CI failure
camelto2 f1fb128
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 1542176
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 11e13a3
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 c537300
Merge remote-tracking branch 'origin/1rdm_spinor' into 1rdm_spinor
camelto2 362a42c
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 cc4dd10
address comments
camelto2 7f06e6f
fix issue in compositeSPOSet
camelto2 29db6c8
Merge remote-tracking branch 'upstream/develop' into 1rdm_spinor
camelto2 24d32d9
remove unnecessary intermediate variable
camelto2 b46d81e
Merge branch 'develop' into 1rdm_spinor
camelto2 55483da
Merge branch 'develop' into 1rdm_spinor
prckent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,9 @@ class OneBodyDensityMatrices : public OperatorEstBase | |
Vector<Value> basis_norms_; | ||
Vector<Grad> basis_gradients_; | ||
Vector<Value> basis_laplacians_; | ||
Vector<Value> basis_spin_gradients_; | ||
std::vector<Position> rsamples_; | ||
std::vector<Real> ssamples_; | ||
Vector<Real> samples_weights_; | ||
int basis_size_; | ||
std::vector<int> species_sizes_; | ||
|
@@ -145,6 +147,11 @@ class OneBodyDensityMatrices : public OperatorEstBase | |
/// current density | ||
Real rhocur_ = 0.0; | ||
|
||
///spin related variables | ||
Real spcur_; | ||
Real dspcur_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI. The above two uninitialized variables caused failure https://github.com/QMCPACK/qmcpack/actions/runs/8022503383/job/21922019273?pr=4928 |
||
const bool is_spinor_; | ||
|
||
public: | ||
/** Standard Constructor | ||
* Call this to make a new OBDM this is what you should be calling | ||
|
@@ -234,11 +241,19 @@ class OneBodyDensityMatrices : public OperatorEstBase | |
* * | ||
*/ | ||
void generateDensitySamples(bool save, int steps, RandomBase<FullPrecReal>& rng, ParticleSet& pset_target); | ||
|
||
/// same as above, but with spin variables included | ||
void generateDensitySamplesWithSpin(bool save, int steps, RandomBase<FullPrecReal>& rng, ParticleSet& pset_target); | ||
|
||
void generateSampleRatios(ParticleSet& pset_target, | ||
TrialWaveFunction& psi_target, | ||
std::vector<Matrix<Value>>& Psi_nm); | ||
/// produce a position difference vector from timestep | ||
Position diffuse(const Real sqt, RandomBase<FullPrecReal>& rng); | ||
|
||
/// spin diffusion | ||
Real diffuseSpin(const Real sqt, RandomBase<FullPrecReal>& rng); | ||
|
||
/** calculate density based on r | ||
* \param[in] r position | ||
* \param[out] dens density | ||
|
@@ -249,6 +264,8 @@ class OneBodyDensityMatrices : public OperatorEstBase | |
* * updateBasis is called | ||
*/ | ||
void calcDensity(const Position& r, Real& dens, ParticleSet& pset_target); | ||
/// same as above, but with spin move | ||
void calcDensityWithSpin(const Position& r, const Real& s, Real& dens, ParticleSet& pset_target); | ||
/** calculate density and drift bashed on r | ||
* \param[in] r position | ||
* \param[out] dens density | ||
|
@@ -261,6 +278,13 @@ class OneBodyDensityMatrices : public OperatorEstBase | |
* * updateBasisD012 is called | ||
*/ | ||
void calcDensityDrift(const Position& r, Real& dens, Position& drift, ParticleSet& pset_target); | ||
/// same as above, but with spin move | ||
void calcDensityDriftWithSpin(const Position& r, | ||
const Real& s, | ||
Real& dens, | ||
Position& drift, | ||
Real& sdrift, | ||
ParticleSet& pset_target); | ||
// basis & wavefunction ratio matrix construction | ||
|
||
/** set Phi_mp to basis vaules per sample | ||
|
@@ -274,14 +298,18 @@ class OneBodyDensityMatrices : public OperatorEstBase | |
*/ | ||
void generateParticleBasis(ParticleSet& pset_target, std::vector<Matrix<Value>>& phi_nb); | ||
|
||
// basis set updates | ||
/// basis set updates | ||
void updateBasis(const Position& r, ParticleSet& pset_target); | ||
/// basis set updates with spin | ||
void updateBasisWithSpin(const Position& r, const Real& s, ParticleSet& pset_target); | ||
/** evaluates vgl on basis_functions_ for r | ||
* sideeffects: | ||
* * sets basis_values_, basis_gradients_, basis_laplacians_ | ||
* all are normalized by basis norms_ | ||
*/ | ||
void updateBasisD012(const Position& r, ParticleSet& pset_target); | ||
/// same as above, but includes spin gradients | ||
void updateBasisD012WithSpin(const Position& r, const Real& s, ParticleSet& pset_target); | ||
/** does some warmup sampling i.e. samples but throws away the results | ||
* Only when integrator_ = Integrator::DENSITY | ||
* sets rpcur_ initial rpcur + one diffusion step | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
generateDensitySamples has a unit test this can as well.
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.
fixed