diff --git a/src/Particle/ParticleSet.h b/src/Particle/ParticleSet.h index d222fdb4ba..2c23502190 100644 --- a/src/Particle/ParticleSet.h +++ b/src/Particle/ParticleSet.h @@ -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 diff --git a/src/QMCWaveFunctions/TrialWaveFunction.h b/src/QMCWaveFunctions/TrialWaveFunction.h index 33c7c1db5c..9095e652aa 100644 --- a/src/QMCWaveFunctions/TrialWaveFunction.h +++ b/src/QMCWaveFunctions/TrialWaveFunction.h @@ -470,8 +470,9 @@ class TrialWaveFunction void evaluateRatiosAlltoOne(ParticleSet& P, std::vector& ratios); - void setTwist(std::vector t) { myTwist = t; } - const std::vector twist() { return myTwist; } + void setTwist(const std::vector& t) { myTwist = t; } + void setTwist(std::vector&& t) { myTwist = std::move(t); } + const std::vector& twist() const { return myTwist; } inline void setMassTerm(ParticleSet& P) { diff --git a/src/QMCWaveFunctions/WaveFunctionFactory.cpp b/src/QMCWaveFunctions/WaveFunctionFactory.cpp index 67e3df3e04..a6efb4378e 100644 --- a/src/QMCWaveFunctions/WaveFunctionFactory.cpp +++ b/src/QMCWaveFunctions/WaveFunctionFactory.cpp @@ -91,9 +91,9 @@ std::unique_ptr WaveFunctionFactory::buildTWF(xmlNodePtr cur, attribs.add(hdfName, "name"); if (hdfName == "twistAngle") { - std::vector tsts(3, 0); - putContent(tsts, kcur); - targetPsi->setTwist(tsts); + std::vector twists(3, 0); + putContent(twists, kcur); + targetPsi->setTwist(std::move(twists)); foundtwist = true; } } @@ -102,8 +102,7 @@ std::unique_ptr WaveFunctionFactory::buildTWF(xmlNodePtr cur, if (!foundtwist) { //default twist is [0 0 0] - std::vector tsts(3, 0); - targetPsi->setTwist(tsts); + targetPsi->setTwist(std::vector(3, 0)); } } else if (cname == WaveFunctionComponentBuilder::jastrow_tag)