Merge branch 'develop' into opt-momentum-estimator

This commit is contained in:
Paul R. C. Kent 2018-01-05 09:39:20 -05:00 committed by GitHub
commit 921b3372c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 205 additions and 24 deletions

73
manual/ionwf.tex Normal file
View File

@ -0,0 +1,73 @@
\section{Gaussian Product Wavefunction}
\label{sec:ionwf}
The Gaussian Product wavefunction implements eq.~\ref{eq:gauss_prod_wf}
\begin{equation}
\Psi(\vec{R}) = \prod_{i=1}^N \exp\left[ -\frac{(\vec{R}_i-\vec{R}_i^o)^2}{2\sigma_i^2} \right]
\label{eq:gauss_prod_wf},
\end{equation}
where $\vec{R}_i$ is the position of the $i^{\text{th}}$ quantum particle and $\vec{R}_i^o$ is its center. $\sigma_i$ is the width of the Gaussian orbital around center $i$.
This variational wavefunction enhances single-particle density at chosen spatial locations with adjustable strengths. It is useful whenever such localization is physically relevant yet not captured by other parts of the trial wavefunction. For example, in an electron-ion simulation of a solid, the ions are localized around their crystal lattice sites. This single-particle localization is not captured by the ion-ion Jastrow. Therefore the addition of this localization term will improve the wavefunction. The simplest use case of this wavefunction is perhaps the quantum harmonic oscillator (please see the ``tests/models/sho'' folder for examples).
\subsubsection{Input Specification}
\begin{table}[h]
\begin{center}
\begin{tabular}{l c c c l }
\hline
\multicolumn{5}{l}{Gaussian Product Wavefunction (ionwf)} \\
\hline
\bfseries name & \bfseries datatype & \bfseries values & \bfseries defaults & \bfseries description \\
\hline
name & text & ionwf & (required) & Unique name for this wavefunction \\
width & floats & 1.0 -1 & (required) & Widths of Gaussian orbitals.\\
source & text & ion0 & (required) & Name of classical particle set.\\
\hline
\end{tabular}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item \texttt{width} There must be one width provided for each quantum particle. If a negative width is given, then its corresponding Gaussian orbital is removed. Negative width is useful if one wants to use Gaussian wavefunction for a subset of the quantum particles.
\item \texttt{source} The Gaussian centers must be specified in the form of a classical particle set. This classical particle set is likely the ion positions ``ion0'', hence the name ``ionwf''. However, one may define arbitrary centers using a different particle set. Please refer to examples in `tests/models/sho'.
\end{itemize}
\subsection{Example Use Case}
\begin{lstlisting}
<qmcsystem>
<simulationcell>
<parameter name="bconds">
n n n
</parameter>
</simulationcell>
<particleset name="e">
<group name="u" size="1">
<parameter name="mass">5.0</parameter>
<attrib name="position" datatype="posArray" condition="0">
0.0001 -0.0001 0.0002
</attrib>
</group>
</particleset>
<particleset name="ion0" size="1">
<group name="H">
<attrib name="position" datatype="posArray" condition="0">
0 0 0
</attrib>
</group>
</particleset>
<wavefunction target="e" id="psi0">
<ionwf name="iwf" source="ion0" width="0.8165"/>
</wavefunction>
<hamiltonian name="h0" type="generic" target="e">
<extpot type="HarmonicExt" mass="5.0" energy="0.3"/>
<estimator type="latticedeviation" name="latdev"
target="e" tgroup="u"
source="ion0" sgroup="H"/>
</hamiltonian>
</qmcsystem>
\end{lstlisting}

View File

@ -172,6 +172,7 @@
\input{multideterminants}
\input{backflow}
\input{fdlr}
\input{ionwf}
\input{hamiltonianobservable}

View File

@ -22,13 +22,13 @@ typedef IonOrbital::ValueType ValueType;
typedef IonOrbital::GradType GradType;
IonOrbital::IonOrbital (ParticleSet &centers, ParticleSet &ptcls) :
CenterRef(centers), PtclRef(ptcls)
CenterRef(centers)
{
Optimizable=false;
OrbitalName="IonOrbital";
NumTargetPtcls = ptcls.getTotalNum();
NumCenters = centers.getTotalNum();
d_table = DistanceTable::add(CenterRef, PtclRef, DT_AOS);
myTableID=ptcls.addTable(CenterRef,DT_AOS);
U.resize(NumTargetPtcls);
dU.resize(NumTargetPtcls);
d2U.resize(NumTargetPtcls);
@ -36,20 +36,14 @@ IonOrbital::IonOrbital (ParticleSet &centers, ParticleSet &ptcls) :
LastAddressOfdU = FirstAddressOfdU + dU.size()*OHMMS_DIM;
}
IonOrbital::~IonOrbital() { }
IonOrbital::~IonOrbital() { }
//evaluate the distance table with P
void
IonOrbital::resetTargetParticleSet(ParticleSet& P)
{
d_table = DistanceTable::add(CenterRef,P, DT_AOS);
//if (dPsi) dPsi->resetTargetParticleSet(P);
}
void IonOrbital::resetTargetParticleSet(ParticleSet& P) { }
void IonOrbital::checkInVariables(opt_variables_type& active) { }
void IonOrbital::checkOutVariables(const opt_variables_type& active) { }
void IonOrbital::resetParameters(const opt_variables_type& active) { }
void IonOrbital::reportStatus(std::ostream& os) { }
void IonOrbital::reportStatus(std::ostream& os) { }
/**
*@param P input configuration containing N particles
@ -70,13 +64,14 @@ IonOrbital::evaluateLog(ParticleSet& P,
ParticleSet::ParticleGradient_t& G,
ParticleSet::ParticleLaplacian_t& L)
{
const auto &d_table=P.DistTables[myTableID];
int icent = 0;
LogValue = 0.0;
//P.update();
//CenterRef.update();
//d_table->evaluate(PtclRef);
for (int iat=0; iat<NumTargetPtcls; iat++)
{
U[iat] = 0.0;
dU[iat] = 0.0;
d2U[iat] = 0.0;
RealType a = ParticleAlpha[iat];
if (a > 0.0)
{
@ -108,6 +103,7 @@ IonOrbital::evaluate(ParticleSet& P,
ValueType
IonOrbital::ratio(ParticleSet& P, int iat)
{
const auto &d_table=P.DistTables[myTableID];
int icent = ParticleCenter[iat];
if (icent == -1)
return 1.0;
@ -121,6 +117,7 @@ IonOrbital::ratio(ParticleSet& P, int iat)
GradType
IonOrbital::evalGrad(ParticleSet& P, int iat)
{
const auto &d_table=P.DistTables[myTableID];
int icent = ParticleCenter[iat];
if (icent == -1)
return GradType();
@ -142,6 +139,7 @@ IonOrbital::evalGrad(ParticleSet& P, int iat)
ValueType
IonOrbital::ratioGrad(ParticleSet& P, int iat, GradType& grad_iat)
{
const auto &d_table=P.DistTables[myTableID];
int icent = ParticleCenter[iat];
if (icent == -1)
return 1.0;
@ -170,6 +168,7 @@ IonOrbital::evaluateLogAndStore(ParticleSet& P,
ParticleSet::ParticleGradient_t& dG,
ParticleSet::ParticleLaplacian_t& dL)
{
const auto &d_table=P.DistTables[myTableID];
int icent = 0;
LogValue = 0.0;
U=0.0;

View File

@ -32,8 +32,10 @@ private:
ParticleAttrib<RealType> U,d2U;
ParticleAttrib<PosType> dU;
RealType *FirstAddressOfdU, *LastAddressOfdU;
DistanceTableData* d_table;
ParticleSet &CenterRef, &PtclRef;
///table index
int myTableID;
///orbital centers
ParticleSet &CenterRef;
int NumTargetPtcls, NumCenters;
RealType curVal, curLap;
PosType curGrad;

View File

@ -28,6 +28,8 @@ bool
IonOrbitalBuilder:: put(xmlNodePtr cur)
{
ParticleSet &p = targetPtcl;
// initialize widths to zero; if no user input, then abort
widthOpt.resize(targetPtcl.getTotalNum(), 0);
OhmmsAttributeSet oAttrib;
oAttrib.add(sourceOpt, "source");
oAttrib.add(nameOpt, "name" );
@ -36,20 +38,12 @@ IonOrbitalBuilder:: put(xmlNodePtr cur)
if(nameOpt == "")
{
app_warning() << " IonOrbitalBuilder::put does not have name "<< std::endl;
return false;
}
if (!widthOpt.size())
{
app_error() << " You must specify the \"width\" attribute to "
<< " an ionwf.";
abort();
}
std::map<std::string,ParticleSet*>::iterator pa_it(ptclPool.find(sourceOpt));
if(pa_it == ptclPool.end())
{
app_error() << "Could not file source ParticleSet "
<< sourceOpt << " for ion wave function.\n";
return false;
}
ParticleSet* sourcePtcl= (*pa_it).second;
IonOrbital *orb = new IonOrbital (*sourcePtcl, targetPtcl);

View File

@ -1,5 +1,6 @@
SUBDIRS(converter)
SUBDIRS(estimator)
SUBDIRS(models)
SUBDIRS(io)
SUBDIRS(performance)

View File

@ -0,0 +1,20 @@
LIST(APPEND SHO_SCALARS "totenergy" "0.45 0")
LIST(APPEND SHO_SCALARS "kinetic" "0.225 0")
LIST(APPEND SHO_SCALARS "potential" "0.225 0")
LIST(APPEND SHO_SCALARS "latdev" "1.0 0")
QMC_RUN_AND_CHECK(short-sho-vmc
"${CMAKE_SOURCE_DIR}/tests/models/sho"
m5
vmc_sho.xml
1 16
TRUE
0 BCC_H_SCALARS # VMC
)
SIMPLE_RUN_AND_CHECK(short-sho-grad_lap
"${CMAKE_SOURCE_DIR}/tests/models/sho"
grad_lap.xml
1 1
../../solids/bccH_3x3x3_ae/short-bccH_3x3x3_ae-deriv-1-1/check_grad_lap.py
)

View File

@ -0,0 +1,42 @@
<simulation>
<project id="m5" series="0"/>
<qmcsystem>
<simulationcell>
<parameter name="lattice" units="bohr">
10 0 0
0 10 0
0 0 10
</parameter>
<parameter name="bconds">
p p p
</parameter>
</simulationcell>
<particleset name="e">
<group name="m5" size="1">
<parameter name="mass"> 5.0 </parameter>
<attrib name="position" datatype="posArray" condition="0">
0.0001 -0.0001 0.0002
</attrib>
</group>
</particleset>
<particleset name="trap_center" size="1">
<group name="center">
<attrib name="position" datatype="posArray" condition="0">
0 0 0
</attrib>
</group>
</particleset>
<wavefunction target="e" id="psi0">
<ionwf name="proton_wf" source="trap_center" width="0.816496580927726"/>
</wavefunction>
<hamiltonian name="h0" type="generic" target="e">
<extpot type="HarmonicExt" mass="5.0" energy="0.3"/>
</hamiltonian>
</qmcsystem>
<qmc method="wftest"/>
</simulation>

View File

@ -0,0 +1,49 @@
<simulation>
<project id="m5" series="0"/>
<qmcsystem>
<simulationcell>
<parameter name="lattice" units="bohr">
10 0 0
0 10 0
0 0 10
</parameter>
<parameter name="bconds">
p p p
</parameter>
</simulationcell>
<particleset name="e">
<group name="m5" size="1">
<parameter name="mass"> 5.0 </parameter>
<attrib name="position" datatype="posArray" condition="0">
0.0001 0.0001 0.0002
</attrib>
</group>
</particleset>
<particleset name="trap_center" size="1">
<group name="center">
<attrib name="position" datatype="posArray" condition="0">
0 0 0
</attrib>
</group>
</particleset>
<wavefunction target="e" id="psi0">
<ionwf name="ionwf" source="trap_center" width="0.816496580927726"/>
</wavefunction>
<hamiltonian name="h0" type="generic" target="e">
<extpot type="HarmonicExt" mass="5.0" energy="0.3"/>
<estimator name="skinetic" type="specieskinetic"/>
<estimator type="latticedeviation" name="latdev" hdf5="no" per_xyz="no" target="e" tgroup="m5" source="trap_center" sgroup="center"/>
</hamiltonian>
</qmcsystem>
<qmc method="vmc" move="not_pbyp_or_whatever">
<parameter name="blocks"> 256 </parameter>
<parameter name="steps"> 2 </parameter>
<parameter name="substeps"> 2 </parameter>
<parameter name="timestep"> 2.0 </parameter>
</qmc>
</simulation>