SDIonicStepper.C 1.19 KB
Newer Older
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/>.
//
////////////////////////////////////////////////////////////////////////////////
//
15 16 17 18 19
// SDIonicStepper.C
//
////////////////////////////////////////////////////////////////////////////////

#include "SDIonicStepper.h"
20
using namespace std;
21

22
////////////////////////////////////////////////////////////////////////////////
Francois Gygi committed
23
void SDIonicStepper::compute_r(double e0, const vector<vector< double> >& f0)
24
{
25
  // Steepest descent step
26
  for ( int is = 0; is < r0_.size(); is++ )
27
  {
28
    const double dt2bym = dt_ * dt_ / pmass_[is];
29
    for ( int i = 0; i < r0_[is].size(); i++ )
30
    {
31
      rp_[is][i] = r0_[is][i] + dt2bym * f0[is][i];
32 33
    }
  }
Francois Gygi committed
34 35
  constraints_.enforce_r(r0_,rp_);
  rm_ = r0_;
36 37 38
  r0_ = rp_;
  atoms_.set_positions(r0_);
}