Commit a929bbdc by Francois Gygi

Modified output for ground-state only calculations (niter=0)


git-svn-id: http://qboxcode.org/svn/qb/trunk@627 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 9eb81db2
......@@ -3,7 +3,7 @@
// BOSampleStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: BOSampleStepper.C,v 1.41 2008-04-15 01:36:15 fgygi Exp $
// $Id: BOSampleStepper.C,v 1.42 2008-06-15 20:44:58 fgygi Exp $
#include "BOSampleStepper.h"
#include "EnergyFunctional.h"
......@@ -98,6 +98,8 @@ void BOSampleStepper::step(int niter)
const bool compute_stress = ( s_.ctrl.stress == "ON" );
const bool cell_moves = ( niter > 0 && compute_stress &&
cell_dyn != "LOCKED" );
// GS-only calculation:
const bool gs_only = !atoms_move && !cell_moves;
const bool use_confinement = ( s_.ctrl.ecuts > 0.0 );
Timer tm_iter;
......@@ -175,6 +177,8 @@ void BOSampleStepper::step(int niter)
// compute energy and ionic forces using existing wavefunction
if ( !gs_only )
{
tmap["charge"].start();
cd_.update_density();
tmap["charge"].stop();
......@@ -289,6 +293,7 @@ void BOSampleStepper::step(int niter)
preconditioner->update();
}
}
} // if !gs_only
// Recalculate ground state wavefunctions
......@@ -609,7 +614,7 @@ void BOSampleStepper::step(int niter)
// subspace diagonalization
if ( compute_eigvec || s_.ctrl.wf_diag == "EIGVAL" )
{
energy = ef_.energy(true,dwf,false,fion,false,sigma_eks);
ef_.energy(true,dwf,false,fion,false,sigma_eks);
s_.wf.diag(dwf,compute_eigvec);
if ( onpe0 )
{
......@@ -654,11 +659,50 @@ void BOSampleStepper::step(int niter)
cout << " BOSampleStepper: end scf iteration" << endl;
} // for itscf
// If GS calculation only, print energy at end of iterations
if ( !atoms_move && !cell_moves )
// If GS calculation only, print energy and atomset at end of iterations
if ( gs_only )
{
tmap["charge"].start();
cd_.update_density();
tmap["charge"].stop();
ef_.update_vhxc();
const bool compute_forces = true;
ef_.energy(false,dwf,compute_forces,fion,compute_stress,sigma_eks);
if ( onpe0 )
{
cout << ef_;
cout << "<atomset>" << endl;
cout << atoms.cell();
for ( int is = 0; is < atoms.atom_list.size(); is++ )
{
int i = 0;
for ( int ia = 0; ia < atoms.atom_list[is].size(); ia++ )
{
Atom* pa = atoms.atom_list[is][ia];
cout << " <atom name=\"" << pa->name() << "\""
<< " species=\"" << pa->species()
<< "\">\n"
<< " <position> " << pa->position() << " </position>\n"
<< " <velocity> " << pa->velocity() << " </velocity>\n"
<< " <force> "
<< fion[is][i] << " "
<< fion[is][i+1] << " "
<< fion[is][i+2]
<< " </force>\n";
cout << " </atom>" << endl;
i += 3;
}
}
cout << "</atomset>" << endl;
if ( compute_stress )
{
compute_sigma();
print_stress();
}
}
}
wf_stepper->postprocess();
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment