ExtForce.h 1.67 KB
Newer Older
Francois Gygi committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2009 The Regents of the University of California
//
// This file is part of Qbox
//
// Qbox is distributed under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 2 of
// 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/>.
//
////////////////////////////////////////////////////////////////////////////////
//
//  ExtForce.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: ExtForce.h,v 1.1 2010-02-20 23:13:02 fgygi Exp $

#ifndef EXTFORCE_H
#define EXTFORCE_H

#include <string>
#include <vector>
#include <cassert>
#include "D3vector.h"

class AtomSet;

class ExtForce
{
  protected:

  std::string name_;               // extforce name
  std::vector<std::string> names_; // names of atoms involved in the extforce

  public:

  virtual ~ExtForce(void){}
  virtual std::string type(void) const = 0;
  virtual void set_value(std::vector<double> f) = 0;
  virtual double energy(const std::vector<std::vector<double> > &r,
                        std::vector<std::vector<double> > &f) = 0;
  virtual void setup(const AtomSet& atoms) = 0;
  virtual std::ostream& print(std::ostream &os) = 0;
  virtual D3vector sum_contrib(void) = 0;
  std::string name(void) const { return name_; }
  virtual double magnitude(void) = 0;
  std::string names(int i) const
  {
    assert( i >= 0 && i < names_.size() );
    return names_[i];
  }
};
std::ostream& operator << ( std::ostream &os, ExtForce &xf );
#endif