45 :
QMCDriver(project_data, w, psi, h,
comm,
"WaveFunctionTester"),
56 outputDeltaVsError(false),
58 ndim(w.getLattice().ndim)
76 app_log() <<
"WF test in " <<
ndim <<
"D" << std::endl;
77 for (
int iat = 0; iat <
deltaR.size(); ++iat)
103 std::array<char, 16> fname;
105 throw std::runtime_error(
"Error generating filename");
106 fout.open(fname.data());
109 app_log() <<
"Starting a Wavefunction tester. Additional information in " << fname.data() << std::endl;
113 auto Rng1 = std::make_unique<RandomGenerator>();
116 Rng.emplace_back(std::move(Rng1));
139 for (
int iat = 0; iat <
deltaR.size(); ++iat)
149 throw std::runtime_error(
"orbitalutility \"rotation\" has been removed.");
157 app_log() <<
"No wavefunction test specified" << std::endl;
166 app_log() <<
" ===== runCloneTest =====\n";
167 for (
int iter = 0; iter < 4; ++iter)
169 app_log() <<
"Clone" << iter << std::endl;
170 auto w_clone = std::make_unique<MCWalkerConfiguration>(
W);
172 auto h_clone =
H.
makeClone(*w_clone, *psi_clone);
173 h_clone->setPrimary(
false);
184 w_clone->R = awalker.
R;
186 ValueType logpsi2 = psi_clone->evaluateLog(*w_clone);
187 RealType eloc2 = h_clone->evaluate(*w_clone);
188 app_log() <<
"Testing walker-by-walker functions " << std::endl;
189 app_log() <<
"log (original) = " << logpsi1 <<
" energy = " << eloc1 << std::endl;
190 app_log() <<
"log (clone) = " << logpsi2 <<
" energy = " << eloc2 << std::endl;
191 app_log() <<
"Testing pbyp functions " << std::endl;
194 app_log() <<
" Walker Buffer State current=" << wbuffer.
current() <<
" size=" << wbuffer.
size() << std::endl;
201 app_log() <<
" Walker Buffer State current=" << wbuffer.
current() <<
" size=" << wbuffer.
size() << std::endl;
203 app_log() <<
" Walker Buffer State current=" << wbuffer.
current() <<
" size=" << wbuffer.
size() << std::endl;
204 psi_clone->registerData(
W, wbuffer);
210 app_log() <<
" Walker Buffer State current=" << wbuffer.
current() <<
" size=" << wbuffer.
size() << std::endl;
211 app_log() <<
"log (original) = " << logpsi1 <<
" energy = " << eloc1 << std::endl;
212 app_log() <<
"log (clone) = " << logpsi2 <<
" energy = " << eloc2 << std::endl;
218 app_log() <<
" ===== printEloc =====\n";
220 app_log() <<
"ParticelSet = " << key << std::endl;
245 app_log() <<
" Logpsi: " << logpsi << std::endl;
247 <<
" Total " << eloc << std::endl;
252 double maxR = 1000000.0;
253 std::vector<int> closestElectron(ncenter);
254 for (
int iat = 0; iat < ncenter; iat++)
257 for (
int k = 0; k < nel; k++)
259 double dx =
std::sqrt((
W.
R[k][0] - source.
R[iat][0]) * (
W.
R[k][0] - source.
R[iat][0]) +
260 (
W.
R[k][1] - source.
R[iat][1]) * (
W.
R[k][1] - source.
R[iat][1]) +
261 (
W.
R[k][2] - source.
R[iat][2]) * (
W.
R[k][2] - source.
R[iat][2]));
265 closestElectron[iat] = k;
270 std::ofstream out(
"eloc.dat");
271 double x, dx = 1.0 / 499.0;
272 for (
int k = 0; k < 500; k++)
276 for (
int iat = 0; iat < ncenter; iat++)
278 PosType tempR =
W.
R[closestElectron[iat]];
279 W.
R[closestElectron[iat]] = source.
R[iat];
281 W.
R[closestElectron[iat]][0] += x;
286 W.
R[closestElectron[iat]] = source.
R[iat];
288 W.
R[closestElectron[iat]][1] += x;
293 W.
R[closestElectron[iat]] = source.
R[iat];
295 W.
R[closestElectron[iat]][2] += x;
300 W.
R[closestElectron[iat]] = tempR;
364 positions.push_back(p);
367 for (
int iat = 0; iat < nat; iat++)
373 for (
int idim = 0; idim <
ndim; idim++)
376 p.
r[idim] = r0[idim] - delta;
377 positions.push_back(p);
380 p.
r[idim] = r0[idim] + delta;
381 positions.push_back(p);
389 p.
r[idim] = r0[idim] - dd;
390 positions.push_back(p);
393 p.
r[idim] = r0[idim] + dd;
394 positions.push_back(p);
410 assert(positions.size() == values.size());
411 if (positions.size() == 0)
439 const int pt_per_deriv = 2;
440 for (
int pt_i = 1; pt_i < values.size(); pt_i += pt_per_deriv *
ndim)
444 for (
int idim = 0; idim <
ndim; idim++)
446 int idx = pt_i + idim * pt_per_deriv;
450 g0[idim] = logpsi_p - logpsi_m;
451 lap0 += logpsi_p + logpsi_m;
454 int iat = positions[pt_i].index;
458 ValueType lap = c2 * (lap0 - twoD * logpsi);
478 for (
int pt_i = 1; pt_i < values.size(); pt_i += pt_per_deriv *
ndim)
499 for (
int idim = 0; idim <
ndim; idim++)
501 int idx = pt_i + idim * pt_per_deriv + 2 * inr;
504 g_base[inr][idim] = (logpsi_p - logpsi_m) / twodd;
505 l_base[inr] += (logpsi_p + logpsi_m - ctwo * logpsi) / ddsq;
514 g_prev[0] = g_base[0];
519 g_rich[0] = g_base[inr];
522 for (
int j = 1; j < inr + 1; j++)
524 g_rich[j] = g_rich[j - 1] + (g_rich[j - 1] - g_prev[j - 1]) / (fac - 1);
529 for (
int idim = 0; idim <
ndim; idim++)
531 err1 +=
std::abs(g_rich[inr][idim] - g_prev[inr - 1][idim]);
557 l_prev[0] = l_base[0];
563 l_rich[0] = l_base[inr];
566 for (
int j = 1; j < inr + 1; j++)
568 l_rich[j] = l_rich[j - 1] + (l_rich[j - 1] - l_prev[j - 1]) / (fac - 1);
588 int iat = positions[pt_i].index;
605 FiniteDifference::PosChangeVector::iterator it;
607 for (it = positions.begin(); it != positions.end(); it++)
610 W.
R[it->index] = it->r;
613 #if defined(QMC_COMPLEX) 615 ValueType logpsi = std::complex<OHMMS_PRECISION>(logpsi0, phase0);
619 logpsi_vals.push_back(logpsi);
638 std::stringstream&
log,
648 bool all_okay =
true;
649 std::string pad(4 * indent,
' ');
652 for (
int iat = lower_iat; iat < upper_iat; iat++)
658 if (L_err_rel > rel_tol && L_err > abs_tol)
660 if (L_err_rel > rel_tol)
662 log << pad <<
"Finite difference Laplacian exceeds relative tolerance (" << rel_tol <<
") for particle " << iat
667 log << pad <<
"Finite difference Laplacian exceeds absolute tolerance (" << abs_tol <<
") for particle " << iat
670 log << pad <<
" Analytic = " << L[iat] << std::endl;
671 log << pad <<
" Finite diff = " << L_fd[iat] << std::endl;
672 log << pad <<
" Error = " << L_err <<
" Relative Error = " << L_err_rel << std::endl;
677 for (
int idim = 0; idim <
OHMMS_DIM; idim++)
681 G_err_rel[idim] =
std::abs(G_err / G[iat][idim]);
683 if (G_err_rel[idim] > rel_tol && G_err > abs_tol)
685 if (G_err_rel[idim] > rel_tol)
687 log << pad <<
"Finite difference gradient exceeds relative tolerance (" << rel_tol <<
") for particle " 692 log << pad <<
"Finite difference gradient exceeds absolute tolerance (" << abs_tol <<
") for particle " 695 log <<
" component " << idim << std::endl;
696 log << pad <<
" Analytic = " << G[iat][idim] << std::endl;
697 log << pad <<
" Finite diff = " << G_fd[iat][idim] << std::endl;
698 log << pad <<
" Error = " << G_err <<
" Relative Error = " << G_err_rel[idim] << std::endl;
703 fout << pad <<
"For particle #" << iat <<
" at " <<
W.
R[iat] << std::endl;
704 fout << pad <<
"Gradient = " << std::setw(12) << G[iat] << std::endl;
705 fout << pad <<
" Finite diff = " << std::setw(12) << G_fd[iat] << std::endl;
706 fout << pad <<
" Error = " << std::setw(12) << G[iat] - G_fd[iat] << std::endl;
707 fout << pad <<
" Relative Error = ";
708 for (
int idim = 0; idim <
OHMMS_DIM; idim++)
710 fout << G_err_rel[idim] <<
" ";
712 fout << std::endl << std::endl;
713 fout << pad <<
"Laplacian = " << std::setw(12) << L[iat] << std::endl;
714 fout << pad <<
" Finite diff = " << std::setw(12) << L_fd[iat] << std::endl;
715 fout << pad <<
" Error = " << std::setw(12) << L[iat] - L_fd[iat] <<
" Relative Error = " << L_err_rel
723 std::stringstream& fail_log,
752 FiniteDifference::PosChangeVector::iterator it;
754 for (it = positions.begin(); it != positions.end(); it++)
757 W.
R[it->index] = it->r;
761 #if defined(QMC_COMPLEX) 762 ValueType logpsi = std::complex<OHMMS_PRECISION>(logpsi0, phase0);
766 logpsi_vals.push_back(logpsi);
775 fout <<
"delta = " << delta << std::endl;
795 LogValue logpsi1 = orb->evaluateLog(
W, G, L);
797 fail_log <<
"WaveFunctionComponent " << iorb <<
" " << orb->getClassName() <<
" log psi = " << logpsi1 << std::endl;
800 FiniteDifference::PosChangeVector::iterator it;
801 for (it = positions.begin(); it != positions.end(); it++)
804 W.
R[it->index] = it->r;
809 LogValue logpsi0 = orb->evaluateLog(
W, tmpG, tmpL);
810 #if defined(QMC_COMPLEX) 811 ValueType logpsi(logpsi0.real(), logpsi0.imag());
815 logpsi_vals.push_back(logpsi);
823 fout <<
" WaveFunctionComponent " << iorb <<
" " << orb->getClassName() << std::endl;
836 for (
int isd = 0; isd < sd->
Dets.size(); isd++)
842 fail_log <<
" Slater Determiant " << isd <<
" (for particles " <<
det.getFirstIndex() <<
" to " 843 <<
det.getLastIndex() <<
") log psi = " << logpsi2 << std::endl;
851 FiniteDifference::PosChangeVector::iterator it;
852 for (it = positions.begin(); it != positions.end(); it++)
855 W.
R[it->index] = it->r;
859 #if defined(QMC_COMPLEX) 860 ValueType logpsi(logpsi0.real(), logpsi0.imag());
864 logpsi_vals.push_back(logpsi);
879 std::map<std::string, SPOSetPtr>::iterator spo_it = sd->mySPOSet.begin();
880 for (; spo_it != sd->mySPOSet.end(); spo_it++)
883 fail_log <<
" SPO set = " << spo_it->first <<
" name = " << spo->className;
884 fail_log <<
" orbital set size = " << spo->
size();
885 fail_log <<
" basis set size = " << spo->getBasisSetSize() << std::endl;
891 FiniteDifference::PosChangeVector::iterator it;
892 for (it = positions.begin(); it != positions.end(); it++)
895 W.
R[it->index] = it->r;
902 spo->evaluate(
W, it->index, psi);
904 logpsi_vals.push_back(logpsi);
927 fout <<
"Numerical gradient and Laplacian test" << std::endl;
929 std::stringstream fail_log;
930 bool all_okay =
true;
936 for (; Wit !=
W.
end(); Wit++)
938 fout <<
"Walker # " << nconfig << std::endl;
939 std::stringstream fail_log1;
946 if (!this_okay && !ignore)
948 fail_log <<
"Walker # " << nconfig << std::endl;
949 fail_log << fail_log1.str();
950 fail_log << std::endl;
957 app_log() <<
"Number of samples = " << nconfig << std::endl;
958 app_log() <<
"Number ignored (bad positions) = " << nignore << std::endl << std::endl;
959 app_log() <<
"Number of fails = " << fails << std::endl << std::endl;
963 std::string fail_name(
"wf_fails.dat");
964 app_log() <<
"More detail on finite difference failures in " << fail_name << std::endl;
965 std::ofstream eout(fail_name.c_str());
966 eout << fail_log.str();
970 app_log() <<
"Finite difference test: " << (all_okay ?
"PASS" :
"FAIL") << std::endl;
976 bool inputOkay =
true;
983 if (iat < 0 || iat >= nat)
985 dout <<
"# Particle index (" << iat <<
") is out of range (0 - " << nat - 1 <<
")" << std::endl;
991 dout <<
"# Gradient component index (" << ig <<
") is out of range (0 - " <<
OHMMS_DIM - 1 <<
")" << std::endl;
997 dout <<
"# Particle = " << iat <<
" Gradient component = " << ig << std::endl;
998 dout <<
"#" << std::setw(11) <<
"delta" << std::setw(14) <<
"G_err_rel" << std::setw(14) <<
"L_err_rel" 1002 for (
int i = 0; i < 20; i++)
1014 dout << std::setw(12) << delta;
1015 dout << std::setw(14) <<
std::abs(G_err_rel) << std::setw(14) <<
std::abs(L_err_rel);
1023 fout <<
"Ratio test" << std::endl;
1027 bool any_ratio_fail =
false;
1031 for (
int iat = 0; iat <
deltaR.size(); ++iat)
1034 fout <<
"deltaR:" << std::endl;
1036 fout <<
"Particle Ratio of Ratios Computed Ratio Internal Ratio" << std::endl;
1038 for (
int iat = 0; iat < nat; iat++)
1056 #if defined(QMC_COMPLEX) 1058 RealType dphase = phase_m - phase_p;
1059 if (phaseDiff < 0.0)
1060 phaseDiff += 2.0 * M_PI;
1061 if (phaseDiff > 2.0 * M_PI)
1062 phaseDiff -= 2.0 * M_PI;
1064 dphase += 2.0 * M_PI;
1065 if (dphase > 2.0 * M_PI)
1066 dphase -= 2.0 * M_PI;
1069 fout << iat <<
" " << aratio / ratDiff <<
" " << ratDiff <<
" " << aratio << std::endl;
1070 fout <<
" ratioMag " <<
std::abs(aratio) / ratioMag <<
" " << ratioMag << std::endl;
1071 fout <<
" PhaseDiff " << phaseDiff / dphase <<
" " << phaseDiff <<
" " << dphase << std::endl;
1074 fout << iat <<
" " << aratio / ratDiff <<
" " << ratDiff <<
" " << aratio << std::endl;
1075 if (
std::abs(aratio / ratDiff - 1.0) > ratio_tol)
1077 app_log() <<
"Wavefunction ratio exceeds tolerance " << tol <<
") for particle " << iat << std::endl;
1078 app_log() <<
" Internally computed ratio = " << aratio << std::endl;
1079 app_log() <<
" Separately computed ratio = " << ratDiff << std::endl;
1080 any_ratio_fail =
true;
1084 app_log() <<
"Ratio test: " << (any_ratio_fail ?
"FAIL" :
"PASS") << std::endl;
1096 while (it != it_end)
1106 ene =
H.registerData(
W,tbuffer);
1109 (*it)->DataSet=tbuffer;
1111 (*it)->resetProperty(logpsi,
Psi.
getPhase(),ene,0.0,0.0,1.0);
1114 app_log() <<
" HamTest " <<
" Total " << ene << std::endl;
1118 fout <<
" Update using drift " << std::endl;
1119 bool pbyp_mode=
true;
1120 for (
int iter=0; iter<4; ++iter)
1124 while (it != it_end)
1126 fout <<
"\nStart Walker " << iw++ << std::endl;
1131 H.copyFromBuffer(
W,w_buffer);
1139 for (
int iat=0; iat<nat; iat++)
1150 enew =
H.evaluatePbyP(
W,iat);
1153 fout <<
" Accepting a move for " << iat << std::endl;
1154 fout <<
" Energy after a move " << enew << std::endl;
1161 ratio_accum *= ratio;
1165 fout <<
" Rejecting a move for " << iat << std::endl;
1187 fout << iter <<
" Energy by update = "<< ene_up <<
" " << ene <<
" " << ene_up-ene << std::endl;
1188 fout << iter <<
" Ratio " << ratio_accum*ratio_accum
1189 <<
" | " <<
std::exp(2.0*(newlogpsi-logpsi)) <<
" " 1190 << ratio_accum*ratio_accum/
std::exp(2.0*(newlogpsi-logpsi)) << std::endl
1191 <<
" new log(psi) updated " << newlogpsi_up
1192 <<
" new log(psi) calculated " << newlogpsi
1193 <<
" old log(psi) " << logpsi << std::endl;
1194 fout <<
" Gradients " << std::endl;
1195 for (
int iat=0; iat<nat; iat++)
1196 fout <<
W.
G[iat]-Gp[iat] <<
W.
G[iat] << std::endl;
1197 fout <<
" Laplacians " << std::endl;
1198 for (
int iat=0; iat<nat; iat++)
1199 fout <<
W.
L[iat]-Lp[iat] <<
" " <<
W.
L[iat] << std::endl;
1203 fout <<
" Update without drift : for VMC useDrift=\"no\"" << std::endl;
1204 for (
int iter=0; iter<4; ++iter)
1208 while (it != it_end)
1210 fout <<
"\nStart Walker " << iw++ << std::endl;
1221 for (
int substep=0; substep<3; ++substep)
1224 for (
int iat=0; iat<nat; iat++)
1232 fout <<
" Accepting a move for " << iat << std::endl;
1235 ratio_accum *= ratio;
1239 fout <<
" Rejecting a move for " << iat << std::endl;
1253 fout << iter <<
" Ratio " << ratio_accum*ratio_accum
1254 <<
" | " <<
std::exp(2.0*(newlogpsi-logpsi)) <<
" " 1255 << ratio_accum*ratio_accum/
std::exp(2.0*(newlogpsi-logpsi)) << std::endl
1256 <<
" new log(psi) " << newlogpsi
1257 <<
" old log(psi) " << logpsi << std::endl;
1258 fout <<
" Gradients " << std::endl;
1259 for (
int iat=0; iat<nat; iat++)
1261 fout <<
W.
G[iat]-Gp[iat] <<
W.
G[iat] << std::endl;
1263 fout <<
" Laplacians " << std::endl;
1264 for (
int iat=0; iat<nat; iat++)
1266 fout <<
W.
L[iat]-Lp[iat] <<
" " <<
W.
L[iat] << std::endl;
1284 app_log() <<
" ===== runRatioTest2 =====\n";
1290 for (; it != it_end; ++it)
1295 for (
int iat = 0; iat <
deltaR.size(); ++iat)
1307 (*it)->DataSet = tbuffer;
1309 (*it)->resetProperty(logpsi,
Psi.
getPhase(), ene, 0.0, 0.0, 1.0);
1312 <<
" Total " << ene << std::endl;
1316 for (
int iter = 0; iter < 20; ++iter)
1321 for (; it != it_end; ++it)
1323 fout <<
"\nStart Walker " << iw++ << std::endl;
1335 for (
int iat = 0; iat <
deltaR.size(); ++iat)
1339 for (
int iat = 0; iat < nat; iat++)
1343 for (
int sds = 0; sds < 3; sds++)
1344 fout << realGrad[iat][sds] - grad_now[sds] <<
" ";
1354 fout <<
" ratio1 = " << ratio1 <<
" ration2 = " << ratio2 << std::endl;
1368 template<
typename T,
unsigned D>
1371 T* rv = &(displ[0][0]);
1373 for (
int i = 0; i < displ.size() * D; ++i)
1374 rv[i] = fac * (rv[i] - 0.5);
1380 app_log() <<
"WaveFunctionTester::runRatioV " << std::endl;
1386 W.enableVirtualMoves();
1394 std::vector<RealType> ratio_1(8), ratio_v(8);
1396 while (it != it_end)
1405 W.initVirtualMoves();
1409 for(
int nn=dt_ie->M[iat],iel=0; nn<dt_ie->M[iat+1]; nn++,iel++)
1412 if(r>Rmax)
continue;
1415 for(
int k=0; k<sphere.size(); ++k)
1417 W.makeMoveOnSphere(iel,sphere[k]);
1418 ratio_1[k]=
Psi.ratio(
W,iel);
1427 app_log() <<
"IAT = " << iat <<
" " << iel << std::endl;
1428 for(
int k=0; k<sphere.size(); ++k)
1430 app_log() << ratio_1[k]/ratio_v[k] <<
" " << ratio_1[k] << std::endl;
1442 app_log() <<
" ===== runGradSourceTest =====\n";
1444 app_log() <<
"ParticelSet = " << key << std::endl;
1447 app_log() << pit->first << std::endl;
1471 <<
" Total " << eloc << std::endl;
1485 for (
int iat = 0; iat < nions; iat++)
1489 for (
int iondim = 0; iondim < 3; iondim++)
1491 source.
R[iat][iondim] = rI[iondim] + delta;
1497 source.
R[iat][iondim] = rI[iondim] - delta;
1503 grad_ion_FD[iat][iondim] = c1 * (log_p - log_m);
1506 source.
R[iat][iondim] = rI[iondim];
1514 for (
int isrc = 0; isrc < 1 ; isrc++)
1520 for (
int dim = 0; dim <
OHMMS_DIM; dim++)
1522 grad_grad[dim].resize(nat);
1523 lapl_grad[dim].resize(nat);
1524 grad_grad_FD[dim].resize(nat);
1525 lapl_grad_FD[dim].resize(nat);
1531 for (
int iat = 0; iat < nat; iat++)
1536 for (
int eldim = 0; eldim < 3; eldim++)
1538 W.
R[iat][eldim] = r0[eldim] + delta;
1542 W.
R[iat][eldim] = r0[eldim] - delta;
1546 lapFD += gradlogpsi_m + gradlogpsi_p;
1547 gFD[eldim] = gradlogpsi_p - gradlogpsi_m;
1553 for (
int iondim = 0; iondim <
OHMMS_DIM; iondim++)
1555 for (
int eldim = 0; eldim <
OHMMS_DIM; eldim++)
1556 grad_grad_FD[iondim][iat][eldim] = c1 * gFD[eldim][iondim];
1557 lapl_grad_FD[iondim][iat] = c2 * (lapFD[iondim] - six * grad_log[iondim]);
1560 for (
int dimsrc = 0; dimsrc <
OHMMS_DIM; dimsrc++)
1562 for (
int iat = 0; iat < nat; iat++)
1564 fout <<
"For particle #" << iat <<
" at " <<
W.
R[iat] << std::endl;
1565 fout <<
"Grad Gradient = " << std::setw(12) << grad_grad[dimsrc][iat] << std::endl
1566 <<
" Finite diff = " << std::setw(12) << grad_grad_FD[dimsrc][iat] << std::endl
1567 <<
" Error = " << std::setw(12) << grad_grad_FD[dimsrc][iat] - grad_grad[dimsrc][iat] << std::endl
1569 fout <<
"Grad Laplacian = " << std::setw(12) << lapl_grad[dimsrc][iat] << std::endl
1570 <<
" Finite diff = " << std::setw(12) << lapl_grad_FD[dimsrc][iat] << std::endl
1571 <<
" Error = " << std::setw(12) << lapl_grad_FD[dimsrc][iat] - lapl_grad[dimsrc][iat] << std::endl
1575 fout <<
"==== BEGIN Ion Gradient Check ====\n";
1576 for (
int iat = 0; iat < nions; iat++)
1578 fout <<
"For ion #" << iat <<
" at " << source.
R[iat] << std::endl;
1579 fout <<
"Gradient = " << std::setw(12) << grad_ion[iat] << std::endl
1580 <<
" Finite diff = " << std::setw(12) << grad_ion_FD[iat] << std::endl
1581 <<
" Error = " << std::setw(12) << grad_ion_FD[iat] - grad_ion[iat] << std::endl
1584 fout <<
"==== END Ion Gradient Check ====\n";
1592 app_log() <<
" ===== runZeroVarianceTest =====\n";
1594 app_log() <<
"ParticelSet = " << key << std::endl;
1597 app_log() << pit->first << std::endl;
1630 for (
int i = 1; i < 8; i++)
1632 std::array<char, 32> fname;
1634 throw std::runtime_error(
"Error generating filename");
1635 FILE* fzout = fopen(fname.data(),
"w");
1640 for (
int dim = 0; dim <
OHMMS_DIM; dim++)
1642 grad_grad[dim].resize(nat);
1643 lapl_grad[dim].resize(nat);
1644 grad_grad_FD[dim].resize(nat);
1645 lapl_grad_FD[dim].resize(nat);
1647 for (r1[0] = 0.0; r1[0] < 5.0; r1[0] += 1.0e-4)
1650 fprintf(fzout,
"%1.8e %1.8e %1.8e ", r1[0], r1[1], r1[2]);
1653 #if defined(QMC_COMPLEX) 1663 #if defined(QMC_COMPLEX) 1664 fprintf(fzout,
"%16.12e %16.12e %16.12e ", psi.real(), psi.imag(), KE);
1666 fprintf(fzout,
"%16.12e %16.12e ", psi, KE);
1668 for (
int isrc = 0; isrc < source.
getTotalNum(); isrc++)
1671 for (
int dim = 0; dim <
OHMMS_DIM; dim++)
1673 double ZV = 0.5 *
Sum(lapl_grad[dim]) +
Dot(grad_grad[dim],
W.
G);
1674 #if defined(QMC_COMPLEX) 1675 fprintf(fzout,
"%16.12e %16.12e %16.12e ", ZV, grad_log[dim].
real(), grad_log[dim].
imag());
1677 fprintf(fzout,
"%16.12e %16.12e ", ZV, grad_log[dim]);
1681 fprintf(fzout,
"\n");
1690 xmlNodePtr tcur = q->children;
1691 while (tcur != NULL)
1693 std::string cname((
const char*)(tcur->name));
1694 if (cname ==
"delta_output")
1709 app_log() <<
" ===== runDerivTest =====\n";
1710 app_log() <<
" Testing derivatives" << std::endl;
1720 fout <<
"Position " << std::endl <<
W.
R << std::endl;
1728 <<
" Total " << eloc << std::endl;
1736 fout <<
"Gradients" << std::endl;
1737 for (
int iat = 0; iat <
W.
R.size(); iat++)
1739 for (
int i = 0; i < 3; i++)
1740 fout <<
W.
G[iat][i] <<
" ";
1743 fout <<
"Laplaians" << std::endl;
1744 for (
int iat = 0; iat <
W.
R.size(); iat++)
1755 wfvar_prime = wfVars;
1757 int Nvars = wfVars.
size();
1760 std::vector<RealType> PGradient(Nvars);
1761 std::vector<RealType> HGradient(Nvars);
1772 for (
int i = 0; i < Nvars; i++)
1774 for (
int j = 0; j < Nvars; j++)
1775 wfvar_prime[j] = wfVars[j];
1776 wfvar_prime[i] = wfVars[i] + FiniteDiff;
1785 wfvar_prime[i] = wfVars[i] - FiniteDiff;
1794 PGradient[i] = (logpsiPlus - logpsiMinus) * dh;
1795 HGradient[i] = (elocPlus - elocMinus) * dh;
1798 fout << std::endl <<
"Deriv Numeric Analytic" << std::endl;
1799 for (
int i = 0; i < Nvars; i++)
1800 fout << i <<
" " << PGradient[i] <<
" " <<
std::real(Dsaved[i]) <<
" " << (PGradient[i] -
std::real(Dsaved[i]))
1802 fout << std::endl <<
"Hderiv Numeric Analytic" << std::endl;
1803 for (
int i = 0; i < Nvars; i++)
1804 fout << i <<
" " << HGradient[i] <<
" " <<
std::real(HDsaved[i]) <<
" " << (HGradient[i] -
std::real(HDsaved[i]))
1811 app_log() <<
" ===== runDerivNLPPTest =====\n";
1812 std::array<char, 16> fname;
1814 throw std::runtime_error(
"Error generating name");
1816 std::ofstream nlout(fname.data());
1817 nlout.precision(15);
1819 app_log() <<
" Testing derivatives" << std::endl;
1836 <<
" Total " << eloc << std::endl;
1845 nlout <<
"Gradients" << std::endl;
1846 for (
int iat = 0; iat <
W.
R.size(); iat++)
1848 for (
int i = 0; i < 3; i++)
1849 nlout <<
W.
G[iat][i] <<
" ";
1852 nlout <<
"Laplaians" << std::endl;
1853 for (
int iat = 0; iat <
W.
R.size(); iat++)
1855 nlout <<
W.
L[iat] <<
" ";
1864 wfvar_prime = wfVars;
1865 wfVars.
print(nlout);
1866 int Nvars = wfVars.
size();
1869 std::vector<RealType> PGradient(Nvars);
1870 std::vector<RealType> HGradient(Nvars);
1878 std::vector<RealType> ene(4), ene_p(4), ene_m(4);
1886 for (
int i = 0; i < Nvars; i++)
1888 for (
int j = 0; j < Nvars; j++)
1889 wfvar_prime[j] = wfVars[j];
1890 wfvar_prime[i] = wfVars[i] + FiniteDiff;
1901 wfvar_prime[i] = wfVars[i] - FiniteDiff;
1912 PGradient[i] = (logpsiPlus - logpsiMinus) * dh;
1913 HGradient[i] = (elocPlus - elocMinus) * dh;
1916 nlout << std::endl <<
"Deriv Numeric Analytic" << std::endl;
1917 for (
int i = 0; i < Nvars; i++)
1918 nlout << i <<
" " << PGradient[i] <<
" " << Dsaved[i] <<
" " << (PGradient[i] - Dsaved[i]) << std::endl;
1919 nlout << std::endl <<
"Hderiv Numeric Analytic" << std::endl;
1920 for (
int i = 0; i < Nvars; i++)
1921 nlout << i <<
" " << HGradient[i] <<
" " << HDsaved[i] <<
" " << (HGradient[i] - HDsaved[i]) << std::endl;
1927 app_log() <<
" ===== runDerivCloneTest =====\n";
1928 app_log() <<
" Testing derivatives clone" << std::endl;
1929 auto Rng1 = std::make_unique<RandomGenerator>();
1930 auto Rng2 = std::make_unique<RandomGenerator>();
1932 auto w_clone = std::make_unique<MCWalkerConfiguration>(
W);
1934 auto h_clone =
H.
makeClone(*w_clone, *psi_clone);
1935 h_clone->setRandomGenerator(Rng2.get());
1938 Rng.emplace_back(std::move(Rng1));
1939 h_clone->setPrimary(
true);
1948 w_clone->R = awalker.
R;
1957 int Nvars = wfVars.
size();
1961 psi_clone->checkInVariables(wfvar_prime);
1963 for (
int j = 0; j < Nvars; j++)
1964 wfvar_prime[j] = wfVars[j];
1965 psi_clone->checkOutVariables(wfvar_prime);
1967 psi_clone->resetParameters(wfvar_prime);
1971 std::vector<RealType> PGradient(Nvars, 0), og_PGradient(Nvars, 0);
1972 std::vector<RealType> HGradient(Nvars, 0), og_HGradient(Nvars, 0);
1973 ValueType logpsi2 = psi_clone->evaluateLog(*w_clone);
1974 RealType eloc2 = h_clone->evaluate(*w_clone);
1975 psi_clone->evaluateDerivatives(*w_clone, wfvar_prime, Dsaved, HDsaved);
1979 app_log() <<
"log (original) = " << logpsi1 <<
" energy = " << eloc1 << std::endl;
1982 app_log() <<
"log (clone) = " << logpsi2 <<
" energy = " << eloc2 << std::endl;
1983 for (
int i = 0; i < h_clone->sizeOfObservables(); i++)
1984 app_log() <<
" HamTest " << h_clone->getObservableName(i) <<
" " << h_clone->getObservable(i) << std::endl;
1989 for (
int i = 0; i < Nvars; i++)
1991 for (
int j = 0; j < Nvars; j++)
1992 wfvar_prime[j] = wfVars[j];
1993 wfvar_prime[i] = wfVars[i] + FiniteDiff;
1994 psi_clone->resetParameters(wfvar_prime);
1998 RealType logpsiPlus = psi_clone->evaluateLog(*w_clone);
1999 h_clone->evaluate(*w_clone);
2000 RealType elocPlus = h_clone->getLocalEnergy() - h_clone->getLocalPotential();
2001 wfvar_prime[i] = wfVars[i] - FiniteDiff;
2002 psi_clone->resetParameters(wfvar_prime);
2006 RealType logpsiMinus = psi_clone->evaluateLog(*w_clone);
2007 h_clone->evaluate(*w_clone);
2008 RealType elocMinus = h_clone->getLocalEnergy() - h_clone->getLocalPotential();
2009 PGradient[i] = (logpsiPlus - logpsiMinus) * dh;
2010 HGradient[i] = (elocPlus - elocMinus) * dh;
2012 fout <<
"CLONE" << std::endl;
2013 fout << std::endl <<
" Deriv Numeric Analytic" << std::endl;
2014 for (
int i = 0; i < Nvars; i++)
2015 fout << i <<
" " << PGradient[i] <<
" " <<
std::real(Dsaved[i]) <<
" " 2016 << (PGradient[i] -
std::real(Dsaved[i])) / PGradient[i] << std::endl;
2017 fout << std::endl <<
" Hderiv Numeric Analytic" << std::endl;
2018 for (
int i = 0; i < Nvars; i++)
2019 fout << i <<
" " << HGradient[i] <<
" " <<
std::real(HDsaved[i]) <<
" " 2020 << (HGradient[i] -
std::real(HDsaved[i])) / HGradient[i] << std::endl;
2021 for (
int i = 0; i < Nvars; i++)
2023 for (
int j = 0; j < Nvars; j++)
2024 wfvar_prime[j] = wfVars[j];
2025 wfvar_prime[i] = wfVars[i] + FiniteDiff;
2033 wfvar_prime[i] = wfVars[i] - FiniteDiff;
2041 PGradient[i] = (logpsiPlus - logpsiMinus) * dh;
2042 HGradient[i] = (elocPlus - elocMinus) * dh;
2044 fout <<
"ORIGINAL" << std::endl;
2045 fout << std::endl <<
" Deriv Numeric Analytic" << std::endl;
2046 for (
int i = 0; i < Nvars; i++)
2047 fout << i <<
" " << PGradient[i] <<
" " <<
std::real(Dsaved[i]) <<
" " 2048 << (PGradient[i] -
std::real(Dsaved[i])) / PGradient[i] << std::endl;
2049 fout << std::endl <<
" Hderiv Numeric Analytic" << std::endl;
2050 for (
int i = 0; i < Nvars; i++)
2051 fout << i <<
" " << HGradient[i] <<
" " <<
std::real(HDsaved[i]) <<
" " 2052 << (HGradient[i] -
std::real(HDsaved[i])) / HGradient[i] << std::endl;
2057 app_log() <<
" ===== runNodePlot =====\n";
2058 xmlNodePtr kids =
myNode->children;
2059 std::string doEnergy(
"no");
2061 aAttrib.
add(doEnergy,
"energy");
2063 std::vector<int>
Grid;
2064 while (kids != NULL)
2066 std::string cname((
const char*)(kids->name));
2067 if (cname ==
"grid")
2080 assert(
Grid.size() == 2);
2087 for (
int iat(0); iat < nat; iat++)
2090 std::stringstream fn;
2091 fn <<
RootName.c_str() <<
".ratios." << iat <<
".py";
2092 std::ofstream plot_out(fn.str().c_str());
2093 plot_out.precision(6);
2100 plot_out <<
"import matplotlib\n";
2101 plot_out <<
"import numpy as np\n";
2102 plot_out <<
"import matplotlib.cm as cm\n";
2103 plot_out <<
"import matplotlib.mlab as mlab\n";
2104 plot_out <<
"import matplotlib.pyplot as plt\n";
2105 plot_out << std::endl;
2106 plot_out <<
"matplotlib.rcParams['xtick.direction'] = 'out'\n";
2107 plot_out <<
"matplotlib.rcParams['ytick.direction'] = 'out'\n";
2108 plot_out << std::endl;
2109 plot_out <<
"x = np.arange(0, " << xmax <<
", " << xmax * overG0 <<
")\n";
2110 plot_out <<
"y = np.arange(0, " << ymax <<
", " << ymax * overG1 <<
")\n";
2111 plot_out <<
"X, Y = np.meshgrid(x, y)\n";
2112 plot_out <<
"Z = [";
2113 for (
int i = 0; i <
Grid[0]; i++)
2116 for (
int j = 0; j <
Grid[1]; j++)
2118 R_unit[0][0] = overG0 *
RealType(i);
2119 R_unit[0][1] = overG1 *
RealType(j);
2126 plot_out << aratio <<
", ";
2131 plot_out <<
"up_y=[";
2132 for (
int ix(0); ix < nup; ix++)
2139 plot_out << yy <<
", ";
2142 plot_out <<
"up_x=[";
2143 for (
int ix(0); ix < nup; ix++)
2150 plot_out << yy <<
", ";
2153 plot_out <<
"dn_y=[";
2154 for (
int ix(nup); ix < nat; ix++)
2161 plot_out << yy <<
", ";
2164 plot_out <<
"dn_x=[";
2165 for (
int ix(nup); ix < nat; ix++)
2172 plot_out << yy <<
", ";
2175 plot_out <<
"matplotlib.rcParams['contour.negative_linestyle'] = 'solid'\n";
2176 plot_out <<
"plt.figure()\n";
2177 plot_out <<
"CS = plt.contourf(X, Y, Z, 5, cmap=cm.gray)\n";
2178 plot_out <<
"CS2 = plt.contour(X, Y, Z, colors='k',levels=[0])\n";
2179 plot_out <<
"PTu = plt.scatter(up_x,up_y, c='r', marker='o')\n";
2180 plot_out <<
"PTd = plt.scatter(dn_x,dn_y, c='b', marker='d')\n";
2181 plot_out <<
"plt.clabel(CS2, fontsize=9, inline=1)\n";
2182 plot_out <<
"plt.title('2D Nodal Structure')\n";
2183 plot_out <<
"plt.xlim(0," << ymax * (1.0 - overG1) <<
")\n";
2184 plot_out <<
"plt.ylim(0," << xmax * (1.0 - overG0) <<
")\n";
2186 fn <<
RootName.c_str() <<
".ratios." << iat <<
".png";
2187 plot_out <<
"plt.savefig('" << fn.str().c_str() <<
"', bbox_inches='tight', pad_inches=0.01 )\n";
2189 #elif OHMMS_DIM == 3 2226 bool s = param.
put(q);
base class for Single-particle orbital sets
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
void runRatioTest()
the basic ratios check
~WaveFunctionTester() override
T Sum(const ParticleAttrib< T > &pa)
WaveFunctionTester(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, ParticleSetPool &ptclPool, Communicate *comm)
Constructor.
FullPrecRealType getLocalPotential()
PropertyContainer_t Properties
scalar properties of a walker
std::string getObservableName(int i) const
return the name of the i-th observable
void rejectMove(int iat)
restore to the original state
ValueType calcRatio(ParticleSet &P, int iat, ComputeType ct=ComputeType::ALL)
compute psi(R_new) / psi(R_current) ratio It returns a complex value if the wavefunction is complex...
WFBuffer_t DataSet
buffer for the data for particle-by-particle update
A set of walkers that are to be advanced by Metropolis Monte Carlo.
void copyFromBuffer(ParticleSet &P, WFBufferType &buf)
copy all the wavefunction components from buffer.
helper functions for EinsplineSetBuilder
int rank() const
return the rank
Tensor< T, D >::Type_t det(const Tensor< T, D > &a)
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate derivatives of KE wrt optimizable varibles
QTBase::RealType RealType
RealType getPhaseDiff() const
void runZeroVarianceTest()
void finiteDifferencePoints(RealType delta, MCWalkerConfiguration &W, PosChangeVector &positions)
Generate points to evaluate.
std::string RootName
root of all the output files
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
Parent class for all grids.
size_t getTotalNum() const
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false)
update the state with the new data
xmlNodePtr qmcNode
pointer to qmc node in xml file
int gradientComponentIndex
void saveProperty(IT first)
save the values of Hamiltonian elements to the Properties
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
FullPrecRealType evaluateValueAndDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate energy and derivatives wrt to the variables
Abstract class to manage operations on pair data between two ParticleSets.
void resetParameters(const opt_variables_type &active)
Set values of parameters in each component from the global list.
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
void makeMoves(const ParticleSet &refp, int jel, const std::vector< PosType > &deltaV, bool sphere=false, int iat=-1)
move virtual particles to new postions and update distance tables
ParticleSetPool & PtclPool
RealType getObservable(int i) const
return the value of the i-th observable
Collection of Local Energy Operators.
float real(const float &c)
real part of a scalar. Cannot be replaced by std::real due to AFQMC specific needs.
void runRatioV()
test ratios with virtual moves
void allocate()
allocate the data
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
const std::vector< std::unique_ptr< Determinant_t > > Dets
container for the DiracDeterminants
abstract base class for QMC engines
void resetIndex()
reset Index
void update(bool skipSK=false)
update the internal data
Attaches a unit to a Vector for IO.
bool run() override
Test the evaluation of the wavefunction, gradient and laplacian by comparing to the numerical evaluat...
Communicate * Controller
Global Communicator for a process.
ParticleLaplacian L
laplacians of the particles
RealType updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false)
update all the wavefunction components in buffer.
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
std::unique_ptr< TrialWaveFunction > makeClone(ParticleSet &tqp) const
bool put(std::istream &is) override
read from std::istream
ParameterSet m_param
store any parameter that has to be read from a file
FiniteDiffErrData DeltaVsError
for(int i=0;i< size_test;++i) CHECK(Approx(gauss_random_vals[offset_for_rs+i])
Wrapping information on parallelism.
WaveFunctionComponent::LogValue LogValue
type definition
Specialized paritlce class for atomistic simulations.
std::vector< ValueType > ValueVector
WalkerList_t::iterator iterator
FIX: a type alias of iterator for an object should not be for just one of many objects it holds...
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
class to handle a set of parameters
double norm(const zVec &c)
WalkerProperties::Indexes WP
QTBase::ValueType ValueType
void makeGaussRandom(std::vector< TinyVector< T, D >> &a)
void assignUniformRand(T *restrict a, unsigned n, RG &rng)
void rejectMove(Index_t iat)
reject a proposed move in regular mode
std::vector< PositionChange > PosChangeVector
bool putQMCInfo(xmlNodePtr cur)
Parses the xml input file for parameter definitions for a single qmc simulation.
Manage a collection of ParticleSet objects.
ParticleGradient G
gradients of the particles
void convert2Cart(const ParticlePos &pin, ParticlePos &pout)
OrbitalSetTraits< ValueType >::ValueVector ValueVector
void saveWalker(Walker_t &awalker)
save this to awalker
class to handle a set of variables that can be modified during optimizations
GradType evalGradSource(ParticleSet &P, ParticleSet &source, int iat)
Returns the logarithmic gradient of the trial wave function with respect to the iat^th atom of the so...
void registerData(ParticleSet &P, WFBufferType &buf)
register all the wavefunction components in buffer.
std::vector< std::unique_ptr< WaveFunctionComponent > > const & getOrbitals()
QMCHamiltonian & H
Hamiltonian.
int sizeOfObservables() const
return the size of observables
QTFull::RealType Scalar_t
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
FullPrecRealType getLocalEnergy()
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
void runBasicTest()
basic tests for G and L
FiniteDifference(size_t ndim_in, FiniteDiffType fd_type=FiniteDiff_Richardson)
ParticleSet::ParticlePos deltaR
void checkOutVariables(const opt_variables_type &o)
Check out optimizable variables Assign index mappings from global list (o) to local values in each co...
bool put(xmlNodePtr q) override
MCWalkerConfiguration & W
walker ensemble
void loadWalker(Walker_t &awalker, bool pbyp)
load a Walker_t to the current ParticleSet
void clear()
clear the variable set
size_type size() const
return the size
bool putContent(T &a, xmlNodePtr cur)
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}.
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
void auxHevaluate(ParticleSet &P)
RealType getPhase() const
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
size_type current() const
Define determinant operators.
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
std::string checkSlaterDetOption
size_type size() const
return the size of the data
Class to represent a many-body trial wave function.
void makeMove(Index_t iat, const SingleParticlePos &displ, bool maybe_accept=true)
move the iat-th particle to active_pos_
GradType evalGrad(ParticleSet &P, int iat)
Indexes
an enum denoting index of physical properties
FullPrecRealType evaluate(ParticleSet &P)
evaluate Local Energy
ParticleAttrib< SingleParticlePos > ParticlePos
TrialWaveFunction & Psi
trial function
std::vector< std::unique_ptr< DistanceTable > > DistTables
distance tables that need to be updated by moving this ParticleSet
const PoolType & getPool() const
get the Pool object
FullPrecRealType evaluateVariableEnergy(ParticleSet &P, bool free_nlpp)
evaluate energy
UPtrVector< RandomBase< FullPrecRealType > > Rng
Random number generators.
void computeFiniteDiff(RealType delta, PosChangeVector &positions, ValueVector &values, ParticleSet::ParticleGradient &G_fd, ParticleSet::ParticleLaplacian &L_fd)
Compute finite difference after log psi is computed for each point.
iterator end()
return the last iterator, [begin(), end())
void clear()
clear the data and set Current=0
void setRandomGenerator(RandomBase< FullPrecRealType > *rng)
void setPrimary(bool primary)
set PRIMARY bit of all the components
void acceptMove(Index_t iat)
accept the move and update the particle attribute by the proposed move in regular mode ...
void computeNumericalGrad(RealType delta, ParticleSet::ParticleGradient &G_fd, ParticleSet::ParticleLaplacian &L_fd)
std::unique_ptr< QMCHamiltonian > makeClone(ParticleSet &qp, TrialWaveFunction &psi) const
return a clone
void print(std::ostream &os, int leftPadSpaces=0, bool printHeader=false) const
void computeFiniteDiffLowOrder(RealType delta, PosChangeVector &positions, ValueVector &values, ParticleSet::ParticleGradient &G_fd, ParticleSet::ParticleLaplacian &L_fd)
void runCloneTest()
test clone implementations of new wavefunctions and operators
Declaration of a MCWalkerConfiguration.
A container class to represent a walker.
ValueType calcRatioGrad(ParticleSet &P, int iat, GradType &grad_iat)
compute psi(R_new) / psi(R_current) ratio and ln(psi(R_new)) gradients It returns a complex value if...
bool checkGradientAtConfiguration(MCWalkerConfiguration::Walker_t *W1, std::stringstream &fail_log, bool &ignore)
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios, ComputeType ct=ComputeType::ALL)
compulte multiple ratios to handle non-local moves and other virtual moves
void resetProperty(FullPrecRealType logpsi, FullPrecRealType sigN, FullPrecRealType ene)
reset the property of a walker
void checkInVariables(opt_variables_type &o)
Check in an optimizable parameter.
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
void computeFiniteDiffRichardson(RealType delta, PosChangeVector &positions, ValueVector &values, ParticleSet::ParticleGradient &G_fd, ParticleSet::ParticleLaplacian &L_fd)
void randomize(ParticleAttrib< TinyVector< T, D >> &displ, T fac)
bool checkGradients(int lower_iat, int upper_iat, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, ParticleSet::ParticleGradient &G_fd, ParticleSet::ParticleLaplacian &L_fd, std::stringstream &log, int indent=0)
iterator begin()
return the first iterator