QMCPACK
ReferencePoints Class Reference
+ Inheritance diagram for ReferencePoints:
+ Collaboration diagram for ReferencePoints:

Public Types

using Point = TinyVector< RealType, DIM >
 
using Tensor_t = Tensor< RealType, DIM >
 
- Public Types inherited from QMCTraits
enum  { DIM = OHMMS_DIM, DIM_VGL = OHMMS_DIM + 2 }
 
using QTBase = QMCTypes< OHMMS_PRECISION, DIM >
 
using QTFull = QMCTypes< OHMMS_PRECISION_FULL, DIM >
 
using RealType = QTBase::RealType
 
using ComplexType = QTBase::ComplexType
 
using ValueType = QTBase::ValueType
 
using PosType = QTBase::PosType
 
using GradType = QTBase::GradType
 
using TensorType = QTBase::TensorType
 
using IndexType = OHMMS_INDEXTYPE
 define other types More...
 
using FullPrecRealType = QTFull::RealType
 
using FullPrecValueType = QTFull::ValueType
 
using PropertySetType = RecordNamedProperty< FullPrecRealType >
 define PropertyList_t More...
 
using PtclGrpIndexes = std::vector< std::pair< int, int > >
 

Public Member Functions

bool put (xmlNodePtr cur, ParticleSet &P, std::vector< ParticleSet *> &Pref)
 
bool put (ParticleSet &P, std::vector< ParticleSet *> &Pref)
 
void write_description (std::ostream &os, std::string &indent)
 
void save (std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
 

Public Attributes

std::map< std::string, Pointpoints
 
Tensor_t axes
 

Private Types

enum  Coordinate { cellC = 0, cartesianC, ndirections, nodir }
 

Private Attributes

Coordinate coordinate
 

Detailed Description

Definition at line 25 of file ReferencePoints.h.

Member Typedef Documentation

◆ Point

Definition at line 28 of file ReferencePoints.h.

◆ Tensor_t

Definition at line 29 of file ReferencePoints.h.

Member Enumeration Documentation

◆ Coordinate

enum Coordinate
private

Member Function Documentation

◆ put() [1/2]

bool put ( xmlNodePtr  cur,
ParticleSet P,
std::vector< ParticleSet *> &  Pref 
)

Definition at line 20 of file ReferencePoints.cpp.

References OhmmsAttributeSet::add(), qmcplusplus::app_log(), ReferencePoints::axes, ReferencePoints::cartesianC, ReferencePoints::cellC, qmcplusplus::hdf::coord, ReferencePoints::coordinate, QMCTraits::DIM, qmcplusplus::dot(), ParticleSet::getLattice(), ReferencePoints::points, OhmmsAttributeSet::put(), qmcplusplus::split(), qmcplusplus::string2real(), and qmcplusplus::strip().

Referenced by EnergyDensityEstimator::put().

21 {
22  app_log() << " Entering ReferencePoints::put" << std::endl;
23  bool succeeded = true;
24  put(P, Pref);
26  std::string coord = "";
27  ra.add(coord, "coord");
28  ra.put(cur);
29  for (int i = 0; i < DIM; i++)
30  for (int d = 0; d < DIM; d++)
31  axes(d, i) = P.getLattice().a(i)[d];
32  Tensor_t crd;
33  if (coord == "cell")
34  {
35  coordinate = cellC;
36  crd = axes;
37  }
38  else if (coord == "cartesian")
39  {
41  for (int i = 0; i < DIM; i++)
42  for (int d = 0; d < DIM; d++)
43  if (d == i)
44  crd(i, i) = 1.0;
45  else
46  crd(d, i) = 0.0;
47  }
48  else
49  {
50  app_log() << std::endl;
51  app_log() << " Valid coordinates must be provided for element reference_points." << std::endl;
52  app_log() << " You provided: " << coord << std::endl;
53  app_log() << " Options are cell or cartesian." << std::endl;
54  app_log() << std::endl;
55  succeeded = false;
56  }
57  //read in the point contents
58  app_log() << " reading reference_points contents" << std::endl;
59  std::vector<std::string> lines = split(strip(XMLNodeString{cur}), "\n");
60  for (int i = 0; i < lines.size(); i++)
61  {
62  std::vector<std::string> tokens = split(strip(lines[i]), " ");
63  if (tokens.size() != DIM + 1)
64  {
65  app_log() << " reference point has 4 entries, given " << tokens.size() << ": " << lines[i] << std::endl;
66  succeeded = false;
67  }
68  else
69  {
70  Point rp;
71  for (int d = 0; d < DIM; d++)
72  {
73  rp[d] = string2real(tokens[d + 1]);
74  }
75  rp = dot(crd, rp);
76  points[tokens[0]] = rp;
77  }
78  }
79  return succeeded;
80 }
std::ostream & app_log()
Definition: OutputManager.h:65
bool put(xmlNodePtr cur, ParticleSet &P, std::vector< ParticleSet *> &Pref)
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
TinyVector< RealType, DIM > Point
std::string strip(const std::string &s)
Definition: string_utils.h:26
std::vector< std::string > split(const std::string &s)
Definition: string_utils.h:57
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
std::map< std::string, Point > points
double string2real(const std::string &s)
Definition: string_utils.h:117
convert xmlNode contents into a std::string
const char coord[]
Definition: HDFVersion.h:48
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
Definition: AttributeSet.h:42
Tensor< RealType, DIM > Tensor_t

◆ put() [2/2]

bool put ( ParticleSet P,
std::vector< ParticleSet *> &  Pref 
)

Definition at line 82 of file ReferencePoints.cpp.

References ParticleSet::getLattice(), OhmmsElementBase::getName(), ParticleSet::getTotalNum(), ReferencePoints::points, and ParticleSet::R.

83 {
84  //get axes and origin information from the ParticleSet
85  points["zero"] = 0 * P.getLattice().a(0);
86  points["a1"] = P.getLattice().a(0);
87  points["a2"] = P.getLattice().a(1);
88  points["a3"] = P.getLattice().a(2);
89  //points["center"]= .5*(P.getLattice().a(0)+P.getLattice().a(1)+P.Lattice.a(2))
90  //set points on face centers
91  points["f1p"] = points["zero"] + .5 * points["a1"];
92  points["f1m"] = points["zero"] - .5 * points["a1"];
93  points["f2p"] = points["zero"] + .5 * points["a2"];
94  points["f2m"] = points["zero"] - .5 * points["a2"];
95  points["f3p"] = points["zero"] + .5 * points["a3"];
96  points["f3m"] = points["zero"] - .5 * points["a3"];
97  //set points on cell corners
98  points["cmmm"] = points["zero"] + .5 * (-1 * points["a1"] - points["a2"] - points["a3"]);
99  points["cpmm"] = points["zero"] + .5 * (points["a1"] - points["a2"] - points["a3"]);
100  points["cmpm"] = points["zero"] + .5 * (-1 * points["a1"] + points["a2"] - points["a3"]);
101  points["cmmp"] = points["zero"] + .5 * (-1 * points["a1"] - points["a2"] + points["a3"]);
102  points["cmpp"] = points["zero"] + .5 * (-1 * points["a1"] + points["a2"] + points["a3"]);
103  points["cpmp"] = points["zero"] + .5 * (points["a1"] - points["a2"] + points["a3"]);
104  points["cppm"] = points["zero"] + .5 * (points["a1"] + points["a2"] - points["a3"]);
105  points["cppp"] = points["zero"] + .5 * (points["a1"] + points["a2"] + points["a3"]);
106  //get points from requested particle sets
107  int cshift = 1;
108  for (int i = 0; i < Psets.size(); i++)
109  {
110  ParticleSet& PS = *Psets[i];
111  for (int p = 0; p < PS.getTotalNum(); p++)
112  {
113  std::stringstream ss;
114  ss << p + cshift;
115  points[PS.getName() + ss.str()] = PS.R[p];
116  }
117  }
118  return true;
119 }
std::map< std::string, Point > points

◆ save()

void save ( std::vector< ObservableHelper > &  h5desc,
hdf_archive file 
) const

Definition at line 133 of file ReferencePoints.cpp.

References ObservableHelper::addProperty(), qmcplusplus::oh, and ReferencePoints::points.

Referenced by EnergyDensityEstimator::registerCollectables().

134 {
135  h5desc.emplace_back(hdf_path{"reference_points"});
136  auto& oh = h5desc.back();
137  for (auto it = points.cbegin(); it != points.cend(); ++it)
138  {
139  oh.addProperty(const_cast<Point&>(it->second), it->first, file);
140  }
141  return;
142 }
void addProperty(T &p, const std::string &pname, hdf_archive &file)
add named property to describe the collectable this helper class handles
std::map< std::string, Point > points
ObservableHelper oh

◆ write_description()

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

Definition at line 122 of file ReferencePoints.cpp.

References ReferencePoints::points.

Referenced by EnergyDensityEstimator::write_description().

123 {
124  os << indent + "reference_points" << std::endl;
125  for (const auto& [name, point] : points)
126  {
127  os << indent + " " << name << ": " << point << std::endl;
128  }
129  os << indent + "end reference_points" << std::endl;
130  return;
131 }
std::map< std::string, Point > points

Member Data Documentation

◆ axes

Tensor_t axes

Definition at line 32 of file ReferencePoints.h.

Referenced by ReferencePoints::put().

◆ coordinate

Coordinate coordinate
private

Definition at line 47 of file ReferencePoints.h.

Referenced by ReferencePoints::put().

◆ points


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