XCOperator.h 1.85 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 22
////////////////////////////////////////////////////////////////////////////////
//
// 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

#include "Sample.h"
23
#include <valarray>
Francois Gygi committed
24

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

  XCPotential* xcp_;
  ExchangeOperator* xop_;

  const ChargeDensity& cd_;
  double HFmixCoeff_ ;
37
  double exc_; // XC energy: includes local and HF terms
38
  double dxc_;
39 40

  std::valarray<double> sigma_exc_;
Francois Gygi committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

  bool hasPotential_;
  bool hasGGA_;
  bool hasHF_;

  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_; };

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

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

#endif