1 /* Copyright (c) 2015 Gerald Knizia 2 * 3 * This file is part of the IboView program (see: http://www.iboview.org) 4 * 5 * IboView is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, version 3. 8 * 9 * IboView is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with bfint (LICENSE). If not, see http://www.gnu.org/licenses/ 16 * 17 * Please see IboView documentation in README.txt for: 18 * -- A list of included external software and their licenses. The included 19 * external software's copyright is not touched by this agreement. 20 * -- Notes on re-distribution and contributions to/further development of 21 * the IboView software 22 */ 23 24 #ifndef CT_DFTI_H 25 #define CT_DFTI_H 26 27 #include "CxTypes.h" 28 #include "CxDefs.h" 29 #include "CtDftGrid.h" 30 #include "CtDft.h" 31 #include "CtIo.h" 32 #include "CtTiming.h" 33 #include "CtBasisSet.h" 34 35 namespace dfti { 36 37 enum FDftiFlags { 38 DFTI_AuxiliaryExpand = 0x01, 39 DFTI_MakeXc = 0x02, 40 DFTI_MakeGradient = 0x04, 41 DFTI_MakeGridGradient = 0x08, // in the case of a gradient computation, include the gradient of the integration grid. 42 DFTI_MeasureTime = 0x10 43 }; 44 45 46 struct FDftiArgs 47 { 48 uint32_t 49 Flags; // combination of DFTI_*. 50 51 // energies, energy gradients, and triangular fock matrices (output) or Fock potential expansion coefficients. 52 double *pDfuEnergies; double *pGradient; double *pFockC; double *pFockO; 53 // triangular density matrices (input) in case of regular XC, expansion coefficients 54 // in terms of auxiliary basis in other case. 55 // if pDenO == 0, open-shell contributions are not evaluated. 56 double *pDenC; double *pDenO; 57 double *pOccOrbC; double *pOccOrbO; 58 size_t nOccC; size_t nOccO; 59 60 // basis over which the orbitals are expanded (regular) or auxiliary basis. 61 ct::FRawBasis *pBasis; 62 63 // the functional. 64 ct::FXcFunctional *pXcFn; 65 66 // integration grid. 67 ct::FDftGrid const *pDftGrid; 68 69 double ThrOrb; double LogThrOrb; // threshold for orbital-on-grid screening 70 71 double *pTimings; 72 double *pfElecTotal; 73 public: OpenShellFDftiArgs74 bool OpenShell() const { return pDenO != 0; }; MakeGradientFDftiArgs75 bool MakeGradient() const { return Flags & DFTI_MakeGradient; }; MakeXcFDftiArgs76 bool MakeXc() const { return Flags & DFTI_MakeXc; }; MakeGridGradientFDftiArgs77 bool MakeGridGradient() const { return Flags & DFTI_MakeGridGradient; } UseAuxiliaryExpansionFDftiArgs78 bool UseAuxiliaryExpansion() const { return Flags & DFTI_AuxiliaryExpand; }; MeasureTimeFDftiArgs79 bool MeasureTime() const { return Flags & DFTI_MeasureTime; } NeedTauFDftiArgs80 bool NeedTau() const { return pXcFn->NeedTau(); } NeedSigmaFDftiArgs81 bool NeedSigma() const { return pXcFn->NeedSigma(); } nBfFDftiArgs82 size_t nBf() const { return pBasis->nFn(); }; // number of basis functions in pBasis nCentersFDftiArgs83 size_t nCenters() const { return pBasis->nCen(); }; // number of centers (required to determine gradient dimension) nFockSizeFDftiArgs84 size_t nFockSize() const { 85 size_t nBf_ = nBf(); 86 if (UseAuxiliaryExpansion()) 87 return nBf_; 88 else 89 return (nBf_*(nBf_+1))/2; 90 } 91 }; 92 93 void AccXc(FDftiArgs &Args, ct::FLog &Log, ct::FMemoryStack &Mem_); 94 void IrEvalBfn(double *pOrbValAo, size_t *pMap, size_t &nMap, double const *pGridPt, size_t iStGridPt, size_t nGridPt, uint nDiff, ct::FRawBasis const *pBasis, double ThrOrb, double LogThrOrb, ct::FMemoryStack &Mem); 95 96 97 } // namespace dfti 98 99 100 #endif // CT_DFTI_H 101