-
Notifications
You must be signed in to change notification settings - Fork 140
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
Don't allow batched version to accept hamiltonian estimator input #4643
base: develop
Are you sure you want to change the base?
Changes from all commits
40df6ec
1c25758
0016e57
4590f20
72890e9
2d1bf88
3101da4
bd73bda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// 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) 2023 QMCPACK developers. | ||
// | ||
// File developed by: John R. Gergely, University of Illinois at Urbana-Champaign | ||
// Bryan Clark, [email protected], Princeton University | ||
|
@@ -49,6 +49,7 @@ | |
#endif | ||
#include "QMCHamiltonians/SkPot.h" | ||
#include "OhmmsData/AttributeSet.h" | ||
#include "Message/UniformCommunicateError.h" | ||
|
||
namespace qmcplusplus | ||
{ | ||
|
@@ -84,7 +85,7 @@ HamiltonianFactory::HamiltonianFactory(const std::string& hName, | |
* </hamiltonian> | ||
* \endxmlonly | ||
*/ | ||
bool HamiltonianFactory::build(xmlNodePtr cur) | ||
bool HamiltonianFactory::build(xmlNodePtr cur, bool batched) | ||
{ | ||
if (cur == NULL) | ||
return false; | ||
|
@@ -176,8 +177,18 @@ bool HamiltonianFactory::build(xmlNodePtr cur) | |
targetH->addOperator(std::move(hs), "Grid", true); | ||
} | ||
} | ||
else if (cname == "flux") | ||
{ | ||
if (potName.size() < 1) | ||
potName = "flux"; | ||
targetH->addOperator(std::make_unique<ConservedEnergy>(), potName, false); | ||
} | ||
else if (cname == "estimator") | ||
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. Change here like 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. I disagree with this change, legacy estimators that are going to continue to be allowed should be explicitly changed as the flux estimator has been. They are not "estimators" by the definition we will be using coming forward. They should be renabled individually if necessary. Further discussion of this should return to #4637 which this PR addresses, if this is the functionality you think is correct argue for it in #4637 with @jtkrogel and we can amend this PR or make another one. 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. Changing to |
||
{ | ||
if (batched) | ||
throw UniformCommunicateError( | ||
"estimator input nodes are not accepted in hamiltonian input in the batched version of the code!"); | ||
|
||
if (potType == "flux") | ||
targetH->addOperator(std::make_unique<ConservedEnergy>(), potName, false); | ||
else if (potType == "specieskinetic") | ||
|
@@ -418,9 +429,9 @@ void HamiltonianFactory::renameProperty(std::string& aname) | |
} | ||
} | ||
|
||
bool HamiltonianFactory::put(xmlNodePtr cur) | ||
bool HamiltonianFactory::put(xmlNodePtr cur, bool batched) | ||
{ | ||
bool success = build(cur); | ||
bool success = build(cur, batched); | ||
return success; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2019 QMCPACK developers. | ||
// Copyright (c) 2023 QMCPACK developers. | ||
// | ||
// File developed by: Peter Doak, [email protected], Oak Ridge National Laboratory | ||
// | ||
|
@@ -45,7 +45,7 @@ class MinimalHamiltonianPool | |
doc.parseFromString(hamiltonian_xml); | ||
|
||
xmlNodePtr root = doc.getRoot(); | ||
hpool.put(root); | ||
hpool.put(root, true); | ||
|
||
return hpool; | ||
} | ||
|
@@ -59,7 +59,7 @@ class MinimalHamiltonianPool | |
doc.parseFromString(hamiltonian_eeei_xml); | ||
|
||
xmlNodePtr root = doc.getRoot(); | ||
hpool.put(root); | ||
hpool.put(root, true); | ||
|
||
return hpool; | ||
} | ||
|
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.
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'm thinking of adding
legacy_estimator
? there is no guarantee we make the legacy ones working but at least users may have a chance to force it.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'm not in favor of that as it will inhibit refactoring QMCHamiltonian. If there is a batched version the legacy version should be disabled for a batched run.
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 think by the finish of ecp the manual should not include mention of using the tag
estimator
in the Hamiltonian input node.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.
If there is a batched version, the old input through Hamiltonian should be blocked. What if not? I would prefer giving user a chance to try out things without modifying the source code.
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 agree with this but the reality is we don't port estimators fast enough.