QMCPACK
JastrowBuilder Class Reference

Jastrow Jastrow Builder with constraints. More...

+ Inheritance diagram for JastrowBuilder:
+ Collaboration diagram for JastrowBuilder:

Public Member Functions

 JastrowBuilder (Communicate *comm, ParticleSet &p, const PSetMap &psets)
 
std::unique_ptr< WaveFunctionComponentbuildComponent (xmlNodePtr cur) override
 process a xml node at cur More...
 
- Public Member Functions inherited from WaveFunctionComponentBuilder
 WaveFunctionComponentBuilder (Communicate *comm, ParticleSet &p)
 constructor More...
 
virtual ~WaveFunctionComponentBuilder ()=default
 
- Public Member Functions inherited from MPIObjectBase
 MPIObjectBase (Communicate *c)
 constructor with communicator More...
 
int rank () const
 return the rank of the communicator More...
 
int getGroupID () const
 return the group id of the communicator More...
 
CommunicategetCommunicator () const
 return myComm More...
 
CommunicategetCommRef () const
 return a TEMPORARY reference to Communicate More...
 
mpi_comm_type getMPI () const
 return MPI communicator if one wants to use MPI directly More...
 
bool is_manager () const
 return true if the rank == 0 More...
 
const std::string & getName () const
 return the name More...
 
void setName (const std::string &aname)
 

Private Member Functions

void resetOptions ()
 reset the options More...
 
std::unique_ptr< WaveFunctionComponentbuildOneBody (xmlNodePtr cur)
 build one-body term More...
 
std::unique_ptr< WaveFunctionComponentbuildTwoBody (xmlNodePtr cur)
 build two-body term More...
 
std::unique_ptr< WaveFunctionComponentbuild_eeI (xmlNodePtr cur)
 build electron-electron ion term More...
 
std::unique_ptr< WaveFunctionComponentbuildkSpace (xmlNodePtr cur)
 build k-Space term More...
 
std::unique_ptr< WaveFunctionComponentbuildCounting (xmlNodePtr cur)
 build number-counting term More...
 

Private Attributes

const PSetMapptclPool
 particleset pool to get ParticleSet other than the target More...
 
int JastrowType
 index for the jastrow type: 1, 2, 3 More...
 
std::string nameOpt
 <jastrow name="..."> More...
 
std::string typeOpt
 <jastrow type="..."> More...
 
std::string funcOpt
 <jastrow function="..."> More...
 
std::string spinOpt
 <jastrow spin="..."> More...
 
std::string transformOpt
 <jastrow transform="..."> More...
 
std::string sourceOpt
 <jastrow source="..."> More...
 

Additional Inherited Members

- Public Types inherited from WaveFunctionComponentBuilder
using RealType = WaveFunctionComponent::RealType
 
using ValueType = WaveFunctionComponent::ValueType
 
using PosType = WaveFunctionComponent::PosType
 
using GradType = WaveFunctionComponent::GradType
 
using PSetMap = std::map< std::string, const std::unique_ptr< ParticleSet > >
 
- Public Types inherited from MPIObjectBase
using mpi_comm_type = Communicate::mpi_comm_type
 
- Static Public Attributes inherited from WaveFunctionComponentBuilder
static std::string wfs_tag = "wavefunction"
 reserved tags for the elements associated with the many-body wavefunctions More...
 
static std::string param_tag = "parameter"
 the element name for a parameter More...
 
static std::string dtable_tag = "distancetable"
 the element name for a distancetable More...
 
static std::string jastrow_tag = "jastrow"
 the element name for jatrow More...
 
static std::string detset_tag = "determinantset"
 the element name for a set of Slater determinants, contains 1..* Slater determinants More...
 
static std::string sd_tag = "slaterdeterminant"
 the element name for a Slater determinant, contains 1..* determinants More...
 
static std::string det_tag = "determinant"
 the element name for a determinant, may contain (0..*) orbital or parameter element More...
 
static std::string rn_tag = "determinant_rn"
 the element name for a released node determinant, may contain (0..*) orbital or parameter element More...
 
static std::string spo_tag = "psi"
 the element name for single-particle orbital More...
 
static std::string sposet_tag = "sposet"
 the element name for single-particle orbital set More...
 
static std::string ionorb_tag = "ionwf"
 the element name for an ion wavefunction More...
 
static std::string backflow_tag = "backflow"
 the element name for a backflow transformation More...
 
static std::string multisd_tag = "multideterminant"
 the element name for a multi slater determinant wavefunction More...
 
- Protected Attributes inherited from WaveFunctionComponentBuilder
ParticleSettargetPtcl
 reference to the particle set on which targetPsi is defined More...
 
xmlNodePtr myNode
 xmlNode operated by this object More...
 
