-
Notifications
You must be signed in to change notification settings - Fork 141
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 batched evaluateVGLWithSpin to SpinorSet #3730
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
73a86e1
update copyright/contributors and cleanup
camelto2 58a0d98
add test for mw_evaluateVGLWithSpin for SpinorSet
camelto2 5b32640
batched impl of evaluateVGLWithSpin
camelto2 5981712
Merge branch 'develop' into mw_spinorset
camelto2 4e6ae65
update mw unit tests for LCAO spinor
camelto2 98948be
add mw test for lcao spinor with excited
camelto2 507ff54
change app aborts and CHECKS
camelto2 d0adfc0
Merge branch 'develop' into mw_spinorset
ye-luo 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
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 |
---|---|---|
|
@@ -2,9 +2,10 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2022 QMCPACK developers | ||
// | ||
// File developed by: Raymond Clay III, [email protected], Sandia National Laboratories | ||
// Cody A. Melton, [email protected], Sandia National Laboratories | ||
// | ||
// File created by: Raymond Clay III, [email protected], Sandia National Laboratories | ||
////////////////////////////////////////////////////////////////////////////////////// | ||
|
@@ -135,6 +136,91 @@ void SpinorSet::evaluateVGL_spin(const ParticleSet& P, | |
dspin = eye * (eis * psi_work_up - emis * psi_work_down); | ||
} | ||
|
||
void SpinorSet::mw_evaluateVGLWithSpin(const RefVectorWithLeader<SPOSet>& spo_list, | ||
const RefVectorWithLeader<ParticleSet>& P_list, | ||
int iat, | ||
const RefVector<ValueVector_t>& psi_v_list, | ||
const RefVector<GradVector_t>& dpsi_v_list, | ||
const RefVector<ValueVector_t>& d2psi_v_list, | ||
const RefVector<ValueVector_t>& dspin_v_list) const | ||
{ | ||
auto& spo_leader = spo_list.getCastedLeader<SpinorSet>(); | ||
auto& P_leader = P_list.getLeader(); | ||
assert(this == &spo_leader); | ||
|
||
IndexType nw = spo_list.size(); | ||
SPOSet& up_spo_leader = *(spo_leader.spo_up); | ||
SPOSet& dn_spo_leader = *(spo_leader.spo_dn); | ||
RefVectorWithLeader<SPOSet> up_spo_list(up_spo_leader); | ||
RefVectorWithLeader<SPOSet> dn_spo_list(dn_spo_leader); | ||
up_spo_list.reserve(nw); | ||
dn_spo_list.reserve(nw); | ||
|
||
std::vector<ValueVector_t> mw_up_psi_work, mw_dn_psi_work; | ||
std::vector<GradVector_t> mw_up_dpsi_work, mw_dn_dpsi_work; | ||
std::vector<ValueVector_t> mw_up_d2psi_work, mw_dn_d2psi_work; | ||
mw_up_psi_work.reserve(nw); | ||
mw_up_dpsi_work.reserve(nw); | ||
mw_up_d2psi_work.reserve(nw); | ||
mw_dn_psi_work.reserve(nw); | ||
mw_dn_dpsi_work.reserve(nw); | ||
mw_dn_d2psi_work.reserve(nw); | ||
|
||
RefVector<ValueVector_t> up_psi_v_list, dn_psi_v_list; | ||
RefVector<GradVector_t> up_dpsi_v_list, dn_dpsi_v_list; | ||
RefVector<ValueVector_t> up_d2psi_v_list, dn_d2psi_v_list; | ||
up_psi_v_list.reserve(nw); | ||
up_dpsi_v_list.reserve(nw); | ||
up_d2psi_v_list.reserve(nw); | ||
dn_psi_v_list.reserve(nw); | ||
dn_dpsi_v_list.reserve(nw); | ||
dn_d2psi_v_list.reserve(nw); | ||
|
||
ValueVector_t tmp_val_vec(OrbitalSetSize); | ||
GradVector_t tmp_grad_vec(OrbitalSetSize); | ||
for (int iw = 0; iw < nw; iw++) | ||
{ | ||
SpinorSet& spinor = spo_list.getCastedElement<SpinorSet>(iw); | ||
up_spo_list.emplace_back(*(spinor.spo_up)); | ||
dn_spo_list.emplace_back(*(spinor.spo_dn)); | ||
|
||
mw_up_psi_work.emplace_back(tmp_val_vec); | ||
up_psi_v_list.emplace_back(mw_up_psi_work.back()); | ||
mw_dn_psi_work.emplace_back(tmp_val_vec); | ||
dn_psi_v_list.emplace_back(mw_dn_psi_work.back()); | ||
|
||
mw_up_dpsi_work.emplace_back(tmp_grad_vec); | ||
up_dpsi_v_list.emplace_back(mw_up_dpsi_work.back()); | ||
mw_dn_dpsi_work.emplace_back(tmp_grad_vec); | ||
dn_dpsi_v_list.emplace_back(mw_dn_dpsi_work.back()); | ||
|
||
mw_up_d2psi_work.emplace_back(tmp_val_vec); | ||
up_d2psi_v_list.emplace_back(mw_up_d2psi_work.back()); | ||
mw_dn_d2psi_work.emplace_back(tmp_val_vec); | ||
dn_d2psi_v_list.emplace_back(mw_dn_d2psi_work.back()); | ||
} | ||
|
||
up_spo_leader.mw_evaluateVGL(up_spo_list, P_list, iat, up_psi_v_list, up_dpsi_v_list, up_d2psi_v_list); | ||
dn_spo_leader.mw_evaluateVGL(dn_spo_list, P_list, iat, dn_psi_v_list, dn_dpsi_v_list, dn_d2psi_v_list); | ||
|
||
#pragma omp parallel for | ||
for (int iw = 0; iw < nw; iw++) | ||
{ | ||
ParticleSet::Scalar_t s = P_list[iw].activeSpin(iat); | ||
RealType coss = std::cos(s); | ||
RealType sins = std::sin(s); | ||
|
||
ValueType eis(coss, sins); | ||
ValueType emis(coss, -sins); | ||
ValueType eye(0, 1.0); | ||
|
||
psi_v_list[iw].get() = eis * up_psi_v_list[iw].get() + emis * dn_psi_v_list[iw].get(); | ||
dpsi_v_list[iw].get() = eis * up_dpsi_v_list[iw].get() + emis * dn_dpsi_v_list[iw].get(); | ||
d2psi_v_list[iw].get() = eis * up_d2psi_v_list[iw].get() + emis * dn_d2psi_v_list[iw].get(); | ||
dspin_v_list[iw].get() = eye * (eis * up_psi_v_list[iw].get() - emis * dn_psi_v_list[iw].get()); | ||
} | ||
} | ||
|
||
void SpinorSet::evaluate_notranspose(const ParticleSet& P, | ||
int first, | ||
int last, | ||
|
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 |
---|---|---|
|
@@ -2,9 +2,10 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2022 QMCPACK developers | ||
// | ||
// File developed by: Raymond Clay III, [email protected], Sandia National Laboratories | ||
// Cody A. Melton, [email protected], Sandia National Laboratories | ||
// | ||
// File created by: Raymond Clay III, [email protected], Sandia National Laboratories | ||
////////////////////////////////////////////////////////////////////////////////////// | ||
|
@@ -79,6 +80,23 @@ class SpinorSet : public SPOSet | |
ValueVector_t& d2psi, | ||
ValueVector_t& dspin) override; | ||
|
||
/** evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital sets of multiple walkers | ||
* @param spo_list the list of SPOSet pointers in a walker batch | ||
* @param P_list the list of ParticleSet pointers in a walker batch | ||
* @param iat active particle | ||
* @param psi_v_list the list of value vector pointers in a walker batch | ||
* @param dpsi_v_list the list of gradient vector pointers in a walker batch | ||
* @param d2psi_v_list the list of laplacian vector pointers in a walker batch | ||
* @param dspin_v_list the list of spin gradients vector pointers in a walker batch | ||
*/ | ||
void mw_evaluateVGLWithSpin(const RefVectorWithLeader<SPOSet>& spo_list, | ||
const RefVectorWithLeader<ParticleSet>& P_list, | ||
int iat, | ||
const RefVector<ValueVector_t>& psi_v_list, | ||
const RefVector<GradVector_t>& dpsi_v_list, | ||
const RefVector<ValueVector_t>& d2psi_v_list, | ||
const RefVector<ValueVector_t>& dspin_v_list) const override; | ||
|
||
/** evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles | ||
* @param P current ParticleSet | ||
* @param first starting index of the particles | ||
|
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
Binary file not shown.
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.
I saw above an h5 file was removed. No more needed?
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.
the file wasn't removed, it just got overwritten. The lcao_spinor_test.py writes the h5 file that is read by SPOSetBuilder in the test_MO_spinor.py. When I reran it to add new reference values, it just overwrote that file