StatusCmd.h 1.88 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 22 23 24
// StatusCmd.h:
//
////////////////////////////////////////////////////////////////////////////////

#ifndef STATUSCMD_H
#define STATUSCMD_H

#include <iostream>
#include "UserInterface.h"
#include "Sample.h"
25 26
#include "ChargeDensity.h"
#include "FourierTransform.h"
Francois Gygi committed
27 28 29 30 31 32 33 34 35 36 37 38 39

class StatusCmd : public Cmd
{
  private:

  int niter, nfi;

  public:

  Sample *s;

  StatusCmd(Sample *sample) : s(sample) {};

40 41
  const char *name(void) const { return "status"; }
  const char *help_msg(void) const
Francois Gygi committed
42
  {
43
    return
Francois Gygi committed
44 45 46 47 48 49 50 51
    "\n run\n\n"
    " syntax: status \n\n"
    "   The status command print information about the current\n"
    "   status of the simulation\n\n";
  }

  int action(int argc, char **argv)
  {
52 53 54 55 56 57 58 59 60 61 62
    // compute the size of the potential grid
    int np0v = 0;
    int np1v = 0;
    int np2v = 0;
    if ( s->wf.ecut() > 0 && s->wf.cell().volume() > 0 )
    {
      ChargeDensity cd(s->wf);
      np0v = cd.vft()->np0();
      np1v = cd.vft()->np1();
      np2v = cd.vft()->np2();
    }
Francois Gygi committed
63 64
    if ( ui->onpe0() )
    {
65 66 67
      cout << "<np0v> " << np0v << " </np0v>  "
           << "<np1v> " << np1v << " </np1v>  "
           << "<np2v> " << np2v << " </np2v>" << endl;
Francois Gygi committed
68 69 70
      s->wf.info(cout,"wf");
      if ( s->wfv != 0 )
        s->wfv->info(cout,"wfv");
71
      cout << "<vcm> " << s->atoms.vcm() << " </vcm>" << endl;
Francois Gygi committed
72 73 74 75 76 77
    }
    return 0;
  }

};
#endif