diff --git a/src/Message/CommOperatorsMPI.h b/src/Message/CommOperatorsMPI.h index 62cf043e5c..322c929306 100644 --- a/src/Message/CommOperatorsMPI.h +++ b/src/Message/CommOperatorsMPI.h @@ -16,130 +16,131 @@ #ifndef OHMMS_COMMUNICATION_OPERATORS_MPI_H #define OHMMS_COMMUNICATION_OPERATORS_MPI_H #include "Pools/PooledData.h" -#include +#include +#include ///dummy declarations to be specialized template inline void gsum(T&, int) { - APP_ABORT("Need specialization for gsum(T&, int)"); + throw std::runtime_error("Need specialization for gsum(T&, int)"); } template inline void Communicate::allreduce(T&) { - APP_ABORT("Need specialization for allreduce(T&)"); + throw std::runtime_error("Need specialization for allreduce(T&)"); } template inline void Communicate::reduce(T&) { - APP_ABORT("Need specialization for reduce(T&)"); + throw std::runtime_error("Need specialization for reduce(T&)"); } template inline void Communicate::reduce(T* restrict, T* restrict, int n) { - APP_ABORT("Need specialization for reduce(T* restrict , T* restrict, int n)"); + throw std::runtime_error("Need specialization for reduce(T* restrict , T* restrict, int n)"); } template inline void Communicate::reduce_in_place(T* restrict, int n) { - APP_ABORT("Need specialization for reduce_in_place(T* restrict, int n)"); + throw std::runtime_error("Need specialization for reduce_in_place(T* restrict, int n)"); } template inline void Communicate::bcast(T&) { - APP_ABORT("Need specialization for bcast(T&)"); + throw std::runtime_error("Need specialization for bcast(T&)"); } template inline void Communicate::bcast(T* restrict, int n) { - APP_ABORT("Need specialization for bcast(T* restrict ,int n)"); + throw std::runtime_error("Need specialization for bcast(T* restrict ,int n)"); } template inline void Communicate::send(int dest, int tag, T&) { - APP_ABORT("Need specialization for send(int, int, T& )"); + throw std::runtime_error("Need specialization for send(int, int, T& )"); } template inline void Communicate::gather(T& sb, T& rb, int dest) { - APP_ABORT("Need specialization for gather(T&, T&, int)"); + throw std::runtime_error("Need specialization for gather(T&, T&, int)"); } template inline void Communicate::allgather(T& sb, T& rb, int count) { - APP_ABORT("Need specialization for allgather(T&, T&, int)"); + throw std::runtime_error("Need specialization for allgather(T&, T&, int)"); } template inline void Communicate::gatherv(T& sb, T& rb, IT&, IT&, int dest) { - APP_ABORT("Need specialization for gatherv(T&, T&, IT&, IT&, int)"); + throw std::runtime_error("Need specialization for gatherv(T&, T&, IT&, IT&, int)"); } template inline void Communicate::scatter(T& sb, T& rb, int dest) { - APP_ABORT("Need specialization for scatter(T&, T&, int)"); + throw std::runtime_error("Need specialization for scatter(T&, T&, int)"); } template inline void Communicate::scatterv(T& sb, T& rb, IT&, IT&, int source) { - APP_ABORT("Need specialization for scatterv(T&, T&, IT&, IT&, int)"); + throw std::runtime_error("Need specialization for scatterv(T&, T&, IT&, IT&, int)"); } template inline Communicate::request Communicate::irecv(int source, int tag, T&) { - APP_ABORT("Need specialization for irecv(int source, int tag, T& )"); + throw std::runtime_error("Need specialization for irecv(int source, int tag, T& )"); return MPI_REQUEST_NULL; } template inline Communicate::request Communicate::isend(int dest, int tag, T&) { - APP_ABORT("Need specialization for isend(int source, int tag, T& )"); + throw std::runtime_error("Need specialization for isend(int source, int tag, T& )"); return MPI_REQUEST_NULL; } template inline Communicate::request Communicate::irecv(int source, int tag, T*, int n) { - APP_ABORT("Need specialization for irecv(int source, int tag, T*, int )"); + throw std::runtime_error("Need specialization for irecv(int source, int tag, T*, int )"); return MPI_REQUEST_NULL; } template inline Communicate::request Communicate::isend(int dest, int tag, T*, int n) { - APP_ABORT("Need specialization for isend(int source, int tag, T*, int )"); + throw std::runtime_error("Need specialization for isend(int source, int tag, T*, int )"); return MPI_REQUEST_NULL; } template inline void Communicate::allgather(T* sb, T* rb, int count) { - APP_ABORT("Need specialization for allgather(T*, T*, int)"); + throw std::runtime_error("Need specialization for allgather(T*, T*, int)"); } template inline void Communicate::gatherv(T* sb, T* rb, int n, IT&, IT&, int dest) { - APP_ABORT("Need specialization for gatherv(T*, T*, int, IT&, IT&, int)"); + throw std::runtime_error("Need specialization for gatherv(T*, T*, int, IT&, IT&, int)"); } template inline void Communicate::gsum(T&) { - APP_ABORT("Need specialization for Communicate::::gsum(T&)"); + throw std::runtime_error("Need specialization for Communicate::::gsum(T&)"); } template<> @@ -324,6 +325,14 @@ inline void Communicate::allreduce(std::vector& g) g = gt; } +template<> +inline void Communicate::allreduce(std::vector>& g) +{ + std::vector> gt(g.size(), std::complex(0.0)); + MPI_Allreduce(&(g[0]), &(gt[0]), 2 * g.size(), MPI_FLOAT, MPI_SUM, myMPI); + g = gt; +} + template<> inline void Communicate::allreduce(std::vector>& g) { @@ -773,11 +782,6 @@ inline void Communicate::gatherv(std::vector& l, std::vector& displ, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(char) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gatherv(&l[0], l.size(), MPI_CHAR, &g[0], &counts[0], &displ[0], MPI_CHAR, dest, myMPI); } @@ -789,11 +793,6 @@ inline void Communicate::gatherv(std::vector& l, std::vector& displ, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(double) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gatherv(&l[0], l.size(), MPI_DOUBLE, &g[0], &counts[0], &displ[0], MPI_DOUBLE, dest, myMPI); } @@ -804,11 +803,6 @@ inline void Communicate::gatherv(std::vector& l, std::vector& displ, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(float) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gatherv(&l[0], l.size(), MPI_FLOAT, &g[0], &counts[0], &displ[0], MPI_FLOAT, dest, myMPI); } @@ -819,33 +813,18 @@ inline void Communicate::gatherv(std::vector& l, std::vector& displ, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(int) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gatherv(&l[0], l.size(), MPI_INT, &g[0], &counts[0], &displ[0], MPI_INT, dest, myMPI); } template<> inline void Communicate::allgather(std::vector& sb, std::vector& rb, int count) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (sb.size() * sizeof(double) < cray_short_msg_size) - this->barrier(); -#endif MPI_Allgather(&sb[0], count, MPI_CHAR, &rb[0], count, MPI_CHAR, myMPI); } template<> inline void Communicate::allgather(std::vector& sb, std::vector& rb, int count) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (sb.size() * sizeof(int) < cray_short_msg_size) - this->barrier(); -#endif MPI_Allgather(&sb[0], count, MPI_INT, &rb[0], count, MPI_INT, myMPI); } @@ -856,11 +835,6 @@ inline void Communicate::allgatherv(std::vector& l, std::vector& counts, std::vector& displ) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(int) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Allgatherv(&l[0], l.size(), MPI_INT, &g[0], &counts[0], &displ[0], MPI_INT, myMPI); } @@ -871,44 +845,24 @@ inline void Communicate::gatherv(std::vector& l, std::vector& displ, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(long) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gatherv(&l[0], l.size(), MPI_LONG, &g[0], &counts[0], &displ[0], MPI_LONG, dest, myMPI); } template<> inline void Communicate::gather(std::vector& l, std::vector& g, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(double) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gather(&l[0], l.size(), MPI_DOUBLE, &g[0], l.size(), MPI_DOUBLE, dest, myMPI); } template<> inline void Communicate::gather(std::vector& l, std::vector& g, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(char) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gather(&l[0], l.size(), MPI_CHAR, &g[0], l.size(), MPI_CHAR, dest, myMPI); } template<> inline void Communicate::gather(std::vector& l, std::vector& g, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(int) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gather(&l[0], l.size(), MPI_INT, &g[0], l.size(), MPI_INT, dest, myMPI); } @@ -919,22 +873,12 @@ inline void Communicate::gatherv(PooledData& l, std::vector& displ, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(double) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gatherv(l.data(), l.size(), MPI_DOUBLE, g.data(), &counts[0], &displ[0], MPI_DOUBLE, dest, myMPI); } template<> inline void Communicate::gather(PooledData& l, PooledData& g, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (l.size() * sizeof(double) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gather(l.data(), l.size(), MPI_DOUBLE, g.data(), l.size(), MPI_DOUBLE, dest, myMPI); } @@ -973,22 +917,12 @@ inline void Communicate::gsum(std::vector>& g) template<> inline void Communicate::gatherv(char* l, char* g, int n, std::vector& counts, std::vector& displ, int dest) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (n * sizeof(char) < cray_short_msg_size) - this->barrier(); -#endif int ierr = MPI_Gatherv(l, n, MPI_CHAR, g, &counts[0], &displ[0], MPI_CHAR, dest, myMPI); } template<> inline void Communicate::allgather(char* sb, char* rb, int count) { -#if defined(_CRAYMPI) - const int cray_short_msg_size = 128000; - if (count * sizeof(char) < cray_short_msg_size) - this->barrier(); -#endif MPI_Allgather(sb, count, MPI_CHAR, rb, count, MPI_CHAR, myMPI); } diff --git a/src/Optimize/OptimizeBase.h b/src/Optimize/OptimizeBase.h index 83ece8a442..b0aca5a077 100644 --- a/src/Optimize/OptimizeBase.h +++ b/src/Optimize/OptimizeBase.h @@ -42,7 +42,7 @@ class CostFunctionBase virtual int getNumParams() const = 0; - virtual Return_t& Params(int i) = 0; + virtual Return_rt& Params(int i) = 0; virtual Return_t Params(int i) const = 0; diff --git a/src/Particle/ParticleSet.BC.cpp b/src/Particle/ParticleSet.BC.cpp index 2c1469f556..d772a1bf61 100644 --- a/src/Particle/ParticleSet.BC.cpp +++ b/src/Particle/ParticleSet.BC.cpp @@ -171,7 +171,7 @@ void ParticleSet::applyBC(ParticlePos& pos) } } -void ParticleSet::applyMinimumImage(ParticlePos& pinout) +void ParticleSet::applyMinimumImage(ParticlePos& pinout) const { if (getLattice().SuperCellEnum == SUPERCELL_OPEN) return; diff --git a/src/Particle/ParticleSet.h b/src/Particle/ParticleSet.h index 2c23502190..247f5ca66a 100644 --- a/src/Particle/ParticleSet.h +++ b/src/Particle/ParticleSet.h @@ -426,7 +426,7 @@ class ParticleSet : public QMCTraits, public OhmmsElementBase, public PtclOnLatt void applyBC(const ParticlePos& pin, ParticlePos& pout); void applyBC(ParticlePos& pos); void applyBC(const ParticlePos& pin, ParticlePos& pout, int first, int last); - void applyMinimumImage(ParticlePos& pinout); + void applyMinimumImage(ParticlePos& pinout) const; /** load a Walker_t to the current ParticleSet * @param awalker the reference to the walker to be loaded diff --git a/src/Platforms/Host/sysutil.cpp b/src/Platforms/Host/sysutil.cpp index 32d7937e1d..ac077764f6 100644 --- a/src/Platforms/Host/sysutil.cpp +++ b/src/Platforms/Host/sysutil.cpp @@ -19,17 +19,6 @@ #include using std::string; #include - -// Dummy version of getHostName, in case its needed -#if 0 -#if defined(_CRAYMPI) || defined(XT_CATAMOUNT) -string getHostName() -{ - return "jaguar"; -} -#endif -#endif - #include string getHostName() diff --git a/src/QMCDrivers/WFOpt/QMCCostFunction.cpp b/src/QMCDrivers/WFOpt/QMCCostFunction.cpp index 1a1ef50c9f..cc1f4ba3c9 100644 --- a/src/QMCDrivers/WFOpt/QMCCostFunction.cpp +++ b/src/QMCDrivers/WFOpt/QMCCostFunction.cpp @@ -110,16 +110,16 @@ void QMCCostFunction::GradCost(std::vector& PGradient, ltz = false; Return_rt delE = std::pow(std::abs(eloc_new - EtargetEff), PowerE); Return_rt ddelE = PowerE * std::pow(std::abs(eloc_new - EtargetEff), PowerE - 1); - const Return_rt* Dsaved = (*DerivRecords[ip])[iw]; + const Return_t* Dsaved = (*DerivRecords[ip])[iw]; const Return_rt* HDsaved = (*HDerivRecords[ip])[iw]; for (int pm = 0; pm < NumOptimizables; pm++) { - EDtotals_w[pm] += weight * (HDsaved[pm] + 2.0 * Dsaved[pm] * delta_l); + EDtotals_w[pm] += weight * (HDsaved[pm] + 2.0 * std::real(Dsaved[pm]) * delta_l); URV[pm] += 2.0 * (eloc_new * HDsaved[pm] - curAvg * HD_avg[pm]); if (ltz) - EDtotals[pm] += weight * (2.0 * Dsaved[pm] * (delE - delE_bar) + ddelE * HDsaved[pm]); + EDtotals[pm] += weight * (2.0 * std::real(Dsaved[pm]) * (delE - delE_bar) + ddelE * HDsaved[pm]); else - EDtotals[pm] += weight * (2.0 * Dsaved[pm] * (delE - delE_bar) - ddelE * HDsaved[pm]); + EDtotals[pm] += weight * (2.0 * std::real(Dsaved[pm]) * (delE - delE_bar) - ddelE * HDsaved[pm]); } } } @@ -137,12 +137,12 @@ void QMCCostFunction::GradCost(std::vector& PGradient, Return_rt eloc_new = saved[ENERGY_NEW]; Return_rt delta_l = (eloc_new - curAvg_w); Return_rt sigma_l = delta_l * delta_l; - const Return_rt* Dsaved = (*DerivRecords[ip])[iw]; + const Return_t* Dsaved = (*DerivRecords[ip])[iw]; const Return_rt* HDsaved = (*HDerivRecords[ip])[iw]; for (int pm = 0; pm < NumOptimizables; pm++) { E2Dtotals_w[pm] += - weight * 2.0 * (Dsaved[pm] * (sigma_l - curVar_w) + delta_l * (HDsaved[pm] - EDtotals_w[pm])); + weight * 2.0 * (std::real(Dsaved[pm]) * (sigma_l - curVar_w) + delta_l * (HDsaved[pm] - EDtotals_w[pm])); } } } @@ -237,7 +237,7 @@ void QMCCostFunction::checkConfigurations(EngineHandle& handle) RecordsOnNode[ip]->resize(wRef.numSamples(), SUM_INDEX_SIZE); if (needGrads) { - DerivRecords[ip] = new Matrix; + DerivRecords[ip] = new Matrix; DerivRecords[ip]->resize(wRef.numSamples(), NumOptimizables); HDerivRecords[ip] = new Matrix; HDerivRecords[ip]->resize(wRef.numSamples(), NumOptimizables); @@ -286,10 +286,9 @@ void QMCCostFunction::checkConfigurations(EngineHandle& handle) //FIXME the ifdef should be removed after the optimizer is made compatible with complex coefficients for (int i = 0; i < NumOptimizables; i++) { - rDsaved[i] = std::real(Dsaved[i]); rHDsaved[i] = std::real(HDsaved[i]); } - std::copy(rDsaved.begin(), rDsaved.end(), (*DerivRecords[ip])[iw]); + std::copy(Dsaved.begin(), Dsaved.end(), (*DerivRecords[ip])[iw]); std::copy(rHDsaved.begin(), rHDsaved.end(), (*HDerivRecords[ip])[iw]); } else @@ -362,7 +361,7 @@ void QMCCostFunction::engine_checkConfigurations(cqmc::engine::LMYEngineresize(wRef.numSamples(), SUM_INDEX_SIZE); if (needGrads) { - DerivRecords[ip] = new Matrix; + DerivRecords[ip] = new Matrix; //DerivRecords[ip]->resize(wRef.numSamples(),NumOptimizables); HDerivRecords[ip] = new Matrix; //HDerivRecords[ip]->resize(wRef.numSamples(),NumOptimizables); @@ -666,7 +665,7 @@ QMCCostFunction::Return_rt QMCCostFunction::fillOverlapHamiltonianMatrices(Matri RealType H2_avg = 1.0 / (curAvg_w * curAvg_w); // RealType H2_avg = 1.0/std::sqrt(curAvg_w*curAvg_w*curAvg2_w); RealType V_avg = curAvg2_w - curAvg_w * curAvg_w; - std::vector D_avg(getNumParams(), 0.0); + std::vector D_avg(getNumParams(), 0.0); Return_rt wgtinv = 1.0 / SumValue[SUM_WGT]; for (int ip = 0; ip < NumThreads; ip++) { @@ -675,7 +674,7 @@ QMCCostFunction::Return_rt QMCCostFunction::fillOverlapHamiltonianMatrices(Matri { const Return_rt* restrict saved = (*RecordsOnNode[ip])[iw]; Return_rt weight = saved[REWEIGHT] * wgtinv; - const Return_rt* Dsaved = (*DerivRecords[ip])[iw]; + const Return_t* Dsaved = (*DerivRecords[ip])[iw]; for (int pm = 0; pm < getNumParams(); pm++) { D_avg[pm] += Dsaved[pm] * weight; @@ -693,35 +692,35 @@ QMCCostFunction::Return_rt QMCCostFunction::fillOverlapHamiltonianMatrices(Matri const Return_rt* restrict saved = (*RecordsOnNode[ip])[iw]; Return_rt weight = saved[REWEIGHT] * wgtinv; Return_rt eloc_new = saved[ENERGY_NEW]; - const Return_rt* Dsaved = (*DerivRecords[ip])[iw]; + const Return_t* Dsaved = (*DerivRecords[ip])[iw]; const Return_rt* HDsaved = (*HDerivRecords[ip])[iw]; #pragma omp parallel for for (int pm = 0; pm < getNumParams(); pm++) { - Return_rt wfe = (HDsaved[pm] + (Dsaved[pm] - D_avg[pm]) * eloc_new) * weight; - Return_rt wfd = (Dsaved[pm] - D_avg[pm]) * weight; - Return_rt vterm = - HDsaved[pm] * (eloc_new - curAvg_w) + (Dsaved[pm] - D_avg[pm]) * eloc_new * (eloc_new - 2.0 * curAvg_w); + Return_t wfe = (HDsaved[pm] + (Dsaved[pm] - D_avg[pm]) * eloc_new) * weight; + Return_t wfd = (Dsaved[pm] - D_avg[pm]) * weight; + Return_t vterm = + HDsaved[pm] * (eloc_new - curAvg_w) + (Dsaved[pm] - D_avg[pm]) * eloc_new * (eloc_new - RealType(2.0) * curAvg_w); // Return_t vterm = (HDsaved[pm]+(Dsaved[pm]-D_avg[pm])*eloc_new -curAvg_w)*(eloc_new-curAvg_w); // H2 - Right(0, pm + 1) += b1 * H2_avg * vterm * weight; - Right(pm + 1, 0) += b1 * H2_avg * vterm * weight; + Right(0, pm + 1) += b1 * H2_avg * std::real(vterm) * weight; + Right(pm + 1, 0) += b1 * H2_avg * std::real(vterm) * weight; // Variance - Left(0, pm + 1) += b2 * vterm * weight; - Left(pm + 1, 0) += b2 * vterm * weight; + Left(0, pm + 1) += b2 * std::real(vterm) * weight; + Left(pm + 1, 0) += b2 * std::real(vterm) * weight; // Hamiltonian - Left(0, pm + 1) += (1 - b2) * wfe; - Left(pm + 1, 0) += (1 - b2) * wfd * eloc_new; + Left(0, pm + 1) += (1 - b2) * std::real(wfe); + Left(pm + 1, 0) += (1 - b2) * std::real(wfd) * eloc_new; for (int pm2 = 0; pm2 < getNumParams(); pm2++) { // Hamiltonian - Left(pm + 1, pm2 + 1) += (1 - b2) * wfd * (HDsaved[pm2] + (Dsaved[pm2] - D_avg[pm2]) * eloc_new); + Left(pm + 1, pm2 + 1) += std::real((1 - b2) * std::conj(wfd) * (HDsaved[pm2] + (Dsaved[pm2] - D_avg[pm2]) * eloc_new)); // Overlap - RealType ovlij = wfd * (Dsaved[pm2] - D_avg[pm2]); + RealType ovlij = std::real(std::conj(wfd) * (Dsaved[pm2] - D_avg[pm2])); Right(pm + 1, pm2 + 1) += ovlij; // Variance - RealType varij = weight * (HDsaved[pm] - 2.0 * (Dsaved[pm] - D_avg[pm]) * eloc_new) * - (HDsaved[pm2] - 2.0 * (Dsaved[pm2] - D_avg[pm2]) * eloc_new); + RealType varij = weight * std::real((HDsaved[pm] - RealType(2.0) * std::conj(Dsaved[pm] - D_avg[pm]) * eloc_new) * + (HDsaved[pm2] - RealType(2.0) * (Dsaved[pm2] - D_avg[pm2]) * eloc_new)); // RealType varij=weight*(HDsaved[pm] +(Dsaved[pm]-D_avg[pm])*eloc_new-curAvg_w)* // (HDsaved[pm2] + (Dsaved[pm2]-D_avg[pm2])*eloc_new-curAvg_w); Left(pm + 1, pm2 + 1) += b2 * (varij + V_avg * ovlij); diff --git a/src/QMCDrivers/WFOpt/QMCCostFunction.h b/src/QMCDrivers/WFOpt/QMCCostFunction.h index c8c88a5dd9..fe188f278c 100644 --- a/src/QMCDrivers/WFOpt/QMCCostFunction.h +++ b/src/QMCDrivers/WFOpt/QMCCostFunction.h @@ -56,7 +56,7 @@ class QMCCostFunction : public QMCCostFunctionBase, public CloneManager /** Temp derivative properties and Hderivative properties of all the walkers */ - std::vector*> DerivRecords; + std::vector*> DerivRecords; std::vector*> HDerivRecords; Return_rt CSWeight; diff --git a/src/QMCDrivers/WFOpt/QMCCostFunctionBase.cpp b/src/QMCDrivers/WFOpt/QMCCostFunctionBase.cpp index 5239f59939..fc6e7a6483 100644 --- a/src/QMCDrivers/WFOpt/QMCCostFunctionBase.cpp +++ b/src/QMCDrivers/WFOpt/QMCCostFunctionBase.cpp @@ -251,7 +251,7 @@ void QMCCostFunctionBase::reportParametersH5() if (!myComm->rank()) { int ci_size = 0; - std::vector CIcoeff; + std::vector CIcoeff; for (int i = 0; i < OptVariables.size(); i++) { std::array Coeff; @@ -271,7 +271,7 @@ void QMCCostFunctionBase::reportParametersH5() if (ci_size > 0) { CI_Opt = true; - newh5 = RootName + ".opt.h5"; + newh5 = RootName + ".opt.h5"; *msg_stream << " " << std::endl; hdf_archive hout; hout.create(newh5, H5F_ACC_TRUNC); diff --git a/src/QMCDrivers/WFOpt/QMCCostFunctionBase.h b/src/QMCDrivers/WFOpt/QMCCostFunctionBase.h index 6f56ecd61a..7394803cb2 100644 --- a/src/QMCDrivers/WFOpt/QMCCostFunctionBase.h +++ b/src/QMCDrivers/WFOpt/QMCCostFunctionBase.h @@ -68,7 +68,7 @@ class QMCCostFunctionBase : public CostFunctionBase, public SUM_INDEX_SIZE }; - using EffectiveWeight = QMCTraits::QTFull::RealType; + using EffectiveWeight = QMCTraits::QTFull::RealType; using FullPrecRealType = QMCTraits::FullPrecRealType; ///Constructor. QMCCostFunctionBase(ParticleSet& w, TrialWaveFunction& psi, QMCHamiltonian& h, Communicate* comm); @@ -85,7 +85,7 @@ class QMCCostFunctionBase : public CostFunctionBase, public ///Path and name of the HDF5 prefix where CI coeffs are saved std::string newh5; ///assign optimization parameter i - Return_t& Params(int i) override { return OptVariables[i]; } + Return_rt& Params(int i) override { return OptVariables[i]; } ///return optimization parameter i Return_t Params(int i) const override { return OptVariables[i]; } int getType(int i) const { return OptVariables.getType(i); } diff --git a/src/QMCDrivers/WFOpt/QMCCostFunctionBatched.cpp b/src/QMCDrivers/WFOpt/QMCCostFunctionBatched.cpp index 5a8f830920..1e260bf26c 100644 --- a/src/QMCDrivers/WFOpt/QMCCostFunctionBatched.cpp +++ b/src/QMCDrivers/WFOpt/QMCCostFunctionBatched.cpp @@ -763,7 +763,7 @@ QMCCostFunctionBatched::Return_rt QMCCostFunctionBatched::fillOverlapHamiltonian Return_t wfe = (HDsaved[pm] + (Dsaved[pm] - D_avg[pm]) * eloc_new) * weight; Return_t wfd = (Dsaved[pm] - D_avg[pm]) * weight; Return_t vterm = - HDsaved[pm] * (eloc_new - curAvg_w) + (Dsaved[pm] - D_avg[pm]) * eloc_new * (eloc_new - 2.0 * curAvg_w); + HDsaved[pm] * (eloc_new - curAvg_w) + (Dsaved[pm] - D_avg[pm]) * eloc_new * (eloc_new - RealType(2.0) * curAvg_w); // H2 Right(0, pm + 1) += b1 * H2_avg * std::real(vterm) * weight; Right(pm + 1, 0) += b1 * H2_avg * std::real(vterm) * weight; @@ -781,8 +781,8 @@ QMCCostFunctionBatched::Return_rt QMCCostFunctionBatched::fillOverlapHamiltonian RealType ovlij = std::real(std::conj(wfd) * (Dsaved[pm2] - D_avg[pm2])); Right(pm + 1, pm2 + 1) += ovlij; // Variance - RealType varij = weight * std::real((HDsaved[pm] - 2.0 * std::conj(Dsaved[pm] - D_avg[pm]) * eloc_new) * - (HDsaved[pm2] - 2.0 * (Dsaved[pm2] - D_avg[pm2]) * eloc_new)); + RealType varij = weight * std::real((HDsaved[pm] - RealType(2.0) * std::conj(Dsaved[pm] - D_avg[pm]) * eloc_new) * + (HDsaved[pm2] - RealType(2.0) * (Dsaved[pm2] - D_avg[pm2]) * eloc_new)); Left(pm + 1, pm2 + 1) += b2 * (varij + V_avg * ovlij); // H2 Right(pm + 1, pm2 + 1) += b1 * H2_avg * varij; diff --git a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp index d7e0dae882..5c65f09cd7 100644 --- a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp +++ b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp @@ -1054,7 +1054,7 @@ bool QMCFixedSampleLinearOptimize::adaptive_three_shift_run() << std::endl; // for each set of shifts, solve the linear method equations for the parameter update direction - std::vector> parameterDirections; + std::vector> parameterDirections; #ifdef HAVE_LMY_ENGINE // call the engine to perform update EngineObj->wfn_update_compute(); @@ -1070,7 +1070,7 @@ bool QMCFixedSampleLinearOptimize::adaptive_three_shift_run() if (true) { for (int j = 0; j < N; j++) - parameterDirections.at(i).at(j) = EngineObj->wfn_update().at(i * N + j); + parameterDirections.at(i).at(j) = std::real(EngineObj->wfn_update().at(i * N + j)); } else parameterDirections.at(i).at(0) = 1.0; @@ -1080,7 +1080,7 @@ bool QMCFixedSampleLinearOptimize::adaptive_three_shift_run() optTarget->setneedGrads(false); // prepare vectors to hold the initial and current parameters - std::vector currParams(numParams, 0.0); + std::vector currParams(numParams, 0.0); // initialize the initial and current parameter vectors for (int i = 0; i < numParams; i++) @@ -1168,8 +1168,8 @@ bool QMCFixedSampleLinearOptimize::adaptive_three_shift_run() } // find the best shift and the corresponding update direction - const std::vector* bestDirection = 0; - int best_shift = -1; + const std::vector* bestDirection = 0; + int best_shift = -1; for (int k = 0; k < costValues.size() && std::abs((initCost - initCost) / initCost) < max_relative_cost_change; k++) if (is_best_cost(k, costValues, shifts_i, initCost) && good_update.at(k)) { @@ -1440,7 +1440,7 @@ bool QMCFixedSampleLinearOptimize::descent_run() for (int i = 0; i < results.size(); i++) { - optTarget->Params(i) = results[i]; + optTarget->Params(i) = std::real(results[i]); } //If descent is being run as part of a hybrid optimization, need to check if a vector of @@ -1488,7 +1488,7 @@ bool QMCFixedSampleLinearOptimize::hybrid_run() app_log() << "Update descent engine parameter values after Blocked LM step" << std::endl; for (int i = 0; i < optTarget->getNumParams(); i++) { - ValueType val = optTarget->Params(i); + RealType val = optTarget->Params(i); descentEngineObj->setParamVal(i, val); } } diff --git a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp index 7aaac1e60b..186e725575 100644 --- a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp +++ b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp @@ -1344,7 +1344,7 @@ bool QMCFixedSampleLinearOptimizeBatched::adaptive_three_shift_run() << std::endl; // for each set of shifts, solve the linear method equations for the parameter update direction - std::vector> parameterDirections; + std::vector> parameterDirections; #ifdef HAVE_LMY_ENGINE // call the engine to perform update EngineObj->wfn_update_compute(); @@ -1360,7 +1360,7 @@ bool QMCFixedSampleLinearOptimizeBatched::adaptive_three_shift_run() if (true) { for (int j = 0; j < N; j++) - parameterDirections.at(i).at(j) = EngineObj->wfn_update().at(i * N + j); + parameterDirections.at(i).at(j) = std::real(EngineObj->wfn_update().at(i * N + j)); } else parameterDirections.at(i).at(0) = 1.0; @@ -1370,7 +1370,7 @@ bool QMCFixedSampleLinearOptimizeBatched::adaptive_three_shift_run() //There will be updates of 0 for parameters that were filtered out before derivative ratios were used by the engine. if (options_LMY_.filter_param) { - std::vector> tmpParameterDirections; + std::vector> tmpParameterDirections; tmpParameterDirections.resize(shifts_i.size()); for (int i = 0; i < shifts_i.size(); i++) @@ -1400,7 +1400,7 @@ bool QMCFixedSampleLinearOptimizeBatched::adaptive_three_shift_run() optTarget->setneedGrads(false); // prepare vectors to hold the initial and current parameters - std::vector currParams(numParams, 0.0); + std::vector currParams(numParams, 0.0); // initialize the initial and current parameter vectors for (int i = 0; i < numParams; i++) @@ -1493,8 +1493,8 @@ bool QMCFixedSampleLinearOptimizeBatched::adaptive_three_shift_run() } // find the best shift and the corresponding update direction - const std::vector* bestDirection = 0; - int best_shift = -1; + const std::vector* bestDirection = 0; + int best_shift = -1; for (int k = 0; k < costValues.size() && std::abs((initCost - initCost) / initCost) < options_LMY_.max_relative_cost_change; k++) if (is_best_cost(k, costValues, shifts_i, initCost) && good_update.at(k)) @@ -1778,7 +1778,7 @@ bool QMCFixedSampleLinearOptimizeBatched::descent_run() for (int i = 0; i < results.size(); i++) { - optTarget->Params(i) = results[i]; + optTarget->Params(i) = std::real(results[i]); } //If descent is being run as part of a hybrid optimization, need to check if a vector of diff --git a/src/QMCDrivers/tests/test_DescentEngine.cpp b/src/QMCDrivers/tests/test_DescentEngine.cpp index b75cfe56fa..25d970975c 100644 --- a/src/QMCDrivers/tests/test_DescentEngine.cpp +++ b/src/QMCDrivers/tests/test_DescentEngine.cpp @@ -44,8 +44,8 @@ TEST_CASE("DescentEngine RMSprop update", "[drivers][descent]") optimize::VariableSet myVars; //Two fake parameters are specified - optimize::VariableSet::value_type first_param(1.0); - optimize::VariableSet::value_type second_param(-2.0); + optimize::VariableSet::real_type first_param(1.0); + optimize::VariableSet::real_type second_param(-2.0); myVars.insert("first", first_param); myVars.insert("second", second_param); diff --git a/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp b/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp index 66a117ab85..45ea1105ed 100644 --- a/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp +++ b/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp @@ -561,10 +561,10 @@ std::unique_ptr SlaterDetBuilder::createMSDFast( Optimizable = CI_Optimizable = true; if (csf_data_ptr) for (int i = 1; i < csf_data_ptr->coeffs.size(); i++) - myVars.insert(CItags[i], csf_data_ptr->coeffs[i], true, optimize::LINEAR_P); + myVars.insert(CItags[i], std::real(csf_data_ptr->coeffs[i]), true, optimize::LINEAR_P); else for (int i = 1; i < C.size(); i++) - myVars.insert(CItags[i], C[i], true, optimize::LINEAR_P); + myVars.insert(CItags[i], std::real(C[i]), true, optimize::LINEAR_P); } else { diff --git a/src/QMCWaveFunctions/RotatedSPOs.cpp b/src/QMCWaveFunctions/RotatedSPOs.cpp index 32cfa1923d..4ab83f7896 100644 --- a/src/QMCWaveFunctions/RotatedSPOs.cpp +++ b/src/QMCWaveFunctions/RotatedSPOs.cpp @@ -134,7 +134,7 @@ void RotatedSPOs::resetParametersExclusive(const opt_variables_type& active) // Save the the params for (int i = 0; i < m_full_rot_inds.size(); i++) - myVarsFull[i] = new_param[i]; + myVarsFull[i] = std::real(new_param[i]); } else { @@ -227,7 +227,7 @@ void RotatedSPOs::readVariationalParameters(hdf_archive& hin) std::vector full_params(nparam_full); hin.read(full_params, rot_global_name); for (int i = 0; i < nparam_full; i++) - myVarsFull[i] = full_params[i]; + myVarsFull[i] = std::real(full_params[i]); hin.pop(); @@ -278,7 +278,7 @@ void RotatedSPOs::readVariationalParameters(hdf_archive& hin) std::vector params(nparam); hin.read(params, rot_param_name); for (int i = 0; i < nparam; i++) - myVars[i] = params[i]; + myVars[i] = std::real(params[i]); hin.pop(); @@ -352,7 +352,7 @@ void RotatedSPOs::buildOptVariables(const RotationIndices& rotations, const Rota // If the user input parameters, use those. Otherwise, initialize the parameters to zero if (params_supplied) { - myVars.insert(sstr.str(), params[i]); + myVars.insert(sstr.str(), std::real(params[i])); } else { @@ -372,7 +372,7 @@ void RotatedSPOs::buildOptVariables(const RotationIndices& rotations, const Rota << "_" << (q < 10 ? "0" : "") << (q < 100 ? "0" : "") << (q < 1000 ? "0" : "") << q; if (params_supplied && i < m_act_rot_inds.size()) - myVarsFull.insert(sstr.str(), params[i]); + myVarsFull.insert(sstr.str(), std::real(params[i])); else myVarsFull.insert(sstr.str(), 0.0); } diff --git a/src/QMCWaveFunctions/VariableSet.cpp b/src/QMCWaveFunctions/VariableSet.cpp index e9ee94daf1..3528f8dd1e 100644 --- a/src/QMCWaveFunctions/VariableSet.cpp +++ b/src/QMCWaveFunctions/VariableSet.cpp @@ -54,7 +54,7 @@ void VariableSet::insertFrom(const VariableSet& input) void VariableSet::insertFromSum(const VariableSet& input_1, const VariableSet& input_2) { - value_type sum_val; + real_type sum_val; std::string vname; // Check that objects to be summed together have the same number of active @@ -94,7 +94,7 @@ void VariableSet::insertFromSum(const VariableSet& input_1, const VariableSet& i void VariableSet::insertFromDiff(const VariableSet& input_1, const VariableSet& input_2) { - value_type diff_val; + real_type diff_val; std::string vname; // Check that objects to be subtracted have the same number of active @@ -259,7 +259,7 @@ void VariableSet::writeToHDF(const std::string& filename, qmcplusplus::hdf_archi hout.push("name_value_lists"); - std::vector param_values; + std::vector param_values; std::vector param_names; for (auto& pair_it : NameAndValue) { @@ -292,7 +292,7 @@ void VariableSet::readFromHDF(const std::string& filename, qmcplusplus::hdf_arch throw std::runtime_error(err_msg.str()); } - std::vector param_values; + std::vector param_values; hin.read(param_values, "parameter_values"); std::vector param_names; diff --git a/src/QMCWaveFunctions/VariableSet.h b/src/QMCWaveFunctions/VariableSet.h index 66ba4da3bf..8845f9a7cd 100644 --- a/src/QMCWaveFunctions/VariableSet.h +++ b/src/QMCWaveFunctions/VariableSet.h @@ -48,10 +48,9 @@ enum */ struct VariableSet { - using value_type = qmcplusplus::QMCTraits::ValueType; - using real_type = qmcplusplus::QMCTraits::RealType; + using real_type = qmcplusplus::QMCTraits::RealType; - using pair_type = std::pair; + using pair_type = std::pair; using index_pair_type = std::pair; using iterator = std::vector::iterator; using const_iterator = std::vector::const_iterator; @@ -131,7 +130,7 @@ struct VariableSet return -1; } - inline void insert(const std::string& vname, value_type v, bool enable = true, int type = OTHER_P) + inline void insert(const std::string& vname, real_type v, bool enable = true, int type = OTHER_P) { iterator loc = find(vname); int ind_loc = loc - NameAndValue.begin(); @@ -169,7 +168,7 @@ struct VariableSet /** equivalent to std::map[string] operator */ - inline value_type& operator[](const std::string& vname) + inline real_type& operator[](const std::string& vname) { iterator loc = find(vname); if (loc == NameAndValue.end()) @@ -192,12 +191,12 @@ struct VariableSet /** return the i-th value * @param i index */ - inline value_type operator[](int i) const { return NameAndValue[i].second; } + inline real_type operator[](int i) const { return NameAndValue[i].second; } /** assign the i-th value * @param i index */ - inline value_type& operator[](int i) { return NameAndValue[i].second; } + inline real_type& operator[](int i) { return NameAndValue[i].second; } /** get the i-th parameter's type * @param i index diff --git a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp index 1ef8754f06..ccee20cb12 100644 --- a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp +++ b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp @@ -772,18 +772,18 @@ TEST_CASE("RotatedSPOs read and write parameters", "[wavefunction]") rot2.readVariationalParameters(hin); opt_variables_type& var = testing::getMyVars(rot2); - CHECK(var[0] == ValueApprox(vs[0])); - CHECK(var[1] == ValueApprox(vs[1])); - CHECK(var[2] == ValueApprox(vs[2])); - CHECK(var[3] == ValueApprox(vs[3])); + CHECK(var[0] == Approx(vs[0])); + CHECK(var[1] == Approx(vs[1])); + CHECK(var[2] == Approx(vs[2])); + CHECK(var[3] == Approx(vs[3])); opt_variables_type& full_var = testing::getMyVarsFull(rot2); - CHECK(full_var[0] == ValueApprox(vs[0])); - CHECK(full_var[1] == ValueApprox(vs[1])); - CHECK(full_var[2] == ValueApprox(vs[2])); - CHECK(full_var[3] == ValueApprox(vs[3])); - CHECK(full_var[4] == ValueApprox(0.0)); - CHECK(full_var[5] == ValueApprox(0.0)); + CHECK(full_var[0] == Approx(vs[0])); + CHECK(full_var[1] == Approx(vs[1])); + CHECK(full_var[2] == Approx(vs[2])); + CHECK(full_var[3] == Approx(vs[3])); + CHECK(full_var[4] == Approx(0.0)); + CHECK(full_var[5] == Approx(0.0)); } // Test using history list. @@ -826,10 +826,10 @@ TEST_CASE("RotatedSPOs read and write parameters history", "[wavefunction]") rot2.readVariationalParameters(hin); opt_variables_type& var = testing::getMyVars(rot2); - CHECK(var[0] == ValueApprox(vs[0])); - CHECK(var[1] == ValueApprox(vs[1])); - CHECK(var[2] == ValueApprox(vs[2])); - CHECK(var[3] == ValueApprox(vs[3])); + CHECK(var[0] == Approx(vs[0])); + CHECK(var[1] == Approx(vs[1])); + CHECK(var[2] == Approx(vs[2])); + CHECK(var[3] == Approx(vs[3])); auto hist = testing::getHistoryParams(rot2); REQUIRE(hist.size() == 1); diff --git a/src/QMCWaveFunctions/tests/test_variable_set.cpp b/src/QMCWaveFunctions/tests/test_variable_set.cpp index d195a7a0b0..8e8b97932a 100644 --- a/src/QMCWaveFunctions/tests/test_variable_set.cpp +++ b/src/QMCWaveFunctions/tests/test_variable_set.cpp @@ -11,7 +11,6 @@ #include "catch.hpp" -#include "complex_approx.hpp" #include "VariableSet.h" #include "io/hdf/hdf_archive.h" @@ -20,7 +19,6 @@ #include using std::string; -using qmcplusplus::ValueApprox; namespace optimize { @@ -37,7 +35,7 @@ TEST_CASE("VariableSet empty", "[optimize]") TEST_CASE("VariableSet one", "[optimize]") { VariableSet vs; - VariableSet::value_type first_val(1.123456789); + VariableSet::real_type first_val(1.123456789); vs.insert("first", first_val); std::vector names{"first"}; vs.activate(names.begin(), names.end(), true); @@ -47,44 +45,31 @@ TEST_CASE("VariableSet one", "[optimize]") REQUIRE(vs.getIndex("first") == 0); REQUIRE(vs.name(0) == "first"); double first_val_real = 1.123456789; - CHECK(std::real(vs[0] ) == Approx(first_val_real)); + CHECK(vs[0] == Approx(first_val_real)); std::ostringstream o; vs.print(o, 0, false); //std::cout << o.str() << std::endl; - #ifdef QMC_COMPLEX - REQUIRE(o.str() == "first (1.123457e+00,0.000000e+00) 0 1 ON 0\n"); - #else REQUIRE(o.str() == "first 1.123457e+00 0 1 ON 0\n"); - #endif std::ostringstream o2; vs.print(o2, 1, true); //std::cout << o2.str() << std::endl; - #ifdef QMC_COMPLEX - char formatted_output[] = " Name Value Type Recompute Use Index\n" - " ----- ---------------------------- ---- --------- --- -----\n" - " first (1.123457e+00,0.000000e+00) 0 1 ON 0\n"; - - - REQUIRE(o2.str() == formatted_output); - #else char formatted_output[] = " Name Value Type Recompute Use Index\n" " ----- ---------------------------- ---- --------- --- -----\n" " first 1.123457e+00 0 1 ON 0\n"; REQUIRE(o2.str() == formatted_output); - #endif } TEST_CASE("VariableSet output", "[optimize]") { VariableSet vs; - VariableSet::value_type first_val(11234.56789); - VariableSet::value_type second_val(0.000256789); - VariableSet::value_type third_val(-1.2); + VariableSet::real_type first_val(11234.56789); + VariableSet::real_type second_val(0.000256789); + VariableSet::real_type third_val(-1.2); vs.insert("s", first_val); vs.insert("second", second_val); vs.insert("really_long_name", third_val); @@ -95,19 +80,11 @@ TEST_CASE("VariableSet output", "[optimize]") vs.print(o, 0, true); //std::cout << o.str() << std::endl; - #ifdef QMC_COMPLEX - char formatted_output[] = " Name Value Type Recompute Use Index\n" - "---------------- ---------------------------- ---- --------- --- -----\n" - " s (1.123457e+04,0.000000e+00) 0 1 ON 0\n" - " second (2.567890e-04,0.000000e+00) 0 1 ON 1\n" - "really_long_name (-1.200000e+00,0.000000e+00) 0 1 ON 2\n"; - #else char formatted_output[] = " Name Value Type Recompute Use Index\n" "---------------- ---------------------------- ---- --------- --- -----\n" " s 1.123457e+04 0 1 ON 0\n" " second 2.567890e-04 0 1 ON 1\n" "really_long_name -1.200000e+00 0 1 ON 2\n"; - #endif REQUIRE(o.str() == formatted_output); } @@ -115,9 +92,9 @@ TEST_CASE("VariableSet output", "[optimize]") TEST_CASE("VariableSet HDF output and input", "[optimize]") { VariableSet vs; - VariableSet::value_type first_val(11234.56789); - VariableSet::value_type second_val(0.000256789); - VariableSet::value_type third_val(-1.2); + VariableSet::real_type first_val(11234.56789); + VariableSet::real_type second_val(0.000256789); + VariableSet::real_type third_val(-1.2); vs.insert("s", first_val); vs.insert("second", second_val); vs.insert("really_really_really_long_name", third_val); @@ -129,8 +106,8 @@ TEST_CASE("VariableSet HDF output and input", "[optimize]") vs2.insert("second", 0.0); qmcplusplus::hdf_archive hin; vs2.readFromHDF("vp.h5", hin); - CHECK(vs2.find("s")->second == ValueApprox(first_val)); - CHECK(vs2.find("second")->second == ValueApprox(second_val)); + CHECK(vs2.find("s")->second == Approx(first_val)); + CHECK(vs2.find("second")->second == Approx(second_val)); // This value as in the file, but not in the VariableSet that loaded the file, // so the value does not get added. CHECK(vs2.find("really_really_really_long_name") == vs2.end());