ChargeDensity.h 1.73 KB
Newer Older
Francois Gygi's avatar
Francois Gygi committed
1
2
////////////////////////////////////////////////////////////////////////////////
//
Francois Gygi's avatar
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's avatar
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's avatar
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's avatar
Francois Gygi committed
15
16
17
18
19
20
21
22
23
24
// ChargeDensity.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef CHARGEDENSITY_H
#define CHARGEDENSITY_H

#include <vector>
#include <valarray>
#include <complex>
Francois Gygi's avatar
Francois Gygi committed
25
26
27
#include <string>
#include <map>
#include "Timer.h"
Francois Gygi's avatar
Francois Gygi committed
28
29
30
31
32
33
#include "Context.h"

class Wavefunction;
class FourierTransform;
class Basis;

34
typedef std::map<std::string,Timer> TimerMap;
Francois Gygi's avatar
Francois Gygi committed
35

Francois Gygi's avatar
Francois Gygi committed
36
37
38
class ChargeDensity
{
  private:
39

Francois Gygi's avatar
Francois Gygi committed
40
  const Context& ctxt_;
41
  MPI_Comm vcomm_;
Francois Gygi's avatar
Francois Gygi committed
42
43
44
  const Wavefunction& wf_;
  Basis* vbasis_;
  FourierTransform* vft_;
45
46
  std::vector<FourierTransform*> ft_; // ft_[ikp];
  std::valarray<std::complex<double> > rhotmp;
47

Francois Gygi's avatar
Francois Gygi committed
48
  public:
49

Francois Gygi's avatar
Francois Gygi committed
50
51
  mutable TimerMap tmap;

52
53
  std::vector<std::vector<double> > rhor; // rhor[ispin][i]
  std::vector<std::vector<std::complex<double> > > rhog; // rhog[ispin][ig]
Francois Gygi's avatar
Francois Gygi committed
54
55

  void update_density(void);
Francois Gygi's avatar
Francois Gygi committed
56
  void update_rhor(void);
57

58
59
  const Context& context(void) const { return ctxt_; }
  MPI_Comm vcomm(void) const { return vcomm_; }
Francois Gygi's avatar
Francois Gygi committed
60
61
62
63
64
65
66
67
  Basis* vbasis(void) const { return vbasis_; }
  FourierTransform* vft(void) const { return vft_; }
  FourierTransform* ft(int ikp) const { return ft_[ikp]; }

  ChargeDensity(const Wavefunction& wf);
  ~ChargeDensity();
};
#endif