33 #if defined(HAVE_LIBFFTW) 43 #if OHMMS_DIM == 3 && defined(HAVE_LIBFFTW) 44 std::string a(
"e"), title(
"MPC"), physical(
"no");
47 hAttrib.
add(title,
"id");
48 hAttrib.
add(title,
"name");
49 hAttrib.
add(cutoff,
"cutoff");
50 hAttrib.
add(physical,
"physical");
53 isphysical = (physical ==
"yes" || physical ==
"true");
58 app_summary() <<
" Name: " << title <<
" Physical : " << physical << std::endl;
63 "************************\n" 64 "** Error in MPC setup **\n" 65 "************************\n" 66 " The electron density was not setup by the " 67 "wave function builder.\n");
69 auto mpc = std::make_unique<MPC>(
targetPtcl, cutoff);
70 targetH->addOperator(std::move(mpc),
"MPC", isphysical);
73 "HamiltonianFactory::addMPCPotential MPC is disabled because FFTW3 was not found during the build process.");
74 #endif // defined(HAVE_LIBFFTW) 83 std::string title(
"ElecElec"), pbc(
"yes");
84 std::string forces(
"no");
88 hAttrib.
add(title,
"id");
89 hAttrib.
add(title,
"name");
90 hAttrib.
add(targetInp,
"target");
91 hAttrib.
add(sourceInp,
"source");
92 hAttrib.
add(pbc,
"pbc");
93 hAttrib.
add(physical,
"physical");
94 hAttrib.
add(forces,
"forces");
97 const bool applyPBC = (
PBCType && pbc ==
"yes");
98 const bool doForces = (forces ==
"yes") || (forces ==
"true");
101 app_summary() <<
" Coulomb Potential" << std::endl;
102 app_summary() <<
" -----------------" << std::endl;
103 app_summary() <<
" Name: " << title <<
" Type: " << (sourceInp == targetInp ?
"AA" :
"AB")
104 <<
" PBC: " << (applyPBC ?
"yes" :
"no") << std::endl;
114 ERRORMSG(
"Missing source ParticleSet" << sourceInp);
115 APP_ABORT(
"HamiltonianFactory::addCoulombPotential");
118 ptclA = pit->second.
get();
121 if (sourceInp == targetInp)
125 app_log() <<
" CoulombAA for " << sourceInp <<
" is not created. Number of particles == 1 and nonPeriodic" 137 app_summary() <<
" Running OpenMP offload code path." << std::endl;
139 throw std::runtime_error(
"Requested OpenMP offload in CoulombPBCAA but the particle set has gpu=no.");
141 targetH->addOperator(std::make_unique<CoulombPBCAA>(*ptclA, quantum, doForces, use_offload), title, physical);
160 std::string a(
"ion0"), targetName(
"e"), title(
"ForceBase"), pbc(
"yes"), PsiName =
"psi0";
162 std::string mode(
"bare");
164 hAttrib.
add(title,
"name");
165 hAttrib.
add(a,
"source");
166 hAttrib.
add(targetName,
"target");
167 hAttrib.
add(pbc,
"pbc");
168 hAttrib.
add(mode,
"mode");
169 hAttrib.
add(PsiName,
"psi");
171 app_log() <<
"HamFac forceBase mode " << mode << std::endl;
172 bool applyPBC = (
PBCType && pbc ==
"yes");
180 ERRORMSG(
"Missing source ParticleSet" << a)
187 ERRORMSG(
"Missing target ParticleSet" << targetName)
194 std::unique_ptr<BareForce> bareforce = std::make_unique<BareForce>(*source, *target);
196 targetH->addOperator(std::move(bareforce), title,
false);
198 else if (mode ==
"cep")
200 if (applyPBC ==
true)
202 std::unique_ptr<ForceChiesaPBCAA> force_chi = std::make_unique<ForceChiesaPBCAA>(*source, *target,
true);
204 targetH->addOperator(std::move(force_chi), title,
false);
208 std::unique_ptr<ForceCeperley> force_cep = std::make_unique<ForceCeperley>(*source, *target);
210 targetH->addOperator(std::move(force_cep), title,
false);
213 else if (mode ==
"acforce")
215 app_log() <<
"Adding Assaraf-Caffarel total force.\n";
216 auto psi_it(
psiPool.find(PsiName));
219 APP_ABORT(
"Unknown psi \"" + PsiName +
"\" for zero-variance force.");
222 std::unique_ptr<ACForce> acforce = std::make_unique<ACForce>(*source, *target, psi, *
targetH);
224 targetH->addOperator(std::move(acforce), title,
false);
228 ERRORMSG(
"Failed to recognize Force mode " << mode);
236 std::string src(
"i"), title(
"PseudoPot"), wfname(
"invalid"), format(
"xml");
238 pAttrib.
add(title,
"name");
239 pAttrib.
add(src,
"source");
240 pAttrib.
add(wfname,
"wavefunction");
241 pAttrib.
add(format,
"format");
245 APP_ABORT(
"pseudopotential Table format is not supported.");
252 ERRORMSG(
"Missing source ParticleSet" << src)
256 auto oit(
psiPool.find(wfname));
262 app_warning() <<
" Cannot find " << wfname <<
" in the Wavefunction pool. Using the first wavefunction." 264 psi =
psiPool.begin()->second.get();
268 psi = (*oit).second.get();
282 APP_ABORT(
"HamiltonianFactory::addPseudoPotential\n pairpot@type=\"pseudo\" is invalid if DIM != 3");
const std::string & getName() const
return the name
std::ostream & app_warning()
helper functions for EinsplineSetBuilder
size_t getTotalNum() const
QMCTraits::FullPrecRealType FullPrecRealType
std::ostream & app_summary()
bool put(xmlNodePtr cur)
assign attributes to the set
int PBCType
type of the lattice. 0=non-periodic, 1=periodic
const PsiPoolType & psiPool
reference to the TrialWaveFunction Pool
Specialized paritlce class for atomistic simulations.
DynamicCoordinateKind getKind() const
Communicate * myComm
pointer to Communicate
class to handle a set of attributes of an xmlNode
void addPseudoPotential(xmlNodePtr cur)
std::vector< ComplexType > Density_G
void addCoulombPotential(xmlNodePtr cur)
Declaration of a HamiltonianFactory.
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
static PlatformKind selectPlatform(std::string_view value)
std::unique_ptr< QMCHamiltonian > targetH
many-body wavefunction object
void renameProperty(const std::string &a, const std::string &b)
add a property whose name will be renamed by b
const DynamicCoordinates & getCoordinates() const
const PSetMap & ptclPool
reference to the PSetMap
Class to represent a many-body trial wave function.
std::string psiName
name of the TrialWaveFunction
bool put(xmlNodePtr cur)
read from xmlNode
ParticleSet & targetPtcl
target ParticleSet
void addMPCPotential(xmlNodePtr cur, bool physical=false)
Declaration of ACForce, Assaraf-Caffarel ZVZB style force estimation.
void barrier_and_abort(const std::string &msg) const
bool get(std::ostream &os) const override
dummy. For satisfying OhmmsElementBase.
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
BareKineticEnergy::Return_t Return_t
void addForceHam(xmlNodePtr cur)
Declaration of QMCHamiltonian.
const std::vector< std::string > candidate_values