LDAFunctional.h 1.78 KB
Newer Older
Francois Gygi committed
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
// LDAFunctional.h
//
////////////////////////////////////////////////////////////////////////////////
18
// $Id: LDAFunctional.h,v 1.8 2009-06-29 09:57:57 fgygi Exp $
Francois Gygi committed
19 20 21 22 23 24 25 26 27 28 29

#ifndef LDAFUNCTIONAL_H
#define LDAFUNCTIONAL_H

#include <vector>
#include <cassert>
#include "XCFunctional.h"

class LDAFunctional : public XCFunctional
{
  void xc_unpolarized(const double rh, double &ee, double &vv);
30
  void xc_polarized(const double rh, double &ee, double &vv);
31 32
  std::vector<double> _exc;
  std::vector<std::vector<double> > _vxc;
33

Francois Gygi committed
34
  LDAFunctional();
35

Francois Gygi committed
36
  public:
37

38
  LDAFunctional(const std::vector<std::vector<double> > &rhoe)
Francois Gygi committed
39 40 41 42 43 44 45 46 47 48
  {
    _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);
    }
49

Francois Gygi committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
    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];
    }
  };
65

66 67
  bool isGGA() const { return false; };
  std::string name() const { return "LDA"; };
Francois Gygi committed
68 69 70
  void setxc(void);
};
#endif