JDFTx  1.1.1
InverseKohnSham.h
1 /*-------------------------------------------------------------------
2 Copyright 2012 Ravishankar Sundararaman
3 
4 This file is part of JDFTx.
5 
6 JDFTx is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 JDFTx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
18 -------------------------------------------------------------------*/
19 
20 #ifndef JDFTX_ELECTRONIC_INVERSEKOHNSHAM_H
21 #define JDFTX_ELECTRONIC_INVERSEKOHNSHAM_H
22 
23 #include <core/Minimize.h>
24 #include <core/ScalarFieldArray.h>
25 #include <electronic/common.h>
26 
27 class InverseKohnSham : public Minimizable<ScalarFieldArray>
28 {
29 public:
31 
32  //Interface for minimize:
33  void step(const ScalarFieldArray& dir, double alpha);
34  double compute(ScalarFieldArray* grad);
36  void constrain(ScalarFieldArray& dir);
37  bool report(int iter);
38  double sync(double x) const;
39 private:
40  Everything& e;
41  ScalarFieldArray n; //band structure density (should equal ElecVars::n at end)
42  RealKernel gaussCutoff; //gaussian cutoff kernel (of width Control::invertKS_sigma)
43  //Chi guess:
44  std::shared_ptr<class InvertChi> invertChi; //Compute inverse chi using linear CG
45 };
46 
47 #endif // JDFTX_ELECTRONIC_INVERSEKOHNSHAM_H
std::vector< ScalarField > ScalarFieldArray
dynamic size collection of real space scalar fields
Definition: ScalarFieldArray.h:32
void step(const ScalarFieldArray &dir, double alpha)
Move the state in parameter space along direction dir with scale alpha.
void constrain(ScalarFieldArray &dir)
double compute(ScalarFieldArray *grad)
Returns the objective function at the current state and store the gradient in grad, if non-null.
bool report(int iter)
Definition: Everything.h:41
Nonlinear minimization templates.
classes ScalarFieldArray, ScalarFieldTildeArray and just enough operators to enable CG w...
Special class for storing real reciprocal-space kernels encountered ever so often for convolutions...
Definition: ScalarField.h:177
double sync(double x) const
All processes minimize together; make sure scalars are in sync to round-off error.
Definition: Minimize.h:45
ScalarFieldArray precondition(const ScalarFieldArray &grad)
Definition: InverseKohnSham.h:27