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 // this file exists for the sole purpose of avoiding circular header dependencies.
25 #ifndef CT_RHF_OPTIONS_H
26 #define CT_RHF_OPTIONS_H
27 
28 #include <string>
29 #include "CtDftGrid.h" // for grid params.
30 
31 namespace ct {
32 
33 struct FWfDecl
34 {
35    uint nElec, Ms2;
36 
nElecAFWfDecl37    uint nElecA() const { return (nElec + Ms2)/2; }
nElecBFWfDecl38    uint nElecB() const { return (nElec - Ms2)/2; }
nOpenFWfDecl39    uint nOpen() const { return Ms2; } // nOccA - nOccB
nClosedFWfDecl40    uint nClosed() const { return nElecB(); } // nOccA - nOccB
41 
FWfDeclFWfDecl42    FWfDecl() : nElec(0), Ms2(0) {}
43    explicit FWfDecl(uint nElec_, uint Ms2_=0)
nElecFWfDecl44       : nElec(nElec_), Ms2(Ms2_)
45    {}
46 };
47 
48 enum FXcAlgo {
49    XCALGO_Regular, // standard computation of xc contributions, with full density.
50    XCALGO_AuxiliaryExpand, // computation of xc contributions via auxiliary expansion of density computed in Coulomb.
51    XCALGO_Gridless  // DFT without meshes and grids.
52 };
53 
54 enum FJkAlgo {
55    JKALGO_DfRhf, // regular density fitted RHF
56    JKALGO_DfCoulombOnly, // regular density fitted RKS with pure functionals
57    JKALGO_DfCoulombOnlyCache3ix // for small molecules: attempt to cache *all* 3ix integrals in memory.
58 };
59 
60 enum FHfComputeFlags {
61    COMPUTE_Gradient = 0x01, // compute analytic gradient?
62    COMPUTE_IboAnalysis = 0x02
63 };
64 
65 
66 struct FHfOptions {
67    double
68       ThrOrb, ThrDen; // threshold for orbital gradient (residual) and energy change, respectively
69    uint
70       MaxIt; // maximum number of iterations.
71 
72 //    double
73 //       ExactExchFactor; // prefactor for exact exchange. If 0, no exact exchange is computed.
74    FXcAlgo
75       // how to compute xc functional contributions, provided that an xc functional is set.
76       XcAlgo;
77    FJkAlgo
78       // how to compute coulomb and exact exchange contributions.
79       JkAlgo;
80    uint32_t
81       // decides on what we compute (COMPFLAG_*).
82       ComputeFlags;
83    double
84       LevelShifts[2]; // [0]: for closed shells, [1]: for occupied open shells.
85 
86    std::string
87       XcFunctionalName;
88    FDftGridParams
89       DftGridParams,
90       DftGridParamsRefine;
91    bool
92       // if set, switch to FinalGrid after convergence and make one more iteration.
93       UseRefineGrid;
94 
95    explicit FHfOptions(double ThrOrb_=1e-5, double ThrDen_=1e-6, uint MaxIt_=120)
ThrOrbFHfOptions96       : ThrOrb(ThrOrb_), ThrDen(ThrDen_), MaxIt(MaxIt_),
97         XcAlgo(XCALGO_Regular), JkAlgo(JKALGO_DfRhf), ComputeFlags(0),
98         XcFunctionalName(""), UseRefineGrid(false)
99    {
100       LevelShifts[0] = -0.4;
101       LevelShifts[1] = -0.2;
102    }
103 };
104 
105 } // namespace ct
106 
107 
108 #endif // CT_RHF_OPTIONS_H
109