testSample.C 1.54 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
// testSample.C
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
using namespace std;

#include "Context.h"
#include "SlaterDet.h"
23
#include "UnitCell.h"
Francois Gygi committed
24 25 26 27 28 29 30 31 32
#include "Sample.h"
#include "D3vector.h"

int main(int argc, char** argv)
{
  MPI_Init(&argc,&argv);
  // extra scope to ensure that BlacsContext objects get destructed before
  // the MPI_Finalize call
  {
33
    Context ctxt(MPI_COMM_WORLD);
34

Francois Gygi committed
35 36 37 38
    char processor_name[MPI_MAX_PROCESSOR_NAME];
    int namelen;
    PMPI_Get_processor_name(processor_name,&namelen);
    cout << " Process " << ctxt.mype() << " on " << processor_name << endl;
39

Francois Gygi committed
40
    Sample s(ctxt);
41

42 43 44 45
    D3vector a(18, 0, 0);
    D3vector b( 0,18, 0);
    D3vector c( 0, 0,18);
    UnitCell uc(a,b,c);
Francois Gygi committed
46
    double ecut = 25.0;
47
    s.wf.resize(uc,uc,ecut);
Francois Gygi committed
48
    s.wf.set_nel(12*54);
49

Francois Gygi committed
50 51
    s.wf.randomize(1.e-4);
    s.wf.gram();
52
    cout << " ortho_error: " << s.wf.sd(0,0)->ortho_error() << endl;
Francois Gygi committed
53 54 55 56
  }
  MPI_Finalize();
  return 0;
}