QMCPACK
SoaLocalizedBasisSet.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by:
8 //
9 // File created by: Jeongnim Kim, jeongnim.kim@intel.com, Intel Corp.
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include <memory>
14 #include "SoaLocalizedBasisSet.h"
15 #include "Particle/DistanceTable.h"
16 #include "SoaAtomicBasisSet.h"
17 #include "MultiQuinticSpline1D.h"
18 #include "MultiFunctorAdapter.h"
21 
22 namespace qmcplusplus
23 {
24 template<class COT, typename ORBT>
26 {
27  SoaLocalizedBSetMultiWalkerMem() : Resource("SoaLocalizedBasisSet") {}
28 
30 
31  std::unique_ptr<Resource> makeClone() const override
32  {
33  return std::make_unique<SoaLocalizedBSetMultiWalkerMem>(*this);
34  }
35 
38 };
39 
40 template<class COT, typename ORBT>
42 {
43  collection.addResource(std::make_unique<SoaLocalizedBSetMultiWalkerMem>());
44  for (int i = 0; i < LOBasisSet.size(); i++)
45  LOBasisSet[i]->createResource(collection);
46 }
47 template<class COT, typename ORBT>
49  ResourceCollection& collection,
50  const RefVectorWithLeader<SoaBasisSetBase<ORBT>>& basisset_list) const
51 {
52  auto& loc_basis_leader = basisset_list.template getCastedLeader<SoaLocalizedBasisSet<COT, ORBT>>();
53  assert(this == &loc_basis_leader);
54  loc_basis_leader.mw_mem_handle_ = collection.lendResource<SoaLocalizedBSetMultiWalkerMem>();
55  // need to cast to SoaLocalizedBasisSet to access LOBasisSet (atomic basis)
56  auto& basisset_leader = loc_basis_leader.LOBasisSet;
57  for (int i = 0; i < basisset_leader.size(); i++)
58  {
59  const auto one_species_basis_list(extractOneSpeciesBasisRefList(basisset_list, i));
60  basisset_leader[i]->acquireResource(collection, one_species_basis_list);
61  }
62 }
63 template<class COT, typename ORBT>
65  ResourceCollection& collection,
66  const RefVectorWithLeader<SoaBasisSetBase<ORBT>>& basisset_list) const
67 {
68  auto& loc_basis_leader = basisset_list.template getCastedLeader<SoaLocalizedBasisSet<COT, ORBT>>();
69  assert(this == &loc_basis_leader);
70  collection.takebackResource(loc_basis_leader.mw_mem_handle_);
71  // need to cast to SoaLocalizedBasisSet to access LOBasisSet (atomic basis)
72  auto& basisset_leader = loc_basis_leader.LOBasisSet;
73  for (int i = 0; i < basisset_leader.size(); i++)
74  {
75  const auto one_species_basis_list(extractOneSpeciesBasisRefList(basisset_list, i));
76  basisset_leader[i]->releaseResource(collection, one_species_basis_list);
77  }
78 }
79 template<class COT, typename ORBT>
81  const RefVectorWithLeader<SoaBasisSetBase<ORBT>>& basisset_list,
82  int id)
83 {
84  auto& loc_basis_leader = basisset_list.template getCastedLeader<SoaLocalizedBasisSet<COT, ORBT>>();
85  RefVectorWithLeader<COT> one_species_basis_list(*loc_basis_leader.LOBasisSet[id]);
86  one_species_basis_list.reserve(basisset_list.size());
87  for (size_t iw = 0; iw < basisset_list.size(); iw++)
88  one_species_basis_list.push_back(
89  *basisset_list.template getCastedElement<SoaLocalizedBasisSet<COT, ORBT>>(iw).LOBasisSet[id]);
90  return one_species_basis_list;
91 }
92 
93 
94 template<class COT, typename ORBT>
96  : ions_(ions),
97  myTableIndex(els.addTable(ions, DTModes::NEED_FULL_TABLE_ANYTIME | DTModes::NEED_VP_FULL_TABLE_ON_HOST)),
98  SuperTwist(0.0)
99 {
100  NumCenters = ions.getTotalNum();
101  NumTargets = els.getTotalNum();
102  LOBasisSet.resize(ions.getSpeciesSet().getTotalNum());
103  BasisOffset.resize(NumCenters + 1);
104  BasisSetSize = 0;
105 }
106 
107 template<class COT, typename ORBT>
109  : SoaBasisSetBase<ORBT>(a),
110  NumCenters(a.NumCenters),
111  NumTargets(a.NumTargets),
112  ions_(a.ions_),
113  myTableIndex(a.myTableIndex),
114  SuperTwist(a.SuperTwist),
115  BasisOffset(a.BasisOffset)
116 {
117  LOBasisSet.reserve(a.LOBasisSet.size());
118  for (auto& elem : a.LOBasisSet)
119  LOBasisSet.push_back(std::make_unique<COT>(*elem));
120 }
121 
122 template<class COT, typename ORBT>
124  const TinyVector<int, 3>& PBCImages,
125  const TinyVector<double, 3> Sup_Twist,
126  const Vector<ValueType, OffloadPinnedAllocator<ValueType>>& phase_factor,
127  const Array<RealType, 2, OffloadPinnedAllocator<RealType>>& pbc_displacements)
128 {
129  for (int i = 0; i < LOBasisSet.size(); ++i)
130  LOBasisSet[i]->setPBCParams(PBCImages, Sup_Twist, phase_factor, pbc_displacements);
131 
132  SuperTwist = Sup_Twist;
133 }
134 
135 template<class COT, typename ORBT>
137 {
138  const auto& IonID(ions_.GroupID);
139  if (BasisSetSize > 0 && nbs == BasisSetSize)
140  return;
141 
142  if (auto& mapping = ions_.get_map_storage_to_input(); mapping.empty())
143  {
144  //evaluate the total basis dimension and offset for each center
145  BasisOffset[0] = 0;
146  for (int c = 0; c < NumCenters; c++)
147  BasisOffset[c + 1] = BasisOffset[c] + LOBasisSet[IonID[c]]->getBasisSetSize();
148  BasisSetSize = BasisOffset[NumCenters];
149  }
150  else
151  {
152  // when particles are reordered due to grouping, AOs need to restore the input order to match MOs.
153  std::vector<int> map_input_to_storage(mapping.size());
154  for (int c = 0; c < NumCenters; c++)
155  map_input_to_storage[mapping[c]] = c;
156 
157  std::vector<size_t> basis_offset_input_order(BasisOffset.size(), 0);
158  for (int c = 0; c < NumCenters; c++)
159  basis_offset_input_order[c + 1] =
160  basis_offset_input_order[c] + LOBasisSet[IonID[map_input_to_storage[c]]]->getBasisSetSize();
161 
162  for (int c = 0; c < NumCenters; c++)
163  BasisOffset[c] = basis_offset_input_order[mapping[c]];
164 
165  BasisSetSize = basis_offset_input_order[NumCenters];
166  }
167 }
168 
169 template<class COT, typename ORBT>
170 void SoaLocalizedBasisSet<COT, ORBT>::queryOrbitalsForSType(const std::vector<bool>& corrCenter,
171  std::vector<bool>& is_s_orbital) const
172 {
173  const auto& IonID(ions_.GroupID);
174  for (int c = 0; c < NumCenters; c++)
175  {
176  int idx = BasisOffset[c];
177  int bss = LOBasisSet[IonID[c]]->getBasisSetSize();
178  std::vector<bool> local_is_s_orbital(bss);
179  LOBasisSet[IonID[c]]->queryOrbitalsForSType(local_is_s_orbital);
180  for (int k = 0; k < bss; k++)
181  {
182  if (corrCenter[c])
183  {
184  is_s_orbital[idx++] = local_is_s_orbital[k];
185  }
186  else
187  {
188  is_s_orbital[idx++] = false;
189  }
190  }
191  }
192 }
193 
194 template<class COT, typename ORBT>
196 {
197  const auto& IonID(ions_.GroupID);
198  const auto& coordR = P.activeR(iat);
199  const auto& d_table = P.getDistTableAB(myTableIndex);
200  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
201  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
202 
203  PosType Tv;
204  for (int c = 0; c < NumCenters; c++)
205  {
206  Tv[0] = (ions_.R[c][0] - coordR[0]) - displ[c][0];
207  Tv[1] = (ions_.R[c][1] - coordR[1]) - displ[c][1];
208  Tv[2] = (ions_.R[c][2] - coordR[2]) - displ[c][2];
209  LOBasisSet[IonID[c]]->evaluateVGL(P.getLattice(), dist[c], displ[c], BasisOffset[c], vgl, Tv);
210  }
211 }
212 
213 template<class COT, typename ORBT>
215  const RefVectorWithLeader<ParticleSet>& P_list,
216  int iat,
217  OffloadMWVGLArray& vgl_v)
218 {
219  assert(this == &basis_list.getLeader());
220  auto& basis_leader = basis_list.template getCastedLeader<SoaLocalizedBasisSet<COT, ORBT>>();
221  const auto& IonID(ions_.GroupID);
222  auto& pset_leader = P_list.getLeader();
223 
224  size_t Nw = P_list.size();
225  assert(vgl_v.size(0) == 5);
226  assert(vgl_v.size(1) == Nw);
227  assert(vgl_v.size(2) == BasisSetSize);
228 
229  auto& Tv_list = basis_leader.mw_mem_handle_.getResource().Tv_list;
230  auto& displ_list_tr = basis_leader.mw_mem_handle_.getResource().displ_list_tr;
231  Tv_list.resize(3 * NumCenters * Nw);
232  displ_list_tr.resize(3 * NumCenters * Nw);
233 
234  for (size_t iw = 0; iw < P_list.size(); iw++)
235  {
236  const auto& coordR = P_list[iw].activeR(iat);
237  const auto& d_table = P_list[iw].getDistTableAB(myTableIndex);
238  const auto& displ = (P_list[iw].getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
239  for (int c = 0; c < NumCenters; c++)
240  for (size_t idim = 0; idim < 3; idim++)
241  {
242  Tv_list[idim + 3 * (iw + c * Nw)] = (ions_.R[c][idim] - coordR[idim]) - displ[c][idim];
243  displ_list_tr[idim + 3 * (iw + c * Nw)] = displ[c][idim];
244  }
245  }
246 #if defined(QMC_COMPLEX)
247  Tv_list.updateTo();
248 #endif
249  displ_list_tr.updateTo();
250 
251  for (int c = 0; c < NumCenters; c++)
252  {
253  auto one_species_basis_list = extractOneSpeciesBasisRefList(basis_list, IonID[c]);
254  LOBasisSet[IonID[c]]->mw_evaluateVGL(one_species_basis_list, pset_leader.getLattice(), vgl_v, displ_list_tr,
255  Tv_list, Nw, BasisSetSize, c, BasisOffset[c], NumCenters);
256  }
257 }
258 
259 
260 template<class COT, typename ORBT>
262 {
263  const auto& IonID(ions_.GroupID);
264  const auto& coordR = P.activeR(iat);
265  const auto& d_table = P.getDistTableAB(myTableIndex);
266  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
267  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
268  PosType Tv;
269  for (int c = 0; c < NumCenters; c++)
270  {
271  Tv[0] = (ions_.R[c][0] - coordR[0]) - displ[c][0];
272  Tv[1] = (ions_.R[c][1] - coordR[1]) - displ[c][1];
273  Tv[2] = (ions_.R[c][2] - coordR[2]) - displ[c][2];
274  LOBasisSet[IonID[c]]->evaluateVGH(P.getLattice(), dist[c], displ[c], BasisOffset[c], vgh, Tv);
275  }
276 }
277 
278 template<class COT, typename ORBT>
280 {
281  // APP_ABORT("SoaLocalizedBasisSet::evaluateVGH() not implemented\n");
282 
283  const auto& IonID(ions_.GroupID);
284  const auto& coordR = P.activeR(iat);
285  const auto& d_table = P.getDistTableAB(myTableIndex);
286  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
287  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
288  PosType Tv;
289  for (int c = 0; c < NumCenters; c++)
290  {
291  Tv[0] = (ions_.R[c][0] - coordR[0]) - displ[c][0];
292  Tv[1] = (ions_.R[c][1] - coordR[1]) - displ[c][1];
293  Tv[2] = (ions_.R[c][2] - coordR[2]) - displ[c][2];
294  LOBasisSet[IonID[c]]->evaluateVGHGH(P.getLattice(), dist[c], displ[c], BasisOffset[c], vghgh, Tv);
295  }
296 }
297 
298 
299 template<class COT, typename ORBT>
302  OffloadMWVArray& vp_basis_v)
303 {
304  assert(this == &basis_list.getLeader());
305  auto& basis_leader = basis_list.template getCastedLeader<SoaLocalizedBasisSet<COT, ORBT>>();
306 
307  const size_t nVPs = vp_basis_v.size(0);
308  assert(vp_basis_v.size(1) == BasisSetSize);
309  const auto& IonID(ions_.GroupID);
310 
311  auto& vps_leader = vp_list.getLeader();
312 
313 
314  const auto dt_list(vps_leader.extractDTRefList(vp_list, myTableIndex));
315  const auto coordR_list(vps_leader.extractVPCoords(vp_list));
316 
317  auto& Tv_list = basis_leader.mw_mem_handle_.getResource().Tv_list;
318  auto& displ_list_tr = basis_leader.mw_mem_handle_.getResource().displ_list_tr;
319  Tv_list.resize(3 * NumCenters * nVPs);
320  displ_list_tr.resize(3 * NumCenters * nVPs);
321 
322  // TODO: need one more level of indirection for offload?
323  // need to index into walkers/vps, but need walker num for distance table
324  size_t index = 0;
325  for (size_t iw = 0; iw < vp_list.size(); iw++)
326  for (int iat = 0; iat < vp_list[iw].getTotalNum(); iat++)
327  {
328  const auto& displ = dt_list[iw].getDisplRow(iat);
329  for (int c = 0; c < NumCenters; c++)
330  for (size_t idim = 0; idim < 3; idim++)
331  {
332  Tv_list[idim + 3 * (index + c * nVPs)] = (ions_.R[c][idim] - coordR_list[index][idim]) - displ[c][idim];
333  displ_list_tr[idim + 3 * (index + c * nVPs)] = displ[c][idim];
334  }
335  index++;
336  }
337 #if defined(QMC_COMPLEX)
338  Tv_list.updateTo();
339 #endif
340  displ_list_tr.updateTo();
341 
342  // TODO: group/sort centers by species?
343  for (int c = 0; c < NumCenters; c++)
344  {
345  auto one_species_basis_list = extractOneSpeciesBasisRefList(basis_list, IonID[c]);
346  LOBasisSet[IonID[c]]->mw_evaluateV(one_species_basis_list, vps_leader.getLattice(), vp_basis_v, displ_list_tr,
347  Tv_list, nVPs, BasisSetSize, c, BasisOffset[c], NumCenters);
348  }
349  // vp_basis_v.updateFrom();
350 }
351 template<class COT, typename ORBT>
352 void SoaLocalizedBasisSet<COT, ORBT>::evaluateV(const ParticleSet& P, int iat, ORBT* restrict vals)
353 {
354  const auto& IonID(ions_.GroupID);
355  const auto& coordR = P.activeR(iat);
356  const auto& d_table = P.getDistTableAB(myTableIndex);
357  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
358  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
359 
360  PosType Tv;
361  for (int c = 0; c < NumCenters; c++)
362  {
363  Tv[0] = (ions_.R[c][0] - coordR[0]) - displ[c][0];
364  Tv[1] = (ions_.R[c][1] - coordR[1]) - displ[c][1];
365  Tv[2] = (ions_.R[c][2] - coordR[2]) - displ[c][2];
366  LOBasisSet[IonID[c]]->evaluateV(P.getLattice(), dist[c], displ[c], vals + BasisOffset[c], Tv);
367  }
368 }
369 
370 template<class COT, typename ORBT>
372  const RefVectorWithLeader<ParticleSet>& P_list,
373  int iat,
374  OffloadMWVArray& vals)
375 {
376  assert(this == &basis_list.getLeader());
377  auto& basis_leader = basis_list.template getCastedLeader<SoaLocalizedBasisSet<COT, ORBT>>();
378  const auto& IonID(ions_.GroupID);
379  auto& pset_leader = P_list.getLeader();
380 
381  size_t Nw = P_list.size();
382  assert(vals.size(0) == Nw);
383  assert(vals.size(1) == BasisSetSize);
384 
385  auto& Tv_list = basis_leader.mw_mem_handle_.getResource().Tv_list;
386  auto& displ_list_tr = basis_leader.mw_mem_handle_.getResource().displ_list_tr;
387  Tv_list.resize(3 * NumCenters * Nw);
388  displ_list_tr.resize(3 * NumCenters * Nw);
389 
390  for (size_t iw = 0; iw < P_list.size(); iw++)
391  {
392  const auto& coordR = P_list[iw].activeR(iat);
393  const auto& d_table = P_list[iw].getDistTableAB(myTableIndex);
394  const auto& displ = (P_list[iw].getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
395 
396  for (int c = 0; c < NumCenters; c++)
397  for (size_t idim = 0; idim < 3; idim++)
398  {
399  Tv_list[idim + 3 * (iw + c * Nw)] = (ions_.R[c][idim] - coordR[idim]) - displ[c][idim];
400  displ_list_tr[idim + 3 * (iw + c * Nw)] = displ[c][idim];
401  }
402  }
403 #if defined(QMC_COMPLEX)
404  Tv_list.updateTo();
405 #endif
406  displ_list_tr.updateTo();
407 
408  for (int c = 0; c < NumCenters; c++)
409  {
410  auto one_species_basis_list = extractOneSpeciesBasisRefList(basis_list, IonID[c]);
411  LOBasisSet[IonID[c]]->mw_evaluateV(one_species_basis_list, pset_leader.getLattice(), vals, displ_list_tr, Tv_list,
412  Nw, BasisSetSize, c, BasisOffset[c], NumCenters);
413  }
414 }
415 
416 
417 template<class COT, typename ORBT>
419  int iat,
420  const ParticleSet& ions,
421  int jion,
422  vgl_type& vgl)
423 {
424  //We need to zero out the temporary array vgl.
425  auto* restrict gx = vgl.data(1);
426  auto* restrict gy = vgl.data(2);
427  auto* restrict gz = vgl.data(3);
428 
429  for (int ib = 0; ib < BasisSetSize; ib++)
430  {
431  gx[ib] = 0;
432  gy[ib] = 0;
433  gz[ib] = 0;
434  }
435 
436  const auto& IonID(ions_.GroupID);
437  const auto& d_table = P.getDistTableAB(myTableIndex);
438  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
439  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
440 
441  const auto& coordR = P.activeR(iat);
442 
443  PosType Tv;
444  Tv[0] = (ions_.R[jion][0] - coordR[0]) - displ[jion][0];
445  Tv[1] = (ions_.R[jion][1] - coordR[1]) - displ[jion][1];
446  Tv[2] = (ions_.R[jion][2] - coordR[2]) - displ[jion][2];
447  //PosType Tv;
448  //Tv[0] = Tv[1] = Tv[2] = 0;
449  //Since LCAO's are written only in terms of (r-R), ionic derivatives only exist for the atomic center
450  //that we wish to take derivatives of. Moreover, we can obtain an ion derivative by multiplying an electron
451  //derivative by -1.0. Handling this sign is left to LCAOrbitalSet. For now, just note this is the electron VGL function.
452  LOBasisSet[IonID[jion]]->evaluateVGL(P.getLattice(), dist[jion], displ[jion], BasisOffset[jion], vgl, Tv);
453 }
454 
455 template<class COT, typename ORBT>
457  int iat,
458  const ParticleSet& ions,
459  int jion,
460  vghgh_type& vghgh)
461 {
462  //We need to zero out the temporary array vghgh.
463  auto* restrict gx = vghgh.data(1);
464  auto* restrict gy = vghgh.data(2);
465  auto* restrict gz = vghgh.data(3);
466 
467  auto* restrict hxx = vghgh.data(4);
468  auto* restrict hxy = vghgh.data(5);
469  auto* restrict hxz = vghgh.data(6);
470  auto* restrict hyy = vghgh.data(7);
471  auto* restrict hyz = vghgh.data(8);
472  auto* restrict hzz = vghgh.data(9);
473 
474  auto* restrict gxxx = vghgh.data(10);
475  auto* restrict gxxy = vghgh.data(11);
476  auto* restrict gxxz = vghgh.data(12);
477  auto* restrict gxyy = vghgh.data(13);
478  auto* restrict gxyz = vghgh.data(14);
479  auto* restrict gxzz = vghgh.data(15);
480  auto* restrict gyyy = vghgh.data(16);
481  auto* restrict gyyz = vghgh.data(17);
482  auto* restrict gyzz = vghgh.data(18);
483  auto* restrict gzzz = vghgh.data(19);
484 
485 
486  for (int ib = 0; ib < BasisSetSize; ib++)
487  {
488  gx[ib] = 0;
489  gy[ib] = 0;
490  gz[ib] = 0;
491 
492  hxx[ib] = 0;
493  hxy[ib] = 0;
494  hxz[ib] = 0;
495  hyy[ib] = 0;
496  hyz[ib] = 0;
497  hzz[ib] = 0;
498 
499  gxxx[ib] = 0;
500  gxxy[ib] = 0;
501  gxxz[ib] = 0;
502  gxyy[ib] = 0;
503  gxyz[ib] = 0;
504  gxzz[ib] = 0;
505  gyyy[ib] = 0;
506  gyyz[ib] = 0;
507  gyzz[ib] = 0;
508  gzzz[ib] = 0;
509  }
510 
511  // Since jion is indexed on the source ions not the ions_ the distinction between
512  // ions_ and ions is extremely important.
513  const auto& IonID(ions.GroupID);
514  const auto& d_table = P.getDistTableAB(myTableIndex);
515  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
516  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
517 
518  //Since LCAO's are written only in terms of (r-R), ionic derivatives only exist for the atomic center
519  //that we wish to take derivatives of. Moreover, we can obtain an ion derivative by multiplying an electron
520  //derivative by -1.0. Handling this sign is left to LCAOrbitalSet. For now, just note this is the electron VGL function.
521 
522  const auto& coordR = P.activeR(iat);
523 
524  PosType Tv;
525  Tv[0] = (ions_.R[jion][0] - coordR[0]) - displ[jion][0];
526  Tv[1] = (ions_.R[jion][1] - coordR[1]) - displ[jion][1];
527  Tv[2] = (ions_.R[jion][2] - coordR[2]) - displ[jion][2];
528  LOBasisSet[IonID[jion]]->evaluateVGHGH(P.getLattice(), dist[jion], displ[jion], BasisOffset[jion], vghgh, Tv);
529 }
530 
531 template<class COT, typename ORBT>
532 void SoaLocalizedBasisSet<COT, ORBT>::add(int icenter, std::unique_ptr<COT> aos)
533 {
534  LOBasisSet[icenter] = std::move(aos);
535 }
536 
537 template class SoaLocalizedBasisSet<
540 template class SoaLocalizedBasisSet<
543 template class SoaLocalizedBasisSet<
546 template class SoaLocalizedBasisSet<
549 template class SoaLocalizedBasisSet<
552 template class SoaLocalizedBasisSet<
555 } // namespace qmcplusplus
Index_t getActivePtcl() const
return active particle id
Definition: ParticleSet.h:260
void evaluateVGL(const ParticleSet &P, int iat, vgl_type &vgl) override
compute VGL
size_t addResource(std::unique_ptr< Resource > &&res, bool noprint=false)
void takebackResource(ResourceHandle< RS > &res_handle)
void setBasisSetSize(int nbs) override
set BasisSetSize and allocate mVGL container
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
A localized basis set derived from SoaBasisSetBase<ORBT>
void setPBCParams(const TinyVector< int, 3 > &PBCImages, const TinyVector< double, 3 > Sup_Twist, const Vector< ValueType, OffloadPinnedAllocator< ValueType >> &phase_factor, const Array< RealType, 2, OffloadPinnedAllocator< RealType >> &pbc_displacements)
set Number of periodic Images to evaluate the orbitals.
size_t getTotalNum() const
Definition: ParticleSet.h:493
For distance tables of virtual particle (VP) sets constructed based on this table, whether full table is needed on host The corresponding DT of VP need to set MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST accordingly.
void queryOrbitalsForSType(const std::vector< bool > &corrCenter, std::vector< bool > &is_s_orbital) const override
Determine which orbitals are S-type.
size_t NumCenters
number of centers, e.g., ions
SoaSphericalTensor that evaluates the Real Spherical Harmonics.
void evaluateVGHGH(const ParticleSet &P, int iat, vghgh_type &vghgh) override
compute VGHGH
void evaluateV(const ParticleSet &P, int iat, ORBT *restrict vals) override
compute values for the iat-paricle move
ParticleIndex GroupID
Species ID.
Definition: ParticleSet.h:77
int getTotalNum() const
return the number of species
Definition: SpeciesSet.h:55
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< SoaBasisSetBase< ORBT >> &basisset_list) const override
return a shared resource to collection
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
QTBase::ValueType ValueType
Definition: Configuration.h:60
const DistRow & getTempDists() const
return the temporary distances when a move is proposed
typename BaseType::vgh_type vgh_type
void add(int icenter, std::unique_ptr< COT > aos)
add a new set of Centered Atomic Orbitals
size_t size() const
Definition: OhmmsArray.h:57
void createResource(ResourceCollection &collection) const override
initialize a shared resource and hand it to collection
const PosType & activeR(int iat) const
return the active position if the particle is active or the return current position if not ...
Definition: ParticleSet.h:265
OMPallocator is an allocator with fused device and dualspace allocator functionality.
void evaluateGradSourceV(const ParticleSet &P, int iat, const ParticleSet &ions, int jion, vgl_type &vgl) override
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
Definition: ParticleSet.h:231
Vector< RealType, OffloadPinnedAllocator< RealType > > Tv_list
Vector< RealType, OffloadPinnedAllocator< RealType > > displ_list_tr
void mw_evaluateVGL(const RefVectorWithLeader< SoaBasisSetBase< ORBT >> &basis_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, OffloadMWVGLArray &vgl) override
compute VGL using packed array with all walkers
whether full table needs to be ready at anytime or not during PbyP Optimization can be implemented du...
std::vector< size_t > BasisOffset
container to store the offsets of the basis functions for each center Due to potential reordering of ...
typename BaseType::vghgh_type vghgh_type
const auto & getLattice() const
Definition: ParticleSet.h:251
std::vector< std::unique_ptr< COT > > LOBasisSet
container of the unique pointers to the Atomic Orbitals
ResourceHandle< RS > lendResource()
SoaLocalizedBasisSet(ParticleSet &ions, ParticleSet &els)
constructor
void mw_evaluateValue(const RefVectorWithLeader< SoaBasisSetBase< ORBT >> &basis_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, OffloadMWVArray &v) override
compute V using packed array with all walkers
A D-dimensional Array class based on PETE.
Definition: OhmmsArray.h:25
size_t NumTargets
number of quantum particles
A derived class from BasisSetBase.
CartesianTensor according to Gamess order.
void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< SoaBasisSetBase< ORBT >> &basisset_list) const override
acquire a shared resource from collection
ResourceHandle< VPMultiWalkerMem > mw_mem_handle_
multi walker resource
typename BaseType::vgl_type vgl_type
static RefVectorWithLeader< COT > extractOneSpeciesBasisRefList(const RefVectorWithLeader< SoaBasisSetBase< ORBT >> &basisset_list, int id)
helper function for extracting a list of atomic basis sets for a single species (indexed by id) from ...
void evaluateGradSourceVGL(const ParticleSet &P, int iat, const ParticleSet &ions, int jion, vghgh_type &vghgh) override
void evaluateVGH(const ParticleSet &P, int iat, vgh_type &vgh) override
compute VGH
int BasisSetSize
size of the basis set
Definition: BasisSetBase.h:143
typename ParticleSet::PosType PosType
void mw_evaluateValueVPs(const RefVectorWithLeader< SoaBasisSetBase< ORBT >> &basis_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, OffloadMWVArray &v) override
compute V using packed array with all walkers
Assume that coeffs.D1 and the LogLightGrid r_values.size() are equal Therefore r must be < r_max...