LDAFunctional.h 1.29 KB
Newer Older
Francois Gygi committed
1 2 3 4 5
////////////////////////////////////////////////////////////////////////////////
//
// LDAFunctional.h
//
////////////////////////////////////////////////////////////////////////////////
Francois Gygi committed
6
// $Id: LDAFunctional.h,v 1.3 2004-09-14 22:24:11 fgygi Exp $
Francois Gygi committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

#ifndef LDAFUNCTIONAL_H
#define LDAFUNCTIONAL_H

#include <vector>
#include <cassert>
using namespace std;
#include "XCFunctional.h"

class LDAFunctional : public XCFunctional
{
  void xc_unpolarized(const double rh, double &ee, double &vv);
  void xc_polarized(const double rh, double &ee, double &vv);    
  vector<double> _exc;
  vector<vector<double> > _vxc;
  
  LDAFunctional();
  
  public:
  
Francois Gygi committed
27
  LDAFunctional(const vector<vector<double> > &rhoe)
Francois Gygi committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
  {
    _nspin = rhoe.size();
    if ( _nspin > 1 ) assert(rhoe[0].size() == rhoe[1].size());
    _np = rhoe[0].size();
    _exc.resize(_np);
    _vxc.resize(_nspin);
    for ( int i = 0; i < _nspin; i++ )
    {
      _vxc[i].resize(_np);
    }
    
    if ( _nspin == 1 )
    {
      rho = &rhoe[0][0];
      exc = &_exc[0];
      vxc1 = &_vxc[0][0];
    }
    else
    {
      rho_up = &rhoe[0][0];
      rho_dn = &rhoe[1][0];
      exc = &_exc[0];
      vxc1_up = &_vxc[0][0];
      vxc1_dn = &_vxc[1][0];
    }
  };
  
  bool isGGA() { return false; };
  string name() { return "LDA"; };
  void setxc(void);
};
#endif