QMCPACK
NEReferencePoints Class Reference

This class creates, contains, and writes both user and machine readable referencepoints. More...

+ Inheritance diagram for NEReferencePoints:
+ Collaboration diagram for NEReferencePoints:

Public Types

using Real = QMCTraits::FullPrecRealType
 
using Axes = Tensor< Real, OHMMS_DIM >
 
using Point = TinyVector< Real, OHMMS_DIM >
 
using Points = std::map< std::string, Point >
 
using Coord = typename ReferencePointsInput::Coord
 

Public Member Functions

 NEReferencePoints (const ReferencePointsInput &rp_input, const ParticleSet &pset, RefVector< ParticleSet > &ref_psets)
 Usual constructor. More...
 
 NEReferencePoints (const NEReferencePoints &nerp)=default
 
void write_description (std::ostream &os, const std::string &indent) const
 writes a human readable representation of the reference points. More...
 
void write (hdf_archive &file) const
 machine readable output More...
 
const Pointsget_points () const
 return const ref to map of reference points. More...
 

Protected Attributes

Points points_
 

Private Member Functions

void processParticleSets (const ParticleSet &P, RefVector< ParticleSet > &Pref)
 

Private Attributes

Axes axes
 
ReferencePointsInput input_
 

Detailed Description

This class creates, contains, and writes both user and machine readable referencepoints.

they are derived from the lattice of the pset passed and the particle positions in the ref_psets an arbitrary number of additional points can be defined in the input that ReferencePointsInput presents as native input. It is a dependency of Estimators/NESpaceGrid and Estimatorss/EnergyDensityEstimator

Definition at line 37 of file NEReferencePoints.h.

Member Typedef Documentation

◆ Axes

Definition at line 41 of file NEReferencePoints.h.

◆ Coord

Definition at line 44 of file NEReferencePoints.h.

◆ Point

Definition at line 42 of file NEReferencePoints.h.

◆ Points

using Points = std::map<std::string, Point>

Definition at line 43 of file NEReferencePoints.h.

◆ Real

Definition at line 40 of file NEReferencePoints.h.

Constructor & Destructor Documentation

◆ NEReferencePoints() [1/2]

NEReferencePoints ( const ReferencePointsInput rp_input,
const ParticleSet pset,
RefVector< ParticleSet > &  ref_psets 
)

Usual constructor.

Parameters
[in]rp_inputInput object for reference points which can contain and arbitrary set of points beyond those take from the pset, and ref_psets
[in]psetpset that supplies the lattice information for reference points
[in]ref_psetspset reference vector the particle points in this/these psets are reference points ions are surfaced in the reference points as ion{num} with no special formatting.

Definition at line 23 of file NEReferencePoints.cpp.

References NEReferencePoints::axes, qmcplusplus::dot(), ReferencePointsInput::get_coord_form(), ReferencePointsInput::get_points(), NEReferencePoints::input_, OHMMS_DIM, NEReferencePoints::points_, NEReferencePoints::processParticleSets(), and qmcplusplus::pset.

26  : input_(rp_input)
27 {
28  processParticleSets(pset, ref_psets);
29  for (int i = 0; i < OHMMS_DIM; i++)
30  for (int d = 0; d < OHMMS_DIM; d++)
31  axes(d, i) = pset.getLattice().a(i)[d];
32  Axes crd;
33  // no need to handle error here rp_input will have a valid value for coord_form
34  switch (input_.get_coord_form())
35  {
36  case Coord::CELL:
37  crd = axes;
38  break;
39  case Coord::CARTESIAN:
40  for (int i = 0; i < OHMMS_DIM; i++)
41  for (int d = 0; d < OHMMS_DIM; d++)
42  if (d == i)
43  crd(i, i) = 1.0;
44  else
45  crd(d, i) = 0.0;
46  break;
47  }
48 
49  for (const auto& [key, value] : input_.get_points())
50  points_[key] = dot(crd, value);
51 }
#define OHMMS_DIM
Definition: config.h:64
void processParticleSets(const ParticleSet &P, RefVector< ParticleSet > &Pref)
Tensor< Real, OHMMS_DIM > Axes
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ NEReferencePoints() [2/2]

NEReferencePoints ( const NEReferencePoints nerp)
default

Member Function Documentation

◆ get_points()

const Points& get_points ( ) const
inline

return const ref to map of reference points.

labeling scheme unchanged from legacy

Definition at line 70 of file NEReferencePoints.h.

References NEReferencePoints::points_.

Referenced by qmcplusplus::TEST_CASE().

◆ processParticleSets()

void processParticleSets ( const ParticleSet P,
RefVector< ParticleSet > &  Pref 
)
private

Definition at line 53 of file NEReferencePoints.cpp.

References ParticleSet::getLattice(), NEReferencePoints::points_, and qmcplusplus::pset.

Referenced by NEReferencePoints::NEReferencePoints().

54 {
55  //get axes and origin information from the ParticleSet
56  points_["zero"] = 0 * P.getLattice().a(0);
57  points_["a1"] = P.getLattice().a(0);
58  points_["a2"] = P.getLattice().a(1);
59  points_["a3"] = P.getLattice().a(2);
60  //points_["center"]= .5*(P.getLattice().a(0)+P.getLattice().a(1)+P.Lattice.a(2))
61  //set points_ on face centers
62  points_["f1p"] = points_["zero"] + .5 * points_["a1"];
63  points_["f1m"] = points_["zero"] - .5 * points_["a1"];
64  points_["f2p"] = points_["zero"] + .5 * points_["a2"];
65  points_["f2m"] = points_["zero"] - .5 * points_["a2"];
66  points_["f3p"] = points_["zero"] + .5 * points_["a3"];
67  points_["f3m"] = points_["zero"] - .5 * points_["a3"];
68  //set points_ on cell corners
69  points_["cmmm"] = points_["zero"] + .5 * (-1 * points_["a1"] - points_["a2"] - points_["a3"]);
70  points_["cpmm"] = points_["zero"] + .5 * (points_["a1"] - points_["a2"] - points_["a3"]);
71  points_["cmpm"] = points_["zero"] + .5 * (-1 * points_["a1"] + points_["a2"] - points_["a3"]);
72  points_["cmmp"] = points_["zero"] + .5 * (-1 * points_["a1"] - points_["a2"] + points_["a3"]);
73  points_["cmpp"] = points_["zero"] + .5 * (-1 * points_["a1"] + points_["a2"] + points_["a3"]);
74  points_["cpmp"] = points_["zero"] + .5 * (points_["a1"] - points_["a2"] + points_["a3"]);
75  points_["cppm"] = points_["zero"] + .5 * (points_["a1"] + points_["a2"] - points_["a3"]);
76  points_["cppp"] = points_["zero"] + .5 * (points_["a1"] + points_["a2"] + points_["a3"]);
77  //get points from requested particle sets
78  int cshift = 1;
79  for (ParticleSet& pset : Psets)
80  {
81  for (int p = 0; p < pset.getTotalNum(); p++)
82  {
83  std::stringstream ss;
84  ss << p + cshift;
85  points_[pset.getName() + ss.str()] = pset.R[p];
86  }
87  }
88 }

◆ write()

void write ( hdf_archive file) const

machine readable output

Parameters
[in,out]filehdf5 file to write to. Respects current state of file.

Definition at line 102 of file NEReferencePoints.cpp.

References NEReferencePoints::points_, hdf_archive::pop(), hdf_archive::push(), and hdf_archive::write().

Referenced by qmcplusplus::TEST_CASE().

103 {
104  file.push(std::string_view("reference_points"));
105  for (auto it = points_.cbegin(); it != points_.cend(); ++it)
106  file.write(const_cast<Point&>(it->second), it->first);
107  file.pop();
108 }

◆ write_description()

void write_description ( std::ostream &  os,
const std::string &  indent 
) const

writes a human readable representation of the reference points.

Parameters
[in,out]osostream to write description to
[in]indentspaces or other text to preface each line of output with. needed to preserve legacy output format.

Definition at line 90 of file NEReferencePoints.cpp.

References NEReferencePoints::points_.

Referenced by qmcplusplus::operator<<(), and qmcplusplus::TEST_CASE().

91 {
92  os << indent + "reference_points" << std::endl;
93  std::map<std::string, Point>::const_iterator it, end = points_.end();
94  for (it = points_.begin(); it != end; ++it)
95  {
96  os << indent + " " << it->first << ": " << it->second << std::endl;
97  }
98  os << indent + "end reference_points" << std::endl;
99  return;
100 }

Member Data Documentation

◆ axes

Axes axes
private

Definition at line 76 of file NEReferencePoints.h.

Referenced by NEReferencePoints::NEReferencePoints().

◆ input_

ReferencePointsInput input_
private

Definition at line 77 of file NEReferencePoints.h.

Referenced by NEReferencePoints::NEReferencePoints().

◆ points_


The documentation for this class was generated from the following files: