StructureFactor.h 2.39 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
// StructureFactor.h
//
////////////////////////////////////////////////////////////////////////////////
Francois Gygi committed
18
// $Id: StructureFactor.h,v 1.5 2008-09-08 15:56:19 fgygi Exp $
Francois Gygi committed
19 20 21 22 23 24 25 26 27 28 29 30 31

#ifndef STRUCTUREFACTOR_H
#define STRUCTUREFACTOR_H

#include <vector>
#include <complex>
#include <iostream>

class Basis;

class StructureFactor
{
  private:
32

Francois Gygi committed
33
  int _nsp, _ng;
34
  std::vector<int> _na;
35 36

  int _k0max, _k1max, _k2max,
Francois Gygi committed
37 38
      _k0min, _k1min, _k2min,
      _k0range, _k1range, _k2range;
39

Francois Gygi committed
40
  public:
41

Francois Gygi committed
42 43 44
  // convenience pointer access functions:
  // double *c0 = cos0_ptr(is,ia);
  // c0[ kx ] == cos(-i gx*tau[is][ia].x)
45 46

  double *cos0_ptr(int is, int ia)
Francois Gygi committed
47
    { return &cos0[is][ia*_k0range-_k0min]; }
48 49

  double *cos1_ptr(int is, int ia)
Francois Gygi committed
50
    { return &cos1[is][ia*_k1range-_k1min]; }
51 52

  double *cos2_ptr(int is, int ia)
Francois Gygi committed
53
    { return &cos2[is][ia*_k2range-_k2min]; }
54 55

  double *sin0_ptr(int is, int ia)
Francois Gygi committed
56
    { return &sin0[is][ia*_k0range-_k0min]; }
57 58

  double *sin1_ptr(int is, int ia)
Francois Gygi committed
59
    { return &sin1[is][ia*_k1range-_k1min]; }
60 61

  double *sin2_ptr(int is, int ia)
Francois Gygi committed
62 63 64 65 66 67
    { return &sin2[is][ia*_k2range-_k2min]; }

  // kx in [k0min, k0max]
  // ky in [k1min, k1max]
  // kz in [k2min, k2max]

68 69 70 71 72 73 74
  std::vector<std::vector<double> > cos0;  // cos0[is][ia*k0range-k0min+kx]
  std::vector<std::vector<double> > cos1;  // cos1[is][ia*k1range-k1min+ky]
  std::vector<std::vector<double> > cos2;  // cos2[is][ia*k2range-k2min+ky]
  std::vector<std::vector<double> > sin0;  // sin0[is][ia*k0range-k0min+kx]
  std::vector<std::vector<double> > sin1;  // sin1[is][ia*k1range-k1min+ky]
  std::vector<std::vector<double> > sin2;  // sin2[is][ia*k2range-k2min+ky]
  std::vector<std::vector<std::complex<double> > > sfac;  // sfac[is][ig]
75

76 77
  void init(const std::vector<std::vector<double> >& tau, const Basis& basis);
  void update(const std::vector<std::vector<double> >& tau, const Basis& basis);
Francois Gygi committed
78 79 80

};
#endif