AtomicExtForce.h 1.64 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 57 58 59 60 61 62
////////////////////////////////////////////////////////////////////////////////
//
// 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/>.
//
////////////////////////////////////////////////////////////////////////////////
//
//  AtomicExtForce.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomicExtForce.h,v 1.1 2010-02-20 23:13:02 fgygi Exp $

#ifndef ATOMICEXTFORCE_H
#define ATOMICEXTFORCE_H

#include "ExtForce.h"
#include "D3vector.h"
#include <cassert>

class AtomSet;

class AtomicExtForce: public ExtForce
{
  std::string name1_; // name of atom
  int    ia1_, is1_;
  D3vector force_;

  public:

  AtomicExtForce(std::string name, std::string name1, D3vector force):
  name1_(name1), force_(force)
  {
    name_ = name;
    names_.resize(1);
    names_[0] = name1_;
  }
  ~AtomicExtForce(void) {}

  std::string type(void) const { return "atomic"; }
  void set_value(std::vector<double> f)
  {
    force_.x = f[0];
    force_.y = f[1];
    force_.z = f[2];
  }

  void setup(const AtomSet& atoms);
  double energy(const std::vector<std::vector<double> > &r,
                std::vector<std::vector<double> > &f);
  D3vector sum_contrib(void) { return force_; }
  double magnitude(void) { return length(force_); }
  std::ostream& print( std::ostream& os );

};
#endif