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 3bf96c7af3..82dc265e2e 100644 --- a/src/QMCWaveFunctions/TrialWaveFunction.h +++ b/src/QMCWaveFunctions/TrialWaveFunction.h @@ -470,8 +470,8 @@ 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; } + 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..496bf76164 100644 --- a/src/QMCWaveFunctions/WaveFunctionFactory.cpp +++ b/src/QMCWaveFunctions/WaveFunctionFactory.cpp @@ -70,6 +70,7 @@ std::unique_ptr WaveFunctionFactory::buildTWF(xmlNodePtr cur, SPOSetBuilderFactory sposet_builder_factory(myComm, targetPtcl, ptclPool); std::string vp_file_to_load; + std::vector tsts(3, 0.); cur = cur->children; while (cur != NULL) { @@ -91,7 +92,6 @@ 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); foundtwist = true; @@ -102,7 +102,8 @@ std::unique_ptr WaveFunctionFactory::buildTWF(xmlNodePtr cur, if (!foundtwist) { //default twist is [0 0 0] - std::vector tsts(3, 0); + tsts.resize(3); + std::fill(std::begin(tsts), std::end(tsts), 0.); targetPsi->setTwist(tsts); } }