mirror of https://github.com/QMCPACK/qmcpack.git
Remove SpinorSetBuilderFactory layer
This commit is contained in:
parent
69032e178e
commit
c1219ab0ce
|
@ -198,7 +198,6 @@ SET(FERMION_SRCS ${FERMION_SRCS}
|
|||
Fermion/SlaterDetWithBackflow.cpp
|
||||
Fermion/MultiSlaterDeterminantWithBackflow.cpp
|
||||
SPOSetBuilderFactory.cpp
|
||||
SpinorSetBuilderFactory.cpp
|
||||
TrialWaveFunction.cpp
|
||||
WaveFunctionFactory.cpp
|
||||
)
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
#include "QMCWaveFunctions/RotatedSPOs.h"
|
||||
#endif
|
||||
|
||||
#if defined(QMC_COMPLEX)
|
||||
#include "QMCWaveFunctions/EinsplineSpinorSetBuilder.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EINSPLINE)
|
||||
#include "QMCWaveFunctions/EinsplineSetBuilder.h"
|
||||
#endif
|
||||
|
@ -183,6 +187,15 @@ SPOSetBuilder* SPOSetBuilderFactory::createSPOSetBuilder(xmlNodePtr rootNode)
|
|||
bb = new SHOSetBuilder(targetPtcl, myComm);
|
||||
}
|
||||
#if OHMMS_DIM == 3
|
||||
else if (type == "spinorbspline")
|
||||
{
|
||||
#ifdef QMC_COMPLEX
|
||||
app_log() << "Einspline Spinor Set\n";
|
||||
bb = new EinsplineSpinorSetBuilder(targetPtcl, ptclPool, myComm, rootNode);
|
||||
#else
|
||||
PRE.error("Use of einspline spinors requires QMC_COMPLEX=1. Rebuild with this option");
|
||||
#endif
|
||||
}
|
||||
else if (type.find("spline") < type.size())
|
||||
{
|
||||
name = type_in;
|
||||
|
|
|
@ -1,149 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// This file is distributed under the University of Illinois/NCSA Open Source License.
|
||||
// See LICENSE file in top directory for details.
|
||||
//
|
||||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
|
||||
//
|
||||
// File developed by: Bryan Clark, bclark@Princeton.edu, Princeton University
|
||||
// Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
|
||||
// Miguel Morales, moralessilva2@llnl.gov, Lawrence Livermore National Laboratory
|
||||
// Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
|
||||
// Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
|
||||
// Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
|
||||
// Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
|
||||
//
|
||||
// File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "QMCWaveFunctions/SpinorSetBuilderFactory.h"
|
||||
#if OHMMS_DIM == 3
|
||||
#if defined(ENABLE_SOA)
|
||||
#include "QMCWaveFunctions/lcao/LCAOrbitalBuilder.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if !defined(QMC_COMPLEX)
|
||||
#include "QMCWaveFunctions/RotatedSPOs.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EINSPLINE)
|
||||
#include "QMCWaveFunctions/EinsplineSetBuilder.h"
|
||||
#include "QMCWaveFunctions/EinsplineSpinorSetBuilder.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "QMCWaveFunctions/CompositeSPOSet.h"
|
||||
#include "Utilities/ProgressReportEngine.h"
|
||||
#include "Utilities/IteratorUtility.h"
|
||||
#include "OhmmsData/AttributeSet.h"
|
||||
#include "Message/MPIObjectBase.h"
|
||||
|
||||
|
||||
namespace qmcplusplus
|
||||
{
|
||||
|
||||
/** constructor
|
||||
* \param els reference to the electrons
|
||||
* \param psi reference to the wavefunction
|
||||
* \param ions reference to the ions
|
||||
*/
|
||||
SpinorSetBuilderFactory::SpinorSetBuilderFactory(Communicate* comm, ParticleSet& els, PtclPoolType& psets)
|
||||
: SPOSetBuilderFactory(comm,els,psets)
|
||||
{
|
||||
ClassName = "SpinorSetBuilderFactory";
|
||||
}
|
||||
|
||||
SPOSetBuilder* SpinorSetBuilderFactory::createSPOSetBuilder(xmlNodePtr rootNode)
|
||||
{
|
||||
ReportEngine PRE(ClassName, "createSPOSetBuilder");
|
||||
std::string sourceOpt("ion0");
|
||||
std::string type("");
|
||||
std::string name("");
|
||||
std::string keyOpt("NMO"); //gaussian Molecular Orbital
|
||||
std::string transformOpt("yes"); //numerical Molecular Orbital
|
||||
std::string cuspC("no"); // cusp correction
|
||||
std::string cuspInfo(""); // file with precalculated cusp correction info
|
||||
std::string MOH5Ref(""); // Path to H5 file for MO calculations
|
||||
OhmmsAttributeSet aAttrib;
|
||||
aAttrib.add(sourceOpt, "source");
|
||||
aAttrib.add(cuspC, "cuspCorrection");
|
||||
aAttrib.add(type, "type");
|
||||
aAttrib.add(keyOpt, "keyword");
|
||||
aAttrib.add(keyOpt, "key");
|
||||
aAttrib.add(name, "name");
|
||||
aAttrib.add(transformOpt, "transform");
|
||||
aAttrib.add(cuspInfo, "cuspInfo");
|
||||
aAttrib.add(MOH5Ref, "href");
|
||||
|
||||
if (rootNode != NULL)
|
||||
aAttrib.put(rootNode);
|
||||
|
||||
std::string type_in = type;
|
||||
tolower(type);
|
||||
|
||||
//when name is missing, type becomes the input
|
||||
if (name.empty())
|
||||
name = type_in;
|
||||
|
||||
SPOSetBuilder* bb = 0;
|
||||
|
||||
//check if builder can be reused
|
||||
std::map<std::string, SPOSetBuilder*>::iterator bbit = spo_builders.find(name);
|
||||
if (bbit != spo_builders.end())
|
||||
{
|
||||
app_log() << "Reuse SpinorSetBuilder \"" << name << "\" type " << type_in << std::endl;
|
||||
app_log().flush();
|
||||
bb = (*bbit).second;
|
||||
return last_builder = bb;
|
||||
}
|
||||
|
||||
//assign last_builder
|
||||
bb = last_builder;
|
||||
|
||||
#if OHMMS_DIM == 3
|
||||
if (type.find("spline") < type.size())
|
||||
{
|
||||
name = type_in;
|
||||
#if defined(HAVE_EINSPLINE)
|
||||
PRE << "EinsplineSetBuilder: using libeinspline for B-spline spinors.\n";
|
||||
bb = new EinsplineSpinorSetBuilder(targetPtcl, ptclPool, myComm, rootNode);
|
||||
#else
|
||||
PRE.error("Einspline is missing for B-spline orbitals", true);
|
||||
#endif
|
||||
}
|
||||
else if (type == "molecularorbital" || type == "mo")
|
||||
{
|
||||
APP_ABORT("Spinors in LCAO type basis sets are not currently working. Contact a developer\n");
|
||||
// ParticleSet* ions = 0;
|
||||
//initialize with the source tag
|
||||
// PtclPoolType::iterator pit(ptclPool.find(sourceOpt));
|
||||
// if (pit == ptclPool.end())
|
||||
// PRE.error("Missing basisset/@source.", true);
|
||||
// else
|
||||
// ions = (*pit).second;
|
||||
#if defined(ENABLE_SOA)
|
||||
// bb = new LCAOrbitalBuilder(targetPtcl, *ions, myComm, rootNode);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
#endif //OHMMS_DIM==3
|
||||
PRE.flush();
|
||||
|
||||
if (bb == 0)
|
||||
APP_ABORT_TRACE(__FILE__, __LINE__, "SpinorSetBuilderFactory::createSPOSetBuilder\n SpinorSetBuilder creation failed.");
|
||||
|
||||
if (bb == last_builder)
|
||||
app_log() << " Missing both \"@name\" and \"@type\". Use the last SpinorSetBuilder." << std::endl;
|
||||
else
|
||||
{
|
||||
app_log() << " Created SpinorSetBuilder named '" << name << "' of type " << type << std::endl;
|
||||
spo_builders[name] = bb; //use name, if missing type is used
|
||||
}
|
||||
last_builder = bb;
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace qmcplusplus
|
|
@ -1,45 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// This file is distributed under the University of Illinois/NCSA Open Source License.
|
||||
// See LICENSE file in top directory for details.
|
||||
//
|
||||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
|
||||
//
|
||||
// File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
|
||||
// Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
|
||||
// Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
|
||||
// Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
|
||||
//
|
||||
// File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef QMCPLUSPLUS_SPINORBASISSETFACTORY_H
|
||||
#define QMCPLUSPLUS_SPINORBASISSETFACTORY_H
|
||||
|
||||
#include "QMCWaveFunctions/WaveFunctionComponentBuilder.h"
|
||||
#include "QMCWaveFunctions/SPOSetBuilder.h"
|
||||
#include "QMCWaveFunctions/SPOSetBuilderFactory.h"
|
||||
|
||||
/** @file SpinorSetBuilderFactory.h
|
||||
* This class derives from SPOSetBuilderFactory. It's purpose is to override createSPOSetBuilder so that
|
||||
* spinor appropriate factories can be parsed and called. Example, <spinorset_builder> knows to route einspline
|
||||
* construction through EinsplineSpinorSetBuilder as oppposed to EinsplineSetBuilder.
|
||||
*/
|
||||
|
||||
namespace qmcplusplus
|
||||
{
|
||||
|
||||
class SpinorSetBuilderFactory : public SPOSetBuilderFactory
|
||||
{
|
||||
public:
|
||||
typedef std::map<std::string, ParticleSet*> PtclPoolType;
|
||||
|
||||
|
||||
SpinorSetBuilderFactory(Communicate* comm, ParticleSet& els, PtclPoolType& psets);
|
||||
|
||||
~SpinorSetBuilderFactory(){};
|
||||
SPOSetBuilder* createSPOSetBuilder(xmlNodePtr rootNode);
|
||||
|
||||
};
|
||||
} // namespace qmcplusplus
|
||||
#endif
|
|
@ -91,11 +91,6 @@ bool WaveFunctionFactory::build(xmlNodePtr cur, bool buildtree)
|
|||
SPOSetBuilderFactory factory(myComm, *targetPtcl, ptclPool);
|
||||
factory.build_sposet_collection(cur);
|
||||
}
|
||||
else if (cname == "spinorset_builder")
|
||||
{
|
||||
SpinorSetBuilderFactory basisFactory(myComm, *targetPtcl, ptclPool);
|
||||
basisFactory.build_sposet_collection(cur);
|
||||
}
|
||||
else if (cname == WaveFunctionComponentBuilder::detset_tag)
|
||||
{
|
||||
success = addFermionTerm(cur);
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "QMCWaveFunctions/TrialWaveFunction.h"
|
||||
#include "QMCWaveFunctions/WaveFunctionComponentBuilder.h"
|
||||
#include "QMCWaveFunctions/SPOSetBuilderFactory.h"
|
||||
#include "QMCWaveFunctions/SpinorSetBuilderFactory.h"
|
||||
#include "Message/MPIObjectBase.h"
|
||||
namespace qmcplusplus
|
||||
{
|
||||
|
|
|
@ -369,11 +369,11 @@ TEST_CASE("Einspline SpinorSet from HDF", "[wavefunction]")
|
|||
|
||||
|
||||
const char* particles = "<tmp> \
|
||||
<spinorset_builder name=\"A\" type=\"bspline\" href=\"o2_45deg_spins.pwscf.h5\" tilematrix=\"1 0 0 0 1 0 0 0 1\" twistnum=\"0\" source=\"ion\" size=\"3\" precision=\"float\"> \
|
||||
<spinorset name=\"myspo\" size=\"3\"> \
|
||||
<sposet_builder name=\"A\" type=\"spinorbspline\" href=\"o2_45deg_spins.pwscf.h5\" tilematrix=\"1 0 0 0 1 0 0 0 1\" twistnum=\"0\" source=\"ion\" size=\"3\" precision=\"float\"> \
|
||||
<sposet name=\"myspo\" size=\"3\"> \
|
||||
<occupation mode=\"ground\"/> \
|
||||
</spinorset> \
|
||||
</spinorset_builder> \
|
||||
</sposet> \
|
||||
</sposet_builder> \
|
||||
</tmp> \
|
||||
";
|
||||
|
||||
|
|
|
@ -63,11 +63,11 @@
|
|||
</group>
|
||||
</particleset>
|
||||
<wavefunction name="psi0" target="e">
|
||||
<spinorset_builder name="A" type="bspline" href="eshdf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" size="12">
|
||||
<spinorset name="myspo" size="12">
|
||||
<sposet_builder name="A" type="spinorbspline" href="eshdf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" size="12">
|
||||
<sposet name="myspo" size="12">
|
||||
<occupation mode="ground"/>
|
||||
</spinorset>
|
||||
</spinorset_builder>
|
||||
</sposet>
|
||||
</sposet_builder>
|
||||
<determinantset>
|
||||
<slaterdeterminant>
|
||||
<determinant id="updetA" group="u" sposet="myspo" size="12"/>
|
||||
|
|
Loading…
Reference in New Issue