#include <QMCSlater.h>
Public Member Functions | |
QMCSlater () | |
Creates an uninitialized instance of the object. | |
~QMCSlater () | |
Deallocates all memory used by the object. | |
void | initialize (QMCInput *input, int startEl, int stopEl, bool isAlpha) |
Initializes the class and sets which region of the dimensional electronic configuration corresponds to electrons in these Slater determinants. | |
void | evaluate (Array1D< Array2D< double > * > &X, int num, int start, int whichE) |
Evaluates the Slater determinants and their first two derivatives at X. | |
void | update_Ds (Array1D< QMCWalkerData * > &walkerData) |
Calling this function will wrap up the evaluation by unloading results from the GPU (if used) and then calculating the inverse. | |
template<class T> | |
bool | calculate_DerivativeRatios (int ci, int row, Array2D< double > &psi, Array2D< double > &inv, Array2D< T > &lap, Array2D< T > &gradx, Array2D< T > &grady, Array2D< T > &gradz, Array1D< double > &det, Array3D< double > &gradPR, Array1D< double > &lapPR) |
This method will have the inverse and derivative ratios calculated. | |
Array1D< double > * | getPsi (int i) |
Gets an array of values of the Slater determinants for the last evaluated electronic configuration. | |
Array3D< double > * | getGradPsiRatio (int i) |
Gets an array where each element is a ratio of the Slater determinant gradient over the Slater determinant for the last evaluated electronic configuration. | |
Array1D< double > * | getLaplacianPsiRatio (int i) |
Gets an array where each element is a ratio of the Slater determinant laplacian over the Slater determinant for the last evaluated electronic configuration. | |
Array2D< double > * | get_p_a (int walker, int ci) |
Partial derivatives of the Slater determinants with respect to orbital coefficients. | |
Array2D< double > * | get_p2_xa (int walker, int ci, int el, int xyz) |
Partial derivative once with respect to orbital coefficient, and once with respect to position. | |
Array2D< double > * | get_p3_xxa (int walker, int ci) |
Partial derivative once with respect to orbital coefficient, and twice with respect to position. | |
Array1D< double > * | getChiDensity (int i) |
Gets an array of the densities for the basis functions for the last evaluated electronic configuration. | |
bool | isSingular (int i) |
Returns true if the Slater determinant is singular and false otherwise. | |
void | operator= (const QMCSlater &rhs) |
Sets two QMCSlater objects equal. | |
Private Member Functions | |
void | allocateIteration (int whichE, int &start, int &stop) |
void | allocate () |
int | getNumberElectrons () |
Start and Stop are the indices in the electron coordinate array that this Slater determinant will include. | |
Private Attributes | |
bool | isAlpha |
Whether this set of Slater determinants refers to alpha for beta electrons. | |
QMCInput * | Input |
QMCBasisFunction * | BF |
QMCWavefunction * | WF |
Array1D< Array1D< Array2D < double > > > | p_a |
Data structures to store the partial derivatives with respect to orbital coefficients. | |
Array1D< Array3D< Array2D < double > > > | p2_xa |
Array1D< Array1D< Array2D < double > > > | p3_xxa |
int | Start |
The starting and stopping indices in the position array for the electrons this Slater is responsible for. | |
int | Stop |
QMCElectronNucleusCusp | ElectronNucleusCusp |
Array1D< Array2D< qmcfloat > > | Xw |
These arrays are where we store the basis functions Chi and their derivatives, evaluated for a particular electronic configuration. | |
Array1D< Array1D< Array2D < qmcfloat > > > | Xw_x |
Array1D< Array2D< qmcfloat > > | Xw_xx |
Array1D< Array1D< double > > | Xw_Density |
Array2D< double > * | ciDet |
The dimensions of these data are numWalkers, then numElec x numOrb. | |
Array1D< Array2D< qmcfloat > > | Dw |
Array2D< Array2D< qmcfloat > > | Dw_x |
Array1D< Array2D< qmcfloat > > | Dw_xx |
Array2D< Array2D< double > > | Dwc_inv |
Array1D< Array1D< double > > | Dwc |
These arrays are the local storage data that we use when we update all electrons at once. | |
Array1D< Array3D< double > > | rDwc_x |
Array1D< Array1D< double > > | rDwc_xx |
Array1D< Array1D< bool > > | Singular |
Array1D< Array1D< double > * > | pointer_Dwc |
If we are updating one electron at a time, then these pointers need to be set to the data stored in the associated QMCWalkerData. | |
Array1D< Array3D< double > * > | pointer_rDwc_x |
Array1D< Array1D< double > * > | pointer_rDwc_xx |
This class allows the functions, their gradients, and their laplacians to be calculated.
This class has now been modified to handle several electron configurations simultaneously. It will process (at most) WALKERS_PER_PASS walkers.
Definition at line 63 of file QMCSlater.h.
QMCSlater::QMCSlater | ( | ) |
QMCSlater::~QMCSlater | ( | ) |
Deallocates all memory used by the object.
Definition at line 281 of file QMCSlater.cpp.
References QMCFlags::calculate_bf_density, ciDet, Array1D< T >::deallocate(), Array2D< T >::deallocate(), Array1D< T >::dim1(), Dw, Dw_x, Dw_xx, Dwc, Dwc_inv, QMCInput::flags, QMCWavefunction::getNumberDeterminants(), Input, QMCFlags::optimize_Orbitals, p2_xa, p3_xxa, p_a, rDwc_x, rDwc_xx, Singular, Start, Stop, QMCFlags::walkers_per_pass, WF, Xw, Xw_Density, Xw_x, and Xw_xx.
void QMCSlater::initialize | ( | QMCInput * | input, | |
int | startEl, | |||
int | stopEl, | |||
bool | isAlpha | |||
) |
Initializes the class and sets which region of the dimensional electronic configuration corresponds to electrons in these Slater determinants.
It is assumed that all electrons in a determinant are grouped together in the configuration.
input | input data for the calculation | |
startEl | first particle in this determinant. | |
stopEl | last particle in this determinant. |
Definition at line 70 of file QMCSlater.cpp.
References allocate(), QMCInput::BF, BF, Array1D< T >::dim1(), ElectronNucleusCusp, QMCElectronNucleusCusp::fitReplacementOrbitals(), QMCInput::flags, QMCWavefunction::getCoeff(), getNumberElectrons(), QMCFlags::getNumGPUWalkers(), QMCElectronNucleusCusp::initialize(), Input, isAlpha, QMCFlags::replace_electron_nucleus_cusps, Singular, Start, Stop, QMCInput::WF, and WF.
Referenced by QMCSCFJastrow::initialize().
Evaluates the Slater determinants and their first two derivatives at X.
This function contains the meat of the QMC calculation.
X | dimensional configuration of electrons represented by a matrix |
num | how many configurations to process in the X array. | |
start | which index in X to start at | |
X | the array of electronic positions indexed by their walker | |
whichE | the index of the electron to move (-1 if all) |
D(numElec x numOrb) = Xw(numElec x numBasisFunction) * WF_coeffs(numBasisFunction x numOrb)
Note: the coefficient matricies are transposed. Hand-coded matrix multiplication is faster with a transposed matrix.
Definition at line 860 of file QMCSlater.cpp.
References allocateIteration(), BF, QMCFlags::calculate_bf_density, Dw, Dw_x, Dw_xx, ElectronNucleusCusp, QMCBasisFunction::evaluateBasisFunctions(), QMCInput::flags, QMCWavefunction::getCoeff(), QMCWavefunction::getNumberBasisFunctions(), getNumberElectrons(), Input, isAlpha, QMCFlags::replace_electron_nucleus_cusps, QMCElectronNucleusCusp::replaceCusps(), Stopwatch::reset(), showTimings, Stopwatch::start(), Stopwatch::stop(), Stop, Stopwatch::timeUS(), WF, Xw, Xw_Density, Xw_x, and Xw_xx.
Referenced by QMCSCFJastrow::calculate_CorrelatedSampling(), and QMCSCFJastrow::evaluate().
void QMCSlater::update_Ds | ( | Array1D< QMCWalkerData * > & | walkerData | ) |
Calling this function will wrap up the evaluation by unloading results from the GPU (if used) and then calculating the inverse.
The new idea here is to split all the work that the evaluate function used to do. This enables QMCSCFJastrow to control when the multiplication happens relative to the inverse.
Definition at line 386 of file QMCSlater.cpp.
References Array1D< T >::allocate(), calculate_DerivativeRatios(), Array2D< T >::deallocate(), Array1D< T >::deallocate(), Array2D< T >::dim1(), Array1D< T >::dim1(), Array2D< T >::dim2(), Dw, Dw_x, Dw_xx, Dwc, Dwc_inv, QMCInput::flags, Array2D< T >::gemm(), QMCWavefunction::getDataForCI(), QMCWavefunction::getNumberDeterminants(), getNumberElectrons(), QMCFlags::getNumGPUWalkers(), globalInput, Input, isAlpha, QMCFlags::one_e_per_iter, QMCFlags::optimize_Orbitals, p2_xa, p3_xxa, p_a, pointer_Dwc, pointer_rDwc_x, pointer_rDwc_xx, rDwc_x, rDwc_xx, Array2D< T >::setRows(), Singular, Start, Stop, QMCFlags::use_psuedopotential, WF, Xw, Xw_x, and Xw_xx.
Referenced by QMCSCFJastrow::calculate_CorrelatedSampling(), and QMCSCFJastrow::evaluate().
bool QMCSlater::calculate_DerivativeRatios | ( | int | ci, | |
int | row, | |||
Array2D< double > & | psi, | |||
Array2D< double > & | inv, | |||
Array2D< T > & | lap, | |||
Array2D< T > & | gradx, | |||
Array2D< T > & | grady, | |||
Array2D< T > & | gradz, | |||
Array1D< double > & | det, | |||
Array3D< double > & | gradPR, | |||
Array1D< double > & | lapPR | |||
) | [inline] |
This method will have the inverse and derivative ratios calculated.
ci | which determinant we are working on | |
row | if moving one electron per iteration, this is the row the current electron belongs to | |
psi | (input) Slater matrix | |
inv | (output) inverse of psi | |
lap | (input) laplacian of Slater | |
grad | (input) gradient of Slater | |
det | (output) determinant of psi | |
gradPR | (output) gradient of psi ratio | |
lapPR | (output) laplacian of psi ratio |
Definition at line 644 of file QMCSlater.cpp.
References Array2D< T >::allocate(), Array2D< T >::array(), Array3D< T >::array(), ciDet, Array2D< T >::determinant_and_inverse(), Array2D< T >::dim1(), Array2D< T >::dim2(), Array2D< T >::get(), QMCWavefunction::getDataForCI(), QMCWavefunction::getDeterminantSwaps(), QMCWavefunction::getNumberDeterminants(), getNumberElectrons(), QMCWavefunction::getOccupations(), Array2D< T >::inverseUpdateOneColumn(), Array2D< T >::inverseUpdateOneRow(), isAlpha, Array2D< T >::map(), and WF.
Referenced by update_Ds().
Array1D< double > * QMCSlater::getPsi | ( | int | i | ) |
Gets an array of values of the Slater determinants for the last evaluated electronic configuration.
The returned values are not normalized to one. Assuming the basis functions ued to make the determinant are normalized, the values can be normalized by dividing by , where is the number of electrons in the determinants.
i | of which walker we are requesting the information |
Definition at line 980 of file QMCSlater.cpp.
References Array1D< T >::allocate(), Array1D< T >::dim1(), Dwc, QMCWavefunction::getNumberDeterminants(), getNumberElectrons(), pointer_Dwc, and WF.
Referenced by QMCSCFJastrow::calculate_CorrelatedSampling(), and QMCSCFJastrow::calculate_Psi_quantities().
Array3D< double > * QMCSlater::getGradPsiRatio | ( | int | i | ) |
Gets an array where each element is a ratio of the Slater determinant gradient over the Slater determinant for the last evaluated electronic configuration.
These values do not depend on the normalization of the Slater determinant.
i | of which walker we are requesting the information |
Definition at line 1001 of file QMCSlater.cpp.
References getNumberElectrons(), and pointer_rDwc_x.
Referenced by QMCSCFJastrow::calculate_CorrelatedSampling(), and QMCSCFJastrow::calculate_Psi_quantities().
Array1D< double > * QMCSlater::getLaplacianPsiRatio | ( | int | i | ) |
Gets an array where each element is a ratio of the Slater determinant laplacian over the Slater determinant for the last evaluated electronic configuration.
These values do not depend on the normalization of the Slater determinant.
i | of which walker we are requesting the information |
Definition at line 994 of file QMCSlater.cpp.
References getNumberElectrons(), and pointer_rDwc_xx.
Referenced by QMCSCFJastrow::calculate_CorrelatedSampling(), and QMCSCFJastrow::calculate_Psi_quantities().
Array2D<double>* QMCSlater::get_p_a | ( | int | walker, | |
int | ci | |||
) | [inline] |
Partial derivatives of the Slater determinants with respect to orbital coefficients.
Definition at line 184 of file QMCSlater.h.
References p_a.
Referenced by QMCSCFJastrow::calculate_OrbitalDerivatives().
Array2D<double>* QMCSlater::get_p2_xa | ( | int | walker, | |
int | ci, | |||
int | el, | |||
int | xyz | |||
) | [inline] |
Partial derivative once with respect to orbital coefficient, and once with respect to position.
Definition at line 193 of file QMCSlater.h.
References p2_xa.
Referenced by QMCSCFJastrow::calculate_OrbitalDerivatives().
Array2D<double>* QMCSlater::get_p3_xxa | ( | int | walker, | |
int | ci | |||
) | [inline] |
Partial derivative once with respect to orbital coefficient, and twice with respect to position.
Definition at line 202 of file QMCSlater.h.
References p3_xxa.
Referenced by QMCSCFJastrow::calculate_OrbitalDerivatives().
Array1D< double > * QMCSlater::getChiDensity | ( | int | i | ) |
Gets an array of the densities for the basis functions for the last evaluated electronic configuration.
i | of which walker we are requesting the information |
Definition at line 1009 of file QMCSlater.cpp.
References getNumberElectrons(), and Xw_Density.
Referenced by QMCSCFJastrow::calculate_Psi_quantities().
bool QMCSlater::isSingular | ( | int | i | ) |
Returns true if the Slater determinant is singular and false otherwise.
i | of which walker we are requesting the information |
Definition at line 1017 of file QMCSlater.cpp.
References QMCWavefunction::getNumberDeterminants(), getNumberElectrons(), Singular, and WF.
Referenced by QMCSCFJastrow::calculate_Psi_quantities(), and QMCSCFJastrow::isSingular().
void QMCSlater::operator= | ( | const QMCSlater & | rhs | ) |
Sets two QMCSlater objects equal.
rhs | object to set this object equal to |
Definition at line 44 of file QMCSlater.cpp.
References allocate(), BF, QMCFlags::calculate_bf_density, Dw, Dwc, ElectronNucleusCusp, QMCInput::flags, Input, rDwc_x, rDwc_xx, QMCFlags::replace_electron_nucleus_cusps, Singular, Start, Stop, WF, and Xw_Density.
void QMCSlater::allocateIteration | ( | int | whichE, | |
int & | start, | |||
int & | stop | |||
) | [private] |
Definition at line 216 of file QMCSlater.cpp.
References Array2D< T >::allocate(), allocate(), Dw, Dw_x, Dw_xx, Dwc_inv, QMCInput::flags, QMCWavefunction::getNumberBasisFunctions(), QMCWavefunction::getNumberDeterminants(), getNumberElectrons(), QMCWavefunction::getNumberOrbitals(), globalInput, Input, isAlpha, QMCFlags::optimize_Orbitals, Start, Stop, QMCFlags::walkers_per_pass, WF, Xw, Xw_x, and Xw_xx.
Referenced by evaluate().
void QMCSlater::allocate | ( | ) | [private] |
Definition at line 106 of file QMCSlater.cpp.
References Array1D< T >::allocate(), Array2D< T >::allocate(), QMCFlags::calculate_bf_density, ciDet, Dw, Dw_x, Dw_xx, Dwc, Dwc_inv, QMCInput::flags, QMCWavefunction::getNumberBasisFunctions(), QMCWavefunction::getNumberDeterminants(), getNumberElectrons(), QMCFlags::getNumGPUWalkers(), Input, QMCFlags::optimize_Orbitals, p2_xa, p3_xxa, p_a, pointer_Dwc, pointer_rDwc_x, pointer_rDwc_xx, rDwc_x, rDwc_xx, Singular, QMCFlags::walkers_per_pass, WF, and Xw_Density.
Referenced by allocateIteration(), initialize(), and operator=().
int QMCSlater::getNumberElectrons | ( | ) | [inline, private] |
Start and Stop are the indices in the electron coordinate array that this Slater determinant will include.
Therefore, the number of electrons is Stop - Start + 1.
Definition at line 368 of file QMCSlater.h.
Referenced by allocate(), allocateIteration(), calculate_DerivativeRatios(), evaluate(), getChiDensity(), getGradPsiRatio(), getLaplacianPsiRatio(), getPsi(), initialize(), isSingular(), and update_Ds().
bool QMCSlater::isAlpha [private] |
Whether this set of Slater determinants refers to alpha for beta electrons.
Definition at line 236 of file QMCSlater.h.
Referenced by allocateIteration(), calculate_DerivativeRatios(), evaluate(), initialize(), and update_Ds().
QMCInput* QMCSlater::Input [private] |
Definition at line 238 of file QMCSlater.h.
Referenced by allocate(), allocateIteration(), evaluate(), initialize(), operator=(), update_Ds(), and ~QMCSlater().
QMCBasisFunction* QMCSlater::BF [private] |
Definition at line 239 of file QMCSlater.h.
Referenced by evaluate(), initialize(), and operator=().
QMCWavefunction* QMCSlater::WF [private] |
Definition at line 240 of file QMCSlater.h.
Referenced by allocate(), allocateIteration(), calculate_DerivativeRatios(), evaluate(), getPsi(), initialize(), isSingular(), operator=(), update_Ds(), and ~QMCSlater().
Array1D< Array1D< Array2D<double> > > QMCSlater::p_a [private] |
Data structures to store the partial derivatives with respect to orbital coefficients.
Definition at line 246 of file QMCSlater.h.
Referenced by allocate(), get_p_a(), update_Ds(), and ~QMCSlater().
Array1D< Array3D< Array2D<double> > > QMCSlater::p2_xa [private] |
Definition at line 247 of file QMCSlater.h.
Referenced by allocate(), get_p2_xa(), update_Ds(), and ~QMCSlater().
Array1D< Array1D< Array2D<double> > > QMCSlater::p3_xxa [private] |
Definition at line 248 of file QMCSlater.h.
Referenced by allocate(), get_p3_xxa(), update_Ds(), and ~QMCSlater().
int QMCSlater::Start [private] |
The starting and stopping indices in the position array for the electrons this Slater is responsible for.
Definition at line 254 of file QMCSlater.h.
Referenced by allocateIteration(), getNumberElectrons(), initialize(), operator=(), QMCSlater(), update_Ds(), and ~QMCSlater().
int QMCSlater::Stop [private] |
Definition at line 255 of file QMCSlater.h.
Referenced by allocateIteration(), evaluate(), getNumberElectrons(), initialize(), operator=(), QMCSlater(), update_Ds(), and ~QMCSlater().
Definition at line 257 of file QMCSlater.h.
Referenced by evaluate(), initialize(), and operator=().
Array1D< Array2D<qmcfloat> > QMCSlater::Xw [private] |
These arrays are where we store the basis functions Chi and their derivatives, evaluated for a particular electronic configuration.
The 'X' is meant to look like Chi The w denotes the walker indexing.
Definition at line 267 of file QMCSlater.h.
Referenced by allocateIteration(), evaluate(), update_Ds(), and ~QMCSlater().
Array1D< Array1D< Array2D<qmcfloat> > > QMCSlater::Xw_x [private] |
Definition at line 268 of file QMCSlater.h.
Referenced by allocateIteration(), evaluate(), update_Ds(), and ~QMCSlater().
Array1D< Array2D<qmcfloat> > QMCSlater::Xw_xx [private] |
Definition at line 269 of file QMCSlater.h.
Referenced by allocateIteration(), evaluate(), update_Ds(), and ~QMCSlater().
Array1D< Array1D<double> > QMCSlater::Xw_Density [private] |
Definition at line 270 of file QMCSlater.h.
Referenced by allocate(), evaluate(), getChiDensity(), operator=(), and ~QMCSlater().
Array2D< double >* QMCSlater::ciDet [private] |
The dimensions of these data are numWalkers, then numElec x numOrb.
These data: D, D_inv, Laplacian_D, and Grad_D are meant to hold only the results that were calculated on the CPU
D_inv is the only one that can be in double since we'll explicitly typecast D before inversion.
The w denotes the walker indexing.
Definition at line 283 of file QMCSlater.h.
Referenced by allocate(), calculate_DerivativeRatios(), and ~QMCSlater().
Array1D< Array2D<qmcfloat> > QMCSlater::Dw [private] |
Definition at line 284 of file QMCSlater.h.
Referenced by allocate(), allocateIteration(), evaluate(), operator=(), update_Ds(), and ~QMCSlater().
Array2D< Array2D<qmcfloat> > QMCSlater::Dw_x [private] |
Definition at line 285 of file QMCSlater.h.
Referenced by allocate(), allocateIteration(), evaluate(), update_Ds(), and ~QMCSlater().
Array1D< Array2D<qmcfloat> > QMCSlater::Dw_xx [private] |
Definition at line 286 of file QMCSlater.h.
Referenced by allocate(), allocateIteration(), evaluate(), update_Ds(), and ~QMCSlater().
Array2D< Array2D<double> > QMCSlater::Dwc_inv [private] |
Definition at line 287 of file QMCSlater.h.
Referenced by allocate(), allocateIteration(), update_Ds(), and ~QMCSlater().
Array1D< Array1D<double> > QMCSlater::Dwc [private] |
These arrays are the local storage data that we use when we update all electrons at once.
The r prefix indicates that the data has been divided by the determinant.
The w denotes the walker indexing. The c denotes the determinant indexing.
Definition at line 299 of file QMCSlater.h.
Referenced by allocate(), getPsi(), operator=(), update_Ds(), and ~QMCSlater().
Array1D< Array3D<double> > QMCSlater::rDwc_x [private] |
Definition at line 300 of file QMCSlater.h.
Referenced by allocate(), operator=(), update_Ds(), and ~QMCSlater().
Array1D< Array1D<double> > QMCSlater::rDwc_xx [private] |
Definition at line 301 of file QMCSlater.h.
Referenced by allocate(), operator=(), update_Ds(), and ~QMCSlater().
Array1D< Array1D<bool> > QMCSlater::Singular [private] |
Definition at line 302 of file QMCSlater.h.
Referenced by allocate(), initialize(), isSingular(), operator=(), update_Ds(), and ~QMCSlater().
Array1D< Array1D<double> * > QMCSlater::pointer_Dwc [private] |
If we are updating one electron at a time, then these pointers need to be set to the data stored in the associated QMCWalkerData.
If we are updating all together, then these pointers will be set to our local QMCSlater data.
The reason we have two choices for storage location is because it will change how much memory we need. If we update all at once, then we don't need to save intermediate data between iterations, so we can just save everything right in QMCSlater, a class for which there are only 2 instances for the entire calculation.
If we only update one at a time, then we need a per walker storage location.
Definition at line 322 of file QMCSlater.h.
Referenced by allocate(), getPsi(), and update_Ds().
Array1D< Array3D<double> * > QMCSlater::pointer_rDwc_x [private] |
Definition at line 323 of file QMCSlater.h.
Referenced by allocate(), getGradPsiRatio(), and update_Ds().
Array1D< Array1D<double> * > QMCSlater::pointer_rDwc_xx [private] |
Definition at line 324 of file QMCSlater.h.
Referenced by allocate(), getLaplacianPsiRatio(), and update_Ds().