- Protected Attributes inherited from MPIObjectBase
CommunicatemyComm
 pointer to Communicate More...
 
std::string ClassName
 class Name More...
 
std::string myName
 name of the object More...
 

Detailed Description

Jastrow Jastrow Builder with constraints.

Definition at line 26 of file JastrowBuilder.h.

Constructor & Destructor Documentation

◆ JastrowBuilder()

JastrowBuilder ( Communicate comm,
ParticleSet p,
const PSetMap psets 
)

Definition at line 29 of file JastrowBuilder.cpp.

References MPIObjectBase::ClassName, and JastrowBuilder::resetOptions().

31 {
32  resetOptions();
33  ClassName = "JastrowBuilder";
34 }
WaveFunctionComponentBuilder(Communicate *comm, ParticleSet &p)
constructor
std::string ClassName
class Name
Definition: MPIObjectBase.h:65
void resetOptions()
reset the options
const PSetMap & ptclPool
particleset pool to get ParticleSet other than the target

Member Function Documentation

◆ build_eeI()

std::unique_ptr< WaveFunctionComponent > build_eeI ( xmlNodePtr  cur)
private

build electron-electron ion term

Definition at line 133 of file JastrowBuilder.cpp.

References APP_ABORT, qmcplusplus::app_error(), eeI_JastrowBuilder::buildComponent(), MPIObjectBase::ClassName, MPIObjectBase::myComm, JastrowBuilder::ptclPool, JastrowBuilder::sourceOpt, and WaveFunctionComponentBuilder::targetPtcl.

Referenced by JastrowBuilder::buildComponent().

134 {
135 #if OHMMS_DIM == 3
136  ReportEngine PRE(ClassName, "add_eeI(xmlNodePtr)");
137  auto pit(ptclPool.find(sourceOpt));
138  if (pit == ptclPool.end())
139  {
140  app_error() << " JastrowBuilder::build_eeI requires a source attribute. " << sourceOpt << " is invalid "
141  << std::endl;
142  APP_ABORT(" JastrowBuilder::build_eeI");
143  return nullptr;
144  }
145  ParticleSet& sourcePtcl = *((*pit).second);
146  eeI_JastrowBuilder jb(myComm, targetPtcl, sourcePtcl);
147  return jb.buildComponent(cur);
148 #else
149  APP_ABORT(" eeI is not valid for OHMMS_DIM != 3 ");
150  return nullptr;
151 #endif
152 }
std::ostream & app_error()
Definition: OutputManager.h:67
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
std::string sourceOpt
<jastrow source="...">
std::string ClassName
class Name
Definition: MPIObjectBase.h:65
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
const PSetMap & ptclPool
particleset pool to get ParticleSet other than the target

◆ buildComponent()

std::unique_ptr< WaveFunctionComponent > buildComponent ( xmlNodePtr  cur)
overridevirtual

process a xml node at cur

Implements WaveFunctionComponentBuilder.

Definition at line 47 of file JastrowBuilder.cpp.

References OhmmsAttributeSet::add(), APP_ABORT, qmcplusplus::app_summary(), JastrowBuilder::build_eeI(), JastrowBuilder::buildCounting(), JastrowBuilder::buildkSpace(), JastrowBuilder::buildOneBody(), JastrowBuilder::buildTwoBody(), JastrowBuilder::funcOpt, WaveFunctionComponentBuilder::myNode, JastrowBuilder::nameOpt, OhmmsAttributeSet::put(), JastrowBuilder::resetOptions(), JastrowBuilder::sourceOpt, JastrowBuilder::spinOpt, JastrowBuilder::transformOpt, and JastrowBuilder::typeOpt.

48 {
49  myNode = cur;
50  resetOptions();
51  OhmmsAttributeSet oAttrib;
52  oAttrib.add(typeOpt, "type");
53  oAttrib.add(nameOpt, "name");
54  oAttrib.add(funcOpt, "function");
55  oAttrib.add(transformOpt, "transform");
56  oAttrib.add(sourceOpt, "source");
57  oAttrib.add(spinOpt, "spin");
58  oAttrib.put(cur);
59  if (nameOpt[0] == '0')
60  {
61  APP_ABORT(" JastrowBuilder::put does not have name!\n");
62  return nullptr;
63  }
64  app_summary() << std::endl;
65  app_summary() << " Jastrow" << std::endl;
66  app_summary() << " -------" << std::endl;
67  app_summary() << " Name: " << nameOpt << " Type: " << typeOpt << " Function: " << funcOpt << std::endl;
68  app_summary() << std::endl;
69 
70  if (typeOpt.find("One") < typeOpt.size())
71  return buildOneBody(cur);
72  else if (typeOpt.find("Two") < typeOpt.size())
73  return buildTwoBody(cur);
74  else if (typeOpt.find("eeI") < typeOpt.size())
75  return build_eeI(cur);
76  else if (typeOpt.find("kSpace") < typeOpt.size())
77  return buildkSpace(cur);
78  else if (typeOpt.find("Counting") < typeOpt.size())
79  return buildCounting(cur);
80  else
81  {
82  APP_ABORT(" JastrowBuilder::buildComponent unknown type!\n");
83  return nullptr;
84  }
85 }
std::ostream & app_summary()
Definition: OutputManager.h:63
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
std::unique_ptr< WaveFunctionComponent > buildCounting(xmlNodePtr cur)
build number-counting term
std::string spinOpt
<jastrow spin="...">
std::unique_ptr< WaveFunctionComponent > build_eeI(xmlNodePtr cur)
build electron-electron ion term
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
std::unique_ptr< WaveFunctionComponent > buildTwoBody(xmlNodePtr cur)
build two-body term
xmlNodePtr myNode
xmlNode operated by this object
std::string sourceOpt
<jastrow source="...">
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
std::unique_ptr< WaveFunctionComponent > buildOneBody(xmlNodePtr cur)
build one-body term
void resetOptions()
reset the options
std::string funcOpt
<jastrow function="...">
std::string transformOpt
<jastrow transform="...">
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
std::unique_ptr< WaveFunctionComponent > buildkSpace(xmlNodePtr cur)
build k-Space term
std::string typeOpt
<jastrow type="...">
std::string nameOpt
<jastrow name="...">

◆ buildCounting()

std::unique_ptr< WaveFunctionComponent > buildCounting ( xmlNodePtr  cur)
private

build number-counting term

Definition at line 87 of file JastrowBuilder.cpp.

References MPIObjectBase::ClassName, OhmmsElementBase::getName(), MPIObjectBase::myComm, JastrowBuilder::ptclPool, JastrowBuilder::sourceOpt, and WaveFunctionComponentBuilder::targetPtcl.

Referenced by JastrowBuilder::buildComponent().

88 {
89  ReportEngine PRE(ClassName, "addCounting(xmlNodePtr)");
90  std::unique_ptr<CountingJastrowBuilder> cjb;
91  auto pa_it(ptclPool.find(sourceOpt));
92  if (pa_it != ptclPool.end() && sourceOpt != targetPtcl.getName()) // source is not target
93  cjb = std::make_unique<CountingJastrowBuilder>(myComm, targetPtcl, *pa_it->second);
94  else
95  cjb = std::make_unique<CountingJastrowBuilder>(myComm, targetPtcl);
96  return cjb->buildComponent(cur);
97 }
const std::string & getName() const
return the name
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
std::string sourceOpt
<jastrow source="...">
std::string ClassName
class Name
Definition: MPIObjectBase.h:65
const PSetMap & ptclPool
particleset pool to get ParticleSet other than the target

◆ buildkSpace()

std::unique_ptr< WaveFunctionComponent > buildkSpace ( xmlNodePtr  cur)
private

build k-Space term

Definition at line 99 of file JastrowBuilder.cpp.

References qmcplusplus::app_log(), qmcplusplus::app_warning(), kSpaceJastrowBuilder::buildComponent(), MPIObjectBase::myComm, JastrowBuilder::ptclPool, JastrowBuilder::sourceOpt, and WaveFunctionComponentBuilder::targetPtcl.

Referenced by JastrowBuilder::buildComponent().

100 {
101  app_log() << " JastrowBuilder::buildkSpace(xmlNodePtr)" << std::endl;
102  auto pa_it(ptclPool.find(sourceOpt));
103  if (pa_it == ptclPool.end())
104  {
105  app_warning() << " JastrowBuilder::buildkSpace failed. " << sourceOpt << " does not exist" << std::endl;
106  return nullptr;
107  }
108  app_log() << "\n Using kSpaceJastrowBuilder for reciprocal-space Jastrows" << std::endl;
109  kSpaceJastrowBuilder sBuilder(myComm, targetPtcl, *pa_it->second);
110  return sBuilder.buildComponent(cur);
111 }
std::ostream & app_warning()
Definition: OutputManager.h:69
std::ostream & app_log()
Definition: OutputManager.h:65
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
std::string sourceOpt
<jastrow source="...">
const PSetMap & ptclPool
particleset pool to get ParticleSet other than the target

◆ buildOneBody()

std::unique_ptr< WaveFunctionComponent > buildOneBody ( xmlNodePtr  cur)
private

build one-body term

Definition at line 113 of file JastrowBuilder.cpp.

References RadialJastrowBuilder::buildComponent(), MPIObjectBase::ClassName, ReportEngine::error(), OhmmsElementBase::getName(), MPIObjectBase::myComm, JastrowBuilder::ptclPool, JastrowBuilder::sourceOpt, and WaveFunctionComponentBuilder::targetPtcl.

Referenced by JastrowBuilder::buildComponent().

114 {
115  ReportEngine PRE(ClassName, "addOneBody(xmlNodePtr)");
116  if (sourceOpt == targetPtcl.getName())
117  {
118  PRE.error("One-Body Jastrow Function needs a source different from " + targetPtcl.getName() +
119  "\nExit JastrowBuilder::buildOneBody.\n");
120  return nullptr;
121  }
122  auto pa_it(ptclPool.find(sourceOpt));
123  if (pa_it == ptclPool.end())
124  {
125  PRE.error("JastrowBuilder::buildOneBody failed. " + sourceOpt + " does not exist.");
126  return nullptr;
127  }
128  //use lowercase, to be handled by parser later
129  RadialJastrowBuilder rb(myComm, targetPtcl, *pa_it->second);
130  return rb.buildComponent(cur);
131 }
const std::string & getName() const
return the name
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
std::string sourceOpt
<jastrow source="...">
std::string ClassName
class Name
Definition: MPIObjectBase.h:65
const PSetMap & ptclPool
particleset pool to get ParticleSet other than the target

◆ buildTwoBody()

std::unique_ptr< WaveFunctionComponent > buildTwoBody ( xmlNodePtr  cur)
private

build two-body term

Definition at line 155 of file JastrowBuilder.cpp.

References RadialJastrowBuilder::buildComponent(), MPIObjectBase::ClassName, MPIObjectBase::myComm, and WaveFunctionComponentBuilder::targetPtcl.

Referenced by JastrowBuilder::buildComponent().

156 {
157  ReportEngine PRE(ClassName, "addTwoBody(xmlNodePtr)");
158  RadialJastrowBuilder rb(myComm, targetPtcl);
159  return rb.buildComponent(cur);
160 }
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
std::string ClassName
class Name
Definition: MPIObjectBase.h:65

◆ resetOptions()

void resetOptions ( )
private

reset the options

Definition at line 36 of file JastrowBuilder.cpp.

References JastrowBuilder::funcOpt, OhmmsElementBase::getName(), JastrowBuilder::JastrowType, JastrowBuilder::nameOpt, JastrowBuilder::sourceOpt, JastrowBuilder::spinOpt, WaveFunctionComponentBuilder::targetPtcl, JastrowBuilder::transformOpt, and JastrowBuilder::typeOpt.

Referenced by JastrowBuilder::buildComponent(), and JastrowBuilder::JastrowBuilder().

37 {
38  JastrowType = 0;
39  nameOpt = "0";
40  typeOpt = "Two";
41  funcOpt = "any";
42  spinOpt = "yes";
43  transformOpt = "no";
45 }
const std::string & getName() const
return the name
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
std::string spinOpt
<jastrow spin="...">
std::string sourceOpt
<jastrow source="...">
std::string funcOpt
<jastrow function="...">
std::string transformOpt
<jastrow transform="...">
int JastrowType
index for the jastrow type: 1, 2, 3
std::string typeOpt
<jastrow type="...">
std::string nameOpt
<jastrow name="...">

Member Data Documentation

◆ funcOpt

std::string funcOpt
private

<jastrow function="...">

Definition at line 43 of file JastrowBuilder.h.

Referenced by JastrowBuilder::buildComponent(), and JastrowBuilder::resetOptions().

◆ JastrowType

int JastrowType
private

index for the jastrow type: 1, 2, 3

Definition at line 37 of file JastrowBuilder.h.

Referenced by JastrowBuilder::resetOptions().

◆ nameOpt

std::string nameOpt
private

<jastrow name="...">

Definition at line 39 of file JastrowBuilder.h.

Referenced by JastrowBuilder::buildComponent(), and JastrowBuilder::resetOptions().

◆ ptclPool

const PSetMap& ptclPool
private

particleset pool to get ParticleSet other than the target

Definition at line 35 of file JastrowBuilder.h.

Referenced by JastrowBuilder::build_eeI(), JastrowBuilder::buildCounting(), JastrowBuilder::buildkSpace(), and JastrowBuilder::buildOneBody().

◆ sourceOpt

◆ spinOpt

std::string spinOpt
private

<jastrow spin="...">

Definition at line 45 of file JastrowBuilder.h.

Referenced by JastrowBuilder::buildComponent(), and JastrowBuilder::resetOptions().

◆ transformOpt

std::string transformOpt
private

<jastrow transform="...">

Definition at line 47 of file JastrowBuilder.h.

Referenced by JastrowBuilder::buildComponent(), and JastrowBuilder::resetOptions().

◆ typeOpt

std::string typeOpt
private

<jastrow type="...">

Definition at line 41 of file JastrowBuilder.h.

Referenced by JastrowBuilder::buildComponent(), and JastrowBuilder::resetOptions().


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