Skip to content

Commit

Permalink
Make setTwist/twist take/return a const reference.
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Hahn <[email protected]>
  • Loading branch information
quantumsteve committed Aug 31, 2023
1 parent 8658ea9 commit 4c27013
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Particle/ParticleSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ class ParticleSet : public QMCTraits, public OhmmsElementBase, public PtclOnLatt
///return the address of the i-th properties
inline const FullPrecRealType* restrict getPropertyBase(int i) const { return Properties[i]; }

inline void setTwist(SingleParticlePos& t) { myTwist = t; }
inline SingleParticlePos getTwist() const { return myTwist; }
inline void setTwist(const SingleParticlePos& t) { myTwist = t; }
inline const SingleParticlePos& getTwist() const { return myTwist; }

/** Initialize particles around another ParticleSet
* Used to initialize an electron ParticleSet by an ion ParticleSet
Expand Down
4 changes: 2 additions & 2 deletions src/QMCWaveFunctions/TrialWaveFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ class TrialWaveFunction

void evaluateRatiosAlltoOne(ParticleSet& P, std::vector<ValueType>& ratios);

void setTwist(std::vector<RealType> t) { myTwist = t; }
const std::vector<RealType> twist() { return myTwist; }
void setTwist(const std::vector<RealType>& t) { myTwist = t; }
const std::vector<RealType>& twist() const { return myTwist; }

inline void setMassTerm(ParticleSet& P)
{
Expand Down
5 changes: 3 additions & 2 deletions src/QMCWaveFunctions/WaveFunctionFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ std::unique_ptr<TrialWaveFunction> WaveFunctionFactory::buildTWF(xmlNodePtr cur,
SPOSetBuilderFactory sposet_builder_factory(myComm, targetPtcl, ptclPool);

std::string vp_file_to_load;
std::vector<ParticleSet::RealType> tsts(3, 0.);
cur = cur->children;
while (cur != NULL)
{
Expand All @@ -91,7 +92,6 @@ std::unique_ptr<TrialWaveFunction> WaveFunctionFactory::buildTWF(xmlNodePtr cur,
attribs.add(hdfName, "name");
if (hdfName == "twistAngle")
{
std::vector<ParticleSet::RealType> tsts(3, 0);
putContent(tsts, kcur);
targetPsi->setTwist(tsts);
foundtwist = true;
Expand All @@ -102,7 +102,8 @@ std::unique_ptr<TrialWaveFunction> WaveFunctionFactory::buildTWF(xmlNodePtr cur,
if (!foundtwist)
{
//default twist is [0 0 0]
std::vector<ParticleSet::RealType> tsts(3, 0);
tsts.resize(3);
std::fill(std::begin(tsts), std::end(tsts), 0.);
targetPsi->setTwist(tsts);
}
}
Expand Down

0 comments on commit 4c27013

Please sign in to comment.