XCPotential.h 1.71 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 21
// XCPotential.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef XCPOTENTIAL_H
#define XCPOTENTIAL_H

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

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

class XCPotential
{
  private:
34

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

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

Francois Gygi committed
42 43 44 45
  double exc_, dxc_, dxc0_, dxc1_, dxc2_;
  int nspin_;
  int ngloc_;
  int np012loc_;
46

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

  public:

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

class XCPotentialException
{
  public:
64 65
  std::string msg;
  XCPotentialException(std::string s) : msg(s) {}
Francois Gygi committed
66 67
};
#endif