Commit 506fdba5 by Francois Gygi

modified API for future implementation of PBE0


git-svn-id: http://qboxcode.org/svn/qb/trunk@703 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 42acafe5
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// BLYPFunctional.h // BLYPFunctional.h
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: BLYPFunctional.h,v 1.6 2008-09-08 15:56:18 fgygi Exp $ // $Id: BLYPFunctional.h,v 1.7 2009-06-29 09:57:57 fgygi Exp $
#ifndef BLYPFUNCTIONAL_H #ifndef BLYPFUNCTIONAL_H
#define BLYPFUNCTIONAL_H #define BLYPFUNCTIONAL_H
...@@ -45,8 +45,8 @@ class BLYPFunctional : public XCFunctional ...@@ -45,8 +45,8 @@ class BLYPFunctional : public XCFunctional
BLYPFunctional(const std::vector<std::vector<double> > &rhoe); BLYPFunctional(const std::vector<std::vector<double> > &rhoe);
bool isGGA() { return true; }; bool isGGA() const { return true; };
std::string name() { return "BLYP"; }; std::string name() const { return "BLYP"; };
void setxc(void); void setxc(void);
}; };
#endif #endif
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// LDAFunctional.h // LDAFunctional.h
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: LDAFunctional.h,v 1.7 2008-09-08 15:56:18 fgygi Exp $ // $Id: LDAFunctional.h,v 1.8 2009-06-29 09:57:57 fgygi Exp $
#ifndef LDAFUNCTIONAL_H #ifndef LDAFUNCTIONAL_H
#define LDAFUNCTIONAL_H #define LDAFUNCTIONAL_H
...@@ -63,8 +63,8 @@ class LDAFunctional : public XCFunctional ...@@ -63,8 +63,8 @@ class LDAFunctional : public XCFunctional
} }
}; };
bool isGGA() { return false; }; bool isGGA() const { return false; };
std::string name() { return "LDA"; }; std::string name() const { return "LDA"; };
void setxc(void); void setxc(void);
}; };
#endif #endif
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// PBEFunctional.C // PBEFunctional.C
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: PBEFunctional.C,v 1.8 2008-09-08 15:56:18 fgygi Exp $ // $Id: PBEFunctional.C,v 1.9 2009-06-29 09:58:34 fgygi Exp $
#include "PBEFunctional.h" #include "PBEFunctional.h"
#include <cmath> #include <cmath>
...@@ -24,8 +24,11 @@ ...@@ -24,8 +24,11 @@
#include <vector> #include <vector>
using namespace std; using namespace std;
PBEFunctional::PBEFunctional(const vector<vector<double> > &rhoe) PBEFunctional::PBEFunctional(const vector<vector<double> > &rhoe,
double x_coeff, double c_coeff)
{ {
x_coeff_ = x_coeff;
c_coeff_ = c_coeff;
_nspin = rhoe.size(); _nspin = rhoe.size();
if ( _nspin > 1 ) assert(rhoe[0].size() == rhoe[1].size()); if ( _nspin > 1 ) assert(rhoe[0].size() == rhoe[1].size());
_np = rhoe[0].size(); _np = rhoe[0].size();
...@@ -269,9 +272,9 @@ void PBEFunctional::excpbe(double rho, double grad, ...@@ -269,9 +272,9 @@ void PBEFunctional::excpbe(double rho, double grad,
vc1 = vc + h + hrs - t2 * ht * seven_sixth; vc1 = vc + h + hrs - t2 * ht * seven_sixth;
vc2 = - ht / ( rho * twoks * twoks ); vc2 = - ht / ( rho * twoks * twoks );
*exc = ex + ec + h; *exc = x_coeff_ * ex + c_coeff_ * ( ec + h );
*vxc1 = vx1 + vc1; *vxc1 = x_coeff_ * vx1 + c_coeff_ * vc1;
*vxc2 = vx2 + vc2; *vxc2 = x_coeff_ * vx2 + c_coeff_ * vc2;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// PBEFunctional.h // PBEFunctional.h
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: PBEFunctional.h,v 1.6 2008-09-08 15:56:18 fgygi Exp $ // $Id: PBEFunctional.h,v 1.7 2009-06-29 09:57:57 fgygi Exp $
#ifndef PBEFUNCTIONAL_H #ifndef PBEFUNCTIONAL_H
#define PBEFUNCTIONAL_H #define PBEFUNCTIONAL_H
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
class PBEFunctional : public XCFunctional class PBEFunctional : public XCFunctional
{ {
PBEFunctional(); double x_coeff_, c_coeff_;
std::vector<double> _exc, _exc_up, _exc_dn; std::vector<double> _exc, _exc_up, _exc_dn;
std::vector<double> _vxc1, _vxc1_up, _vxc1_dn, std::vector<double> _vxc1, _vxc1_up, _vxc1_dn,
_vxc2, _vxc2_upup, _vxc2_updn, _vxc2_dnup, _vxc2_dndn; _vxc2, _vxc2_upup, _vxc2_updn, _vxc2_dnup, _vxc2_dndn;
...@@ -47,10 +46,13 @@ class PBEFunctional : public XCFunctional ...@@ -47,10 +46,13 @@ class PBEFunctional : public XCFunctional
public: public:
PBEFunctional(const std::vector<std::vector<double> > &rhoe); // constructor with variable coefficients for exchange and correlation
// with default values 1.0
PBEFunctional(const std::vector<std::vector<double> > &rhoe,
double x_coeff=1.0, double c_coeff=1.0);
bool isGGA() { return true; }; bool isGGA() const { return true; };
std::string name() { return "PBE"; }; std::string name() const { return "PBE"; };
void setxc(void); void setxc(void);
}; };
#endif #endif
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// XCFunctional.h // XCFunctional.h
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: XCFunctional.h,v 1.6 2008-09-08 15:56:19 fgygi Exp $ // $Id: XCFunctional.h,v 1.7 2009-06-29 09:57:57 fgygi Exp $
// //
// Abstract base class for density functionals // Abstract base class for density functionals
...@@ -70,10 +70,10 @@ class XCFunctional ...@@ -70,10 +70,10 @@ class XCFunctional
double *vxc1, *vxc1_up, *vxc1_dn; double *vxc1, *vxc1_up, *vxc1_dn;
double *vxc2, *vxc2_upup, *vxc2_dndn, *vxc2_updn, *vxc2_dnup; double *vxc2, *vxc2_upup, *vxc2_dndn, *vxc2_updn, *vxc2_dnup;
virtual bool isGGA(void) = 0; virtual bool isGGA(void) const = 0;
virtual std::string name(void) = 0; virtual std::string name(void) const = 0;
int np(void) { return _np; }; int np(void) const { return _np; };
int nspin(void) { return _nspin; }; int nspin(void) const { return _nspin; };
XCFunctional() XCFunctional()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment