XCPotential.h 2.07 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 22
// XCPotential.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef XCPOTENTIAL_H
#define XCPOTENTIAL_H

#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
class Sample;
class Wavefunction;
Francois Gygi committed
33 34 35 36

class XCPotential
{
  private:
37

Francois Gygi committed
38
  const Sample& s_;
Francois Gygi committed
39
  const ChargeDensity& cd_;
Francois Gygi committed
40
  XCFunctional* xcf_;
41

42 43 44 45 46
  // rhototal_r_: total density (valence+core)
  std::vector<std::vector<double> > rhototal_r_;
  // rhototal_g_: total density (valence+core)
  std::vector<std::vector<std::complex<double> > > rhototal_g_;

47 48 49
  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]
50

51
  double exc_, dxc_;
Francois Gygi committed
52 53 54
  int nspin_;
  int ngloc_;
  int np012loc_;
55

Francois Gygi committed
56 57 58 59 60 61
  FourierTransform& vft_;
  Basis& vbasis_;

  public:

  const XCFunctional* xcf() { return xcf_; }
Francois Gygi committed
62
  bool isGGA(void);
Francois Gygi committed
63
  bool isMeta(void);
64
  XCPotential(const ChargeDensity& cd, const std::string functional_name,
Francois Gygi committed
65
    const Sample& s);
Francois Gygi committed
66
  ~XCPotential();
67 68
  void update(std::vector<std::vector<double> >& vr);
  void compute_stress(std::valarray<double>& sigma_exc);
Francois Gygi committed
69
  void apply_meta_operator(Wavefunction& dwf);
Francois Gygi committed
70
  double exc(void) { return exc_; }
71
  double dxc(void) { return dxc_; }
Francois Gygi committed
72 73 74 75 76
};

class XCPotentialException
{
  public:
77 78
  std::string msg;
  XCPotentialException(std::string s) : msg(s) {}
Francois Gygi committed
79 80
};
#endif