23 return_group_index = i;
25 assert(return_group_index != -1);
27 return return_group_index;
51 tmpgmat.resize(nptcls, norbs);
52 tmplmat.resize(nptcls, norbs);
53 spos_[i]->evaluate_notranspose(P, first, last, mvec[i], tmpgmat, tmplmat);
108 grad_iat +=
jastrow_list_[i]->evalGradSource(P, source, iat);
120 for (
int dim = 0; dim <
OHMMS_DIM; dim++)
121 for (
int i = 0; i < grad_grad[0].
size(); i++)
124 lapl_grad[dim][i] = 0.0;
127 grad_iat +=
jastrow_list_[i]->evalGradSource(P, source, iat, grad_grad, lapl_grad);
132 std::vector<ValueMatrix>& mvec,
133 std::vector<GradMatrix>& gmat,
134 std::vector<ValueMatrix>& lmat)
const 144 spos_[i]->evaluate_notranspose(P, first, last, mvec[i], gmat[i], lmat[i]);
151 std::vector<std::vector<ValueMatrix>>& dmvec)
const 164 grad_phi.resize(nptcls, norbs);
166 spos_[i]->evaluateGradSource(P, first, last, source, iat, grad_phi);
169 for (
IndexType iptcl = 0; iptcl < nptcls; iptcl++)
170 for (
IndexType iorb = 0; iorb < norbs; iorb++)
172 dmvec[idim][i][iptcl][iorb] += grad_phi[iptcl][iorb][idim];
180 std::vector<std::vector<ValueMatrix>>& dmvec,
181 std::vector<std::vector<GradMatrix>>& dgmat,
182 std::vector<std::vector<ValueMatrix>>& dlmat)
const 197 grad_phi.resize(nptcls, norbs);
198 grad_grad_phi.resize(nptcls, norbs);
199 grad_lapl_phi.resize(nptcls, norbs);
201 spos_[i]->evaluateGradSource(P, first, last, source, iat, grad_phi, grad_grad_phi, grad_lapl_phi);
204 for (
IndexType iptcl = 0; iptcl < nptcls; iptcl++)
205 for (
IndexType iorb = 0; iorb < norbs; iorb++)
207 dmvec[idim][i][iptcl][iorb] += grad_phi[iptcl][iorb][idim];
208 dlmat[idim][i][iptcl][iorb] += grad_lapl_phi[iptcl][iorb][idim];
210 dgmat[idim][i][iptcl][iorb][ielec] += grad_grad_phi[iptcl][iorb](idim, ielec);
216 const std::vector<ValueMatrix>& X,
217 const std::vector<ValueMatrix>& dM,
218 const std::vector<ValueMatrix>& dB)
const 222 for (
int id = 0;
id < nspecies;
id++)
224 int ptclnum = Minv[id].rows();
226 for (
int i = 0; i < ptclnum; i++)
227 for (
int j = 0; j < ptclnum; j++)
230 dval_id += Minv[id][i][j] * dB[id][j][i] - X[id][i][j] * dM[id][j][i];
240 for (
IndexType id = 0;
id < nspecies;
id++)
242 assert(M[
id].cols() == M[
id].rows());
249 const std::vector<ValueMatrix>&
B,
250 std::vector<ValueMatrix>& X)
254 for (
IndexType id = 0;
id < nspecies;
id++)
256 int ptclnum = Minv[id].rows();
257 assert(Minv[
id].rows() == Minv[
id].cols());
259 X[id].resize(ptclnum, ptclnum);
260 tmpmat.resize(ptclnum, ptclnum);
262 for (
int i = 0; i < ptclnum; i++)
263 for (
int j = 0; j < ptclnum; j++)
264 for (
int k = 0; k < ptclnum; k++)
266 tmpmat[i][j] +=
B[id][i][k] * Minv[id][k][j];
269 for (
int i = 0; i < ptclnum; i++)
270 for (
int j = 0; j < ptclnum; j++)
271 for (
int k = 0; k < ptclnum; k++)
273 X[id][i][j] += Minv[id][i][k] * tmpmat[k][j];
287 const std::vector<ValueMatrix>&
B)
290 assert(
A.size() ==
B.size());
293 for (
IndexType id = 0;
id < nspecies;
id++)
295 int ptclnum =
A[id].rows();
297 assert(
A[
id].cols() ==
B[
id].rows() &&
A[
id].rows() ==
B[
id].cols());
298 for (
int i = 0; i <
A[id].rows(); i++)
299 for (
int j = 0; j <
A[id].cols(); j++)
301 val_id +=
A[id][i][j] *
B[id][j][i];
312 Aslice.resize(nspecies);
313 for (
IndexType id = 0;
id < nspecies;
id++)
316 Aslice[id].resize(ptclnum, ptclnum);
319 Aslice[
id][i][j] =
A[
id][i][j];
339 spos_[sid]->evaluateVGL(P, iel, val, tempg, templ);
base class for Single-particle orbital sets
MatrixA::value_type invert_matrix(MatrixA &M, bool getdet=true)
invert a matrix
std::vector< SPOSet * > spos_
std::vector< WaveFunctionComponent * > jastrow_list_
helper functions for EinsplineSetBuilder
QMCTraits::RealType RealType
ValueType trAB(const std::vector< ValueMatrix > &A, const std::vector< ValueMatrix > &B)
Returns Tr(A*B).
RealType evaluateJastrowRatio(ParticleSet &P, const int iel) const
Given a proposed move of electron iel from r->r', computes exp(J')/exp(J)
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
GradType evaluateJastrowGradSource(ParticleSet &P, ParticleSet &source, const int iat) const
Return ionic gradient of J(r).
int first(int igroup) const
return the first index of a group i
void getEGradELaplM(const ParticleSet &P, std::vector< ValueMatrix > &mvec, std::vector< GradMatrix > &gmat, std::vector< ValueMatrix > &lmat) const
Returns value, gradient, and laplacian matrices for all orbitals and all particles, species by species.
Attaches a unit to a Vector for IO.
void getIonGradM(const ParticleSet &P, const ParticleSet &source, const int iat, std::vector< std::vector< ValueMatrix >> &dmvec) const
Returns x,y,z components of ion gradient of slater matrices.
ValueType computeGSDerivative(const std::vector< ValueMatrix > &Minv, const std::vector< ValueMatrix > &X, const std::vector< ValueMatrix > &dM, const std::vector< ValueMatrix > &dB) const
Calculates derivative of observable via Tr[M^{-1} dB - X * dM ].
void getGSMatrices(const std::vector< ValueMatrix > &A, std::vector< ValueMatrix > &Aslice) const
Takes sub matrices of full SPOSet quantities (evaluated on all particles and all orbitals), consistent with ground state occupations.
std::complex< QTFull::RealType > LogValue
Specialized paritlce class for atomistic simulations.
SPOSet::GradMatrix GradMatrix
RealType calcJastrowRatioGrad(ParticleSet &P, const int iel, GradType &grad) const
Given a proposed move of electron iel from r->r', computes exp(J(r'))/exp(J(r)) and grad_iel(J(r'))...
void getM(const ParticleSet &P, std::vector< ValueMatrix > &mmat) const
Returns the non-rectangular slater matrices M_ij=phi_j(r_i) (N_particle x N_orbs) for each species gr...
int last(int igroup) const
return the last index of a group i
QTFull::ValueType PsiValue
QMCTraits::ValueType ValueType
QMCTraits::IndexType IndexType
std::vector< IndexType > groups_
Define determinant operators.
SPOSet::ValueVector ValueVector
IndexType getRowM(const ParticleSet &P, const IndexType iel, ValueVector &val) const
Returns value of all orbitals (relevant to given species/group) at a particular particle coordinate...
SPOSet::ValueMatrix ValueMatrix
SPOSet::HessMatrix HessMatrix
void getIonGradIonGradELaplM(const ParticleSet &P, const ParticleSet &source, int iat, std::vector< std::vector< ValueMatrix >> &dmvec, std::vector< std::vector< GradMatrix >> &dgmat, std::vector< std::vector< ValueMatrix >> &dlmat) const
Returns x,y,z components of ion gradient of slater matrices and their laplacians. ...
void wipeMatrices(std::vector< ValueMatrix > &A)
Goes through a list of matrices and zeros them out.
IndexType getTWFGroupIndex(const IndexType gid) const
Takes particle set groupID and returns the TWF internal index for it.
QMCTraits::GradType GradType
double B(double x, int k, int i, const std::vector< double > &t)
RealType evaluateJastrowVGL(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) const
Evaluates value, gradient, and laplacian of the total jastrow.
void buildX(const std::vector< ValueMatrix > &Minv, const std::vector< ValueMatrix > &B, std::vector< ValueMatrix > &X)
Build the auxiliary X=M^-1 B M^-1 matrix.
SPOSet::GradVector GradVector
void invertMatrices(const std::vector< ValueMatrix > &M, std::vector< ValueMatrix > &Minv)
Helper function that inverts all slater matrices in our species list.
void addGroup(const ParticleSet &P, const IndexType groupid, SPOSet *spo)
Add a particle group.
int getGroupID(int iat) const
return the group id of a given particle in the particle set.