XCOperator.h 1.96 KB
Newer Older
Francois Gygi committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2008 The Regents of the University of California
//
// This file is part of Qbox
//
// Qbox is distributed under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 2 of
// 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/>.
//
////////////////////////////////////////////////////////////////////////////////
//
// XCOperator.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef XCOPERATOR_H
#define XCOPERATOR_H

22
#include <valarray>
Francois Gygi committed
23 24
#include <vector>
#include <string>
Francois Gygi committed
25

Francois Gygi committed
26 27
class Sample;
class Wavefunction;
28
class ChargeDensity;
Francois Gygi committed
29 30 31 32 33 34 35 36 37
class XCPotential;
class ExchangeOperator;
class XCOperator
{
  private:

  XCPotential* xcp_;
  ExchangeOperator* xop_;

Francois Gygi committed
38
  const Sample& s_;
Francois Gygi committed
39
  const ChargeDensity& cd_;
40
  double exc_; // XC energy: includes local and HF terms
41
  double dxc_;
42 43

  std::valarray<double> sigma_exc_;
Francois Gygi committed
44 45 46 47

  bool hasPotential_;
  bool hasGGA_;
  bool hasHF_;
Francois Gygi committed
48
  bool hasMeta_;
Francois Gygi committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

  public:

  // constructor
  XCOperator( Sample& s, const ChargeDensity& cd);

  // destructor
  ~XCOperator();

  // return pointer to the exchange potential class
  const XCPotential* xcp() { return xcp_; }

  // return pointer to the ExchangeOperator class
  ExchangeOperator* xop() { return xop_; }

  bool hasGGA(void) { return hasGGA_; };
  bool hasHF(void) { return hasHF_; };
Francois Gygi committed
66
  bool hasMeta(void) { return hasMeta_; };
Francois Gygi committed
67

68 69 70
  void update(std::vector<std::vector<double> >& vr, bool compute_stress);
  void apply_self_energy(Wavefunction &dwf);
  void compute_stress(std::valarray<double>& sigma);
71
  void cell_moved(void);
72
  double exc(void) { return exc_ ; };
73
  double dxc(void) { return dxc_ ; };
Francois Gygi committed
74 75 76 77 78 79 80 81 82 83
};

class XCOperatorException
{
  public:
  std::string msg;
  XCOperatorException(std::string s) : msg(s) {}
};

#endif