SDWavefunctionStepper.C 1.54 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 20 21 22 23 24 25 26
// SDWavefunctionStepper.C
//
////////////////////////////////////////////////////////////////////////////////

#include "SDWavefunctionStepper.h"
#include "Wavefunction.h"
#include "SlaterDet.h"
#include "Sample.h"
#include <iostream>
using namespace std;

////////////////////////////////////////////////////////////////////////////////
27
SDWavefunctionStepper::SDWavefunctionStepper(Wavefunction& wf, double alpha,
28
  TimerMap& tmap) :
29 30
  alpha_(alpha), WavefunctionStepper(wf,tmap)
{}
31 32 33 34 35 36 37 38

////////////////////////////////////////////////////////////////////////////////
void SDWavefunctionStepper::update(Wavefunction& dwf)
{
  for ( int ispin = 0; ispin < wf_.nspin(); ispin++ )
  {
    for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
    {
Francois Gygi committed
39 40 41 42 43 44 45
      // c = c - dt2bye * hpsi
      tmap_["sd_update_wf"].start();
      wf_.sd(ispin,ikp)->c().axpy(-alpha_,dwf.sd(ispin,ikp)->c());
      tmap_["sd_update_wf"].stop();
      tmap_["gram"].start();
      wf_.sd(ispin,ikp)->gram();
      tmap_["gram"].stop();
46 47 48
    }
  }
}