XCPotential.h 1.77 KB
Newer Older
1 2
////////////////////////////////////////////////////////////////////////////////
//
Francois Gygi committed
3 4 5 6
// Copyright (c) 2008 The Regents of the University of California
//
// This file is part of Qbox
//
Francois Gygi committed
7 8
// Qbox is distributed under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 2 of
Francois Gygi committed
9 10 11 12 13 14
// the License, or (at your option) any later version.
// See the file COPYING in the root directory of this distribution
// or <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
//
Francois Gygi committed
15 16 17 18 19 20 21
// XCPotential.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef XCPOTENTIAL_H
#define XCPOTENTIAL_H

22
#include "Control.h"
Francois Gygi committed
23
#include "ChargeDensity.h"
24
#include <string>
Francois Gygi committed
25
#include <vector>
26
#include <valarray>
Francois Gygi committed
27 28 29 30
#include <complex>

class Basis;
class FourierTransform;
31
class XCFunctional;
Francois Gygi committed
32 33 34 35

class XCPotential
{
  private:
36

Francois Gygi committed
37
  const ChargeDensity& cd_;
Francois Gygi committed
38
  XCFunctional* xcf_;
39

40 41 42
  std::vector<std::vector<double> > vxctmp;          // vxctmp[ispin][ir]
  std::vector<std::complex<double> > tmpr;           // tmpr[ir]
  std::vector<std::complex<double> > tmp1, tmp2;     // tmp1[ig], tmp2[ig]
43

44
  double exc_, dxc_;
Francois Gygi committed
45 46 47
  int nspin_;
  int ngloc_;
  int np012loc_;
48

Francois Gygi committed
49 50 51 52 53 54
  FourierTransform& vft_;
  Basis& vbasis_;

  public:

  const XCFunctional* xcf() { return xcf_; }
Francois Gygi committed
55
  bool isGGA(void);
56 57
  XCPotential(const ChargeDensity& cd, const std::string functional_name,
    const Control& ctrl);
Francois Gygi committed
58
  ~XCPotential();
59 60
  void update(std::vector<std::vector<double> >& vr);
  void compute_stress(std::valarray<double>& sigma_exc);
Francois Gygi committed
61
  double exc(void) { return exc_; }
62
  double dxc(void) { return dxc_; }
Francois Gygi committed
63 64 65 66 67
};

class XCPotentialException
{
  public:
68 69
  std::string msg;
  XCPotentialException(std::string s) : msg(s) {}
Francois Gygi committed
70 71
};
#endif