XCPotential.h 1.77 KB
Newer Older
1
////////////////////////////////////////////////////////////////////////////////
Francois Gygi committed
2 3 4 5
// Copyright (c) 2008 The Regents of the University of California
//
// This file is part of Qbox
//
Francois Gygi committed
6 7
// 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
8 9 10 11 12 13
// 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
14 15 16 17 18 19 20
// XCPotential.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef XCPOTENTIAL_H
#define XCPOTENTIAL_H

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

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

class XCPotential
{
  private:
35

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

39 40 41
  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]
42

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

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

  public:

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

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