SampleStepper.h 1.67 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
// SampleStepper.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef SAMPLESTEPPER_H
#define SAMPLESTEPPER_H

22
#include "Timer.h"
23 24
#include "EnergyFunctional.h"
#include "ChargeDensity.h"
Francois Gygi committed
25 26
#include <map>
#include <string>
27
#include <vector>
28
#include <valarray>
Francois Gygi committed
29

30 31
class Sample;
typedef std::map<std::string,Timer> TimerMap;
Francois Gygi committed
32 33 34

class SampleStepper
{
35
  protected:
36

Francois Gygi committed
37
  Sample& s_;
38

39 40
  std::vector<std::vector<double> > fion;
  std::valarray<double> sigma_eks, sigma_kin, sigma_ext, sigma;
Francois Gygi committed
41

42 43 44
  std::string iter_cmd_;
  int iter_cmd_period_;

Francois Gygi committed
45 46 47 48 49 50
  // Do not allow construction of SampleStepper unrelated to a Sample
  SampleStepper(void);

  public:

  mutable TimerMap tmap;
51

52 53 54
  virtual void step(int niter) = 0;
  void print_stress(void);
  void compute_sigma(void); // compute kinetic contribution to stress
Francois Gygi committed
55
  virtual void initialize_density() {}
56 57
  void set_iter_cmd(std::string s) { iter_cmd_ = s; }
  void set_iter_cmd_period(int i) { iter_cmd_period_ = i; }
58

59 60
  virtual EnergyFunctional& ef(void) = 0;
  virtual ChargeDensity& cd(void) = 0;
Francois Gygi committed
61 62

  SampleStepper(Sample& s);
63
  virtual ~SampleStepper(void);
Francois Gygi committed
64 65
};
#endif