StructureFactor.h 2.33 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 18 19 20 21 22 23 24 25 26 27 28 29 30
// StructureFactor.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef STRUCTUREFACTOR_H
#define STRUCTUREFACTOR_H

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

class Basis;

class StructureFactor
{
  private:
31

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

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

Francois Gygi committed
39
  public:
40

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

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

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

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

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

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

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

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

67 68 69 70 71 72 73
  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]
74

75 76
  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
77 78 79

};
#endif