Commit 2ff91c49 by Francois Gygi

implementation of stress (s-only n-l projectors)


git-svn-id: http://qboxcode.org/svn/qb/trunk@173 cba15fb0-1239-40c8-b417-11db7ca47a34
parent fe82c329
......@@ -3,7 +3,7 @@
// BOSampleStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: BOSampleStepper.C,v 1.3 2003-12-01 17:57:44 fgygi Exp $
// $Id: BOSampleStepper.C,v 1.4 2004-02-04 19:55:16 fgygi Exp $
#include "BOSampleStepper.h"
#include "EnergyFunctional.h"
......@@ -34,7 +34,7 @@ void BOSampleStepper::step(EnergyFunctional& e, int niter)
{
AtomSet& atoms = s_.atoms;
Wavefunction& wf = s_.wf;
UnitCell dcell;
valarray<double> sigma(6);
atoms.get_positions(tau0);
atoms.get_velocities(vel);
......@@ -43,11 +43,13 @@ void BOSampleStepper::step(EnergyFunctional& e, int niter)
const string wf_dyn = s_.ctrl.wf_dyn;
const string atoms_dyn = s_.ctrl.atoms_dyn;
const string cell_dyn = s_.ctrl.cell_dyn;
const bool compute_hpsi = ( wf_dyn != "LOCKED" );
const bool compute_forces = ( atoms_dyn != "LOCKED" );
const bool compute_stress = ( s_.ctrl.stress == "ON" );
const bool move_cell = ( cell_dyn != "LOCKED" );
Timer tm_iter;
WavefunctionStepper* wf_stepper = 0;
......@@ -84,19 +86,22 @@ void BOSampleStepper::step(EnergyFunctional& e, int niter)
if ( s_.ctxt_.onpe0() )
cout << " <iteration count=\"" << iter+1 << "\">\n";
if ( compute_forces )
double energy = 0.0;
if ( compute_forces || compute_stress )
{
// compute energy and ionic forces using existing wavefunction
double energy =
e.energy(false,dwf,compute_forces,fion,compute_stress,dcell);
energy =
e.energy(false,dwf,compute_forces,fion,compute_stress,sigma);
if ( s_.ctxt_.onpe0() )
{
cout.setf(ios::fixed,ios::floatfield);
cout.setf(ios::right,ios::adjustfield);
cout << " <ekin> " << setprecision(8)
<< setw(15) << e.ekin() << " </ekin>\n"
<< " <eps> " << setw(15) << e.eps() << " </eps>\n"
<< setw(15) << e.ekin() << " </ekin>\n";
if ( compute_stress )
cout << " <econf> " << setw(15) << e.econf() << " </econf>\n";
cout << " <eps> " << setw(15) << e.eps() << " </eps>\n"
<< " <enl> " << setw(15) << e.enl() << " </enl>\n"
<< " <ecoul> " << setw(15) << e.ecoul() << " </ecoul>\n"
<< " <exc> " << setw(15) << e.exc() << " </exc>\n"
......@@ -105,7 +110,10 @@ void BOSampleStepper::step(EnergyFunctional& e, int niter)
<< " <etotal> " << setw(15) << e.etotal() << " </etotal>\n"
<< flush;
}
}
if ( compute_forces )
{
if ( iter == 0 )
ionic_stepper->preprocess(fion);
......@@ -221,7 +229,7 @@ void BOSampleStepper::step(EnergyFunctional& e, int niter)
for ( int ite = 0; ite < nite_; ite++ )
{
// at the last nite iteration, compute ionic forces for the last
double energy = e.energy(true,dwf,false,fion,false,dcell);
double energy = e.energy(true,dwf,false,fion,false,sigma);
wf_stepper->update(dwf);
......@@ -230,8 +238,13 @@ void BOSampleStepper::step(EnergyFunctional& e, int niter)
cout.setf(ios::fixed,ios::floatfield);
cout.setf(ios::right,ios::adjustfield);
cout << " <ekin_int> " << setprecision(8)
<< setw(15) << e.ekin() << " </ekin_int>\n"
<< " <eps_int> " << setw(15) << e.eps() << " </eps_int>\n"
<< setw(15) << e.ekin() << " </ekin_int>\n";
if ( compute_stress )
{
cout << " <econf_int> " << setw(15) << e.econf()
<< " </econf_int>\n";
}
cout << " <eps_int> " << setw(15) << e.eps() << " </eps_int>\n"
<< " <enl_int> " << setw(15) << e.enl() << " </enl_int>\n"
<< " <ecoul_int> " << setw(15) << e.ecoul() << " </ecoul_int>\n"
<< " <exc_int> " << setw(15) << e.exc() << " </exc_int>\n"
......@@ -293,7 +306,7 @@ void BOSampleStepper::step(EnergyFunctional& e, int niter)
// compute ionic forces at last position for postprocessing of ionic
// positions (Stoermer end step)
double energy =
e.energy(false,dwf,compute_forces,fion,compute_stress,dcell);
e.energy(false,dwf,compute_forces,fion,compute_stress,sigma);
ionic_stepper->postprocess(fion);
}
else
......
......@@ -3,7 +3,7 @@
// SampleStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: CPSampleStepper.C,v 1.1 2003-11-21 20:01:06 fgygi Exp $
// $Id: CPSampleStepper.C,v 1.2 2004-02-04 19:55:16 fgygi Exp $
#include "CPSampleStepper.h"
#include "EnergyFunctional.h"
......@@ -35,7 +35,7 @@ void CPSampleStepper::step(EnergyFunctional& e, int niter)
{
AtomSet& atoms = s_.atoms;
Wavefunction& wf = s_.wf;
UnitCell dcell;
valarray<double> sigma(6);
const double dt = s_.ctrl.dt;
double ekin_ion=0.0,ekin_e, temp_ion, eta;
......@@ -51,7 +51,7 @@ void CPSampleStepper::step(EnergyFunctional& e, int niter)
Timer tm_iter;
double energy =
e.energy(compute_hpsi,dwf,compute_forces,fion,compute_stress,dcell);
e.energy(compute_hpsi,dwf,compute_forces,fion,compute_stress,sigma);
for ( int iter = 0; iter < niter; iter++ )
{
......@@ -133,7 +133,7 @@ void CPSampleStepper::step(EnergyFunctional& e, int niter)
}
energy =
e.energy(compute_hpsi,dwf,compute_forces,fion,compute_stress,dcell);
e.energy(compute_hpsi,dwf,compute_forces,fion,compute_stress,sigma);
if ( s_.ctxt_.mype() == 0 )
cout << " </iteration>" << endl;
......
......@@ -3,25 +3,26 @@
// Control.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Control.h,v 1.5 2003-12-02 20:24:27 fgygi Exp $
// $Id: Control.h,v 1.6 2004-02-04 19:55:17 fgygi Exp $
#ifndef CONTROL_H
#define CONTROL_H
#include <string>
#include <vector>
struct Control
{
// control variables
string wf_dyn, atoms_dyn, cell_dyn; // dynamics string flags
string wf_dyn, atoms_dyn; // dynamics string flags
int nite;
double emass; // electron mass
string fermi; // use Fermi distribution to fill states
double fermi_temp; // temperature of Fermi distribution
double ecutprec;
double ecuts,sigmas,facs; // confinement energy parameters
double prefmbar; // externally applied pressure (Mbar)
string wf_diag;
string lock_abc;
string tcp;
double tcp_rcut;
......@@ -29,10 +30,16 @@ struct Control
double gms_mix; // mixing factor for generalized minimum spread functions
string solvation; // continuum dielectric model for solvent
string thermostat;
double th_temp,th_time; // thermostat control
string stress;
string cell_dyn;
string cell_lock;
double cell_mass;
double ecuts,sigmas,facs; // confinement energy parameters
double ext_stress[6]; // external stress tensor: xx,yy,zz,xy,yz,xz
string xc;
string spin;
int delta_spin;
......@@ -40,11 +47,5 @@ struct Control
double dt;
int iprint;
int timeout;
double th_temp,th_time; // thermostat control
double fermi_temp; // temperature of Fermi distribution
double emass; // electron mass
double vmass; // cell mass
};
#endif
......@@ -3,13 +3,14 @@
// EnergyFunctional.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: EnergyFunctional.h,v 1.9 2003-06-11 22:10:11 fgygi Exp $
// $Id: EnergyFunctional.h,v 1.10 2004-02-04 19:55:17 fgygi Exp $
#ifndef ENERGYFUNCTIONAL_H
#define ENERGYFUNCTIONAL_H
#include <complex>
#include <vector>
#include <valarray>
#include <map>
#include <string>
#include "ChargeDensity.h"
......@@ -42,17 +43,21 @@ class EnergyFunctional
NonLocalPotential* nlp;
vector<vector<double> > vps, dvps, rhops;
vector<complex<double> > tmp_r, vion_local_g, vlocal_g, rhopst,
rhogt, rhoelg, vtemp;
vector<complex<double> > tmp_r, vion_local_g, dvion_local_g, vlocal_g,
rhopst, rhogt, rhoelg, vtemp;
vector<double> ftmp;
vector<vector<double> > v_r;
vector<vector<double> > tau0, taum, fion_esr, fion;
vector<vector<double> > tau0, taum, fion_esr;
vector<double> zv_, rcps_;
vector<int> na_;
int namax_;
int nsp_;
double ekin_, eps_, enl_, ehart_, ecoul_, exc_, esr_, eself_, etotal_;
double ekin_, econf_, eps_, enl_, ehart_,
ecoul_, exc_, esr_, eself_, etotal_;
valarray<double> fstress_, dfstress_;
valarray<double> sigma_ekin,sigma_econf,sigma_eps,sigma_ehart,sigma_exc,
sigma_enl, sigma_esr, sigma;
void init(void);
......@@ -62,10 +67,11 @@ class EnergyFunctional
double energy(bool compute_hpsi, Wavefunction& dwf,
bool compute_forces, vector<vector<double> >& fion,
bool compute_stress, UnitCell& dcell);
bool compute_stress, valarray<double>& sigma);
double etotal(void) const { return etotal_; }
double ekin(void) const { return ekin_; }
double econf(void) const { return econf_; }
double eps(void) const { return eps_; }
double enl(void) const { return enl_; }
double ehart(void) const { return ehart_; }
......
......@@ -3,7 +3,7 @@
// MDWavefunctionStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: MDWavefunctionStepper.C,v 1.1 2003-11-21 20:01:06 fgygi Exp $
// $Id: MDWavefunctionStepper.C,v 1.2 2004-02-04 19:55:16 fgygi Exp $
#include "MDWavefunctionStepper.h"
#include "Wavefunction.h"
......@@ -14,11 +14,15 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////
MDWavefunctionStepper::MDWavefunctionStepper(Sample& s, TimerMap& tmap) :
s_(s), wf_(s.wf), tmap_(tmap)
WavefunctionStepper(s,tmap)
{
dt_ = s_.ctrl.dt;
const double emass = s_.ctrl.emass;
dt2bye_ = (emass == 0.0) ? 0.5 / wf_.ecut() : dt_*dt_/emass;
// divide dt2bye by facs coefficient if stress == ON
if ( s_.ctrl.stress == "ON" )
dt2bye_ /= s_.ctrl.facs;
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -3,27 +3,19 @@
// MDWavefunctionStepper.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: MDWavefunctionStepper.h,v 1.1 2003-11-21 20:01:06 fgygi Exp $
// $Id: MDWavefunctionStepper.h,v 1.2 2004-02-04 19:55:16 fgygi Exp $
#ifndef MDWAVEFUNCTIONSTEPPER_H
#define MDWAVEFUNCTIONSTEPPER_H
class Sample;
class Wavefunction;
#include "WavefunctionStepper.h"
#include "Timer.h"
#include <map>
#include <string>
using namespace std;
typedef map<string,Timer> TimerMap;
class MDWavefunctionStepper : public WavefunctionStepper
{
private:
Sample& s_;
Wavefunction& wf_;
double dt_, dt2bye_;
TimerMap& tmap_;
double ekin_ep_, ekin_em_;
double ekin_eh(void);
......
#-------------------------------------------------------------------------------
# $Id: Makefile,v 1.20 2004-01-22 01:21:11 fgygi Exp $
# $Id: Makefile,v 1.21 2004-02-04 19:55:16 fgygi Exp $
#------------------------------------------------------------------------------
#
include $(TARGET).mk
......@@ -146,8 +146,15 @@ BOSampleStepper.o: SDIonicStepper.h IonicStepper.h MDIonicStepper.h
BOSampleStepper.o: SampleStepper.h Sample.h AtomSet.h Context.h Atom.h
BOSampleStepper.o: D3vector.h Species.h Wavefunction.h UnitCell.h Control.h
BOSampleStepper.o: Timer.h
CellDyn.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
CellDyn.o: Wavefunction.h UnitCell.h Control.h SlaterDet.h Basis.h Matrix.h
CellDyn.o: Timer.h
Cell.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
Cell.o: Wavefunction.h UnitCell.h Control.h
CellLock.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
CellLock.o: Wavefunction.h UnitCell.h Control.h
CellMass.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
CellMass.o: Wavefunction.h UnitCell.h Control.h
ChargeDensity.o: ChargeDensity.h Context.h Basis.h D3vector.h UnitCell.h
ChargeDensity.o: Wavefunction.h FourierTransform.h SlaterDet.h Matrix.h
ChargeDensity.o: Timer.h
......@@ -168,6 +175,8 @@ Ecut.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
Ecut.o: Wavefunction.h UnitCell.h Control.h
Ecutprec.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
Ecutprec.o: Wavefunction.h UnitCell.h Control.h
Ecuts.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
Ecuts.o: Wavefunction.h UnitCell.h Control.h
Emass.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
Emass.o: Wavefunction.h UnitCell.h Control.h
EnergyFunctional.o: EnergyFunctional.h ChargeDensity.h Context.h
......@@ -178,6 +187,8 @@ EnergyFunctional.o: XCPotential.h LDAFunctional.h XCFunctional.h
EnergyFunctional.o: PBEFunctional.h BLYPFunctional.h NonLocalPotential.h
EnergyFunctional.o: blas.h
EnergyFunctional.o: ChargeDensity.h Context.h StructureFactor.h Timer.h
ExtStress.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
ExtStress.o: Wavefunction.h UnitCell.h Control.h
FourierTransform.o: FourierTransform.h Basis.h D3vector.h UnitCell.h
FourierTransform.o: Context.h Timer.h
HelpCmd.o: UserInterface.h Sample.h AtomSet.h Context.h Atom.h D3vector.h
......@@ -202,10 +213,12 @@ MDIonicStepper.o: UnitCell.h Control.h
MDIonicStepper.o: IonicStepper.h Sample.h AtomSet.h Context.h Atom.h
MDIonicStepper.o: D3vector.h Species.h Wavefunction.h UnitCell.h Control.h
MDWavefunctionStepper.o: MDWavefunctionStepper.h WavefunctionStepper.h
MDWavefunctionStepper.o: Timer.h Wavefunction.h D3vector.h UnitCell.h
MDWavefunctionStepper.o: SlaterDet.h Context.h Basis.h Matrix.h Sample.h
MDWavefunctionStepper.o: AtomSet.h Atom.h Species.h Control.h
MDWavefunctionStepper.o: WavefunctionStepper.h Timer.h
MDWavefunctionStepper.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h
MDWavefunctionStepper.o: Species.h Wavefunction.h UnitCell.h Control.h
MDWavefunctionStepper.o: Timer.h SlaterDet.h Basis.h Matrix.h
MDWavefunctionStepper.o: WavefunctionStepper.h Sample.h AtomSet.h Context.h
MDWavefunctionStepper.o: Atom.h D3vector.h Species.h Wavefunction.h
MDWavefunctionStepper.o: UnitCell.h Control.h Timer.h
Nempty.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
Nempty.o: Wavefunction.h UnitCell.h Control.h
NonLocalPotential.o: NonLocalPotential.h AtomSet.h Context.h Atom.h
......@@ -219,28 +232,34 @@ PBEFunctional.o: PBEFunctional.h XCFunctional.h
PBEFunctional.o: XCFunctional.h
PrintCmd.o: UserInterface.h Sample.h AtomSet.h Context.h Atom.h D3vector.h
PrintCmd.o: Species.h Wavefunction.h UnitCell.h Control.h
PSDAWavefunctionStepper.o: PSDAWavefunctionStepper.h Wavefunction.h
PSDAWavefunctionStepper.o: D3vector.h UnitCell.h WavefunctionStepper.h
PSDAWavefunctionStepper.o: Timer.h SlaterDet.h Context.h Basis.h Matrix.h
PSDAWavefunctionStepper.o: Sample.h AtomSet.h Atom.h Species.h Control.h
PSDAWavefunctionStepper.o: Wavefunction.h D3vector.h UnitCell.h
PSDAWavefunctionStepper.o: WavefunctionStepper.h Timer.h
PSDAWavefunctionStepper.o: PSDAWavefunctionStepper.h WavefunctionStepper.h
PSDAWavefunctionStepper.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h
PSDAWavefunctionStepper.o: Species.h Wavefunction.h UnitCell.h Control.h
PSDAWavefunctionStepper.o: Timer.h SlaterDet.h Basis.h Matrix.h
PSDAWavefunctionStepper.o: WavefunctionStepper.h Sample.h AtomSet.h Context.h
PSDAWavefunctionStepper.o: Atom.h D3vector.h Species.h Wavefunction.h
PSDAWavefunctionStepper.o: UnitCell.h Control.h Timer.h
PSDWavefunctionStepper.o: PSDWavefunctionStepper.h WavefunctionStepper.h
PSDWavefunctionStepper.o: Timer.h Wavefunction.h D3vector.h UnitCell.h
PSDWavefunctionStepper.o: SlaterDet.h Context.h Basis.h Matrix.h Sample.h
PSDWavefunctionStepper.o: AtomSet.h Atom.h Species.h Control.h
PSDWavefunctionStepper.o: WavefunctionStepper.h Timer.h
PSDWavefunctionStepper.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h
PSDWavefunctionStepper.o: Species.h Wavefunction.h UnitCell.h Control.h
PSDWavefunctionStepper.o: Timer.h SlaterDet.h Basis.h Matrix.h
PSDWavefunctionStepper.o: WavefunctionStepper.h Sample.h AtomSet.h Context.h
PSDWavefunctionStepper.o: Atom.h D3vector.h Species.h Wavefunction.h
PSDWavefunctionStepper.o: UnitCell.h Control.h Timer.h
qb.o: Context.h UserInterface.h Sample.h AtomSet.h Atom.h D3vector.h
qb.o: Species.h Wavefunction.h UnitCell.h Control.h Timer.h AtomCmd.h
qb.o: HelpCmd.h ListAtomsCmd.h ListSpeciesCmd.h LoadCmd.h PrintCmd.h
qb.o: QuitCmd.h RandomizeWfCmd.h RunCmd.h SaveCmd.h SetCmd.h SpeciesCmd.h
qb.o: StatusCmd.h AtomsDyn.h Cell.h Ecut.h Emass.h Dt.h Ecutprec.h Nempty.h
qb.o: Nrowmax.h Thermostat.h ThTemp.h ThTime.h WfDiag.h WfDyn.h SlaterDet.h
qb.o: Basis.h Matrix.h Xc.h
qb.o: StatusCmd.h AtomsDyn.h Cell.h CellDyn.h SlaterDet.h Basis.h Matrix.h
qb.o: CellLock.h CellMass.h Ecut.h Ecutprec.h Ecuts.h Emass.h ExtStress.h
qb.o: Dt.h Nempty.h Nrowmax.h RefCell.h Stress.h Thermostat.h ThTemp.h
qb.o: ThTime.h WfDiag.h WfDyn.h Xc.h
QuitCmd.o: UserInterface.h Sample.h AtomSet.h Context.h Atom.h D3vector.h
QuitCmd.o: Species.h Wavefunction.h UnitCell.h Control.h
RandomizeWfCmd.o: UserInterface.h Sample.h AtomSet.h Context.h Atom.h
RandomizeWfCmd.o: D3vector.h Species.h Wavefunction.h UnitCell.h Control.h
RefCell.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
RefCell.o: Wavefunction.h UnitCell.h Control.h
RunCmd.o: RunCmd.h UserInterface.h Sample.h AtomSet.h Context.h Atom.h
RunCmd.o: D3vector.h Species.h Wavefunction.h UnitCell.h Control.h
RunCmd.o: EnergyFunctional.h ChargeDensity.h StructureFactor.h Timer.h
......@@ -275,12 +294,16 @@ SDIonicStepper.o: UnitCell.h Control.h
SDIonicStepper.o: IonicStepper.h Sample.h AtomSet.h Context.h Atom.h
SDIonicStepper.o: D3vector.h Species.h Wavefunction.h UnitCell.h Control.h
SDWavefunctionStepper.o: SDWavefunctionStepper.h WavefunctionStepper.h
SDWavefunctionStepper.o: Timer.h Wavefunction.h D3vector.h UnitCell.h
SDWavefunctionStepper.o: SlaterDet.h Context.h Basis.h Matrix.h Sample.h
SDWavefunctionStepper.o: AtomSet.h Atom.h Species.h Control.h
SDWavefunctionStepper.o: WavefunctionStepper.h Timer.h
SDWavefunctionStepper.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h
SDWavefunctionStepper.o: Species.h Wavefunction.h UnitCell.h Control.h
SDWavefunctionStepper.o: Timer.h SlaterDet.h Basis.h Matrix.h
SDWavefunctionStepper.o: WavefunctionStepper.h Sample.h AtomSet.h Context.h
SDWavefunctionStepper.o: Atom.h D3vector.h Species.h Wavefunction.h
SDWavefunctionStepper.o: UnitCell.h Control.h Timer.h
SetCmd.o: UserInterface.h Sample.h AtomSet.h Context.h Atom.h D3vector.h
SetCmd.o: Species.h Wavefunction.h UnitCell.h Control.h
SigmaExt.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
SigmaExt.o: Wavefunction.h UnitCell.h Control.h
sinft.o: sinft.h
SlaterDet.o: SlaterDet.h Context.h Basis.h D3vector.h UnitCell.h Matrix.h
SlaterDet.o: Timer.h FourierTransform.h blas.h
......@@ -304,6 +327,8 @@ SpeciesReaderHandler.o: Species.h Context.h StrX.h
spline.o: spline.h
StatusCmd.o: UserInterface.h Sample.h AtomSet.h Context.h Atom.h D3vector.h
StatusCmd.o: Species.h Wavefunction.h UnitCell.h Control.h
Stress.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
Stress.o: Wavefunction.h UnitCell.h Control.h
StructuredDocumentHandler.o: StructuredDocumentHandler.h StrX.h
StructuredDocumentHandler.o: StructureHandler.h
StructuredDocumentHandler.o: StrX.h StructureHandler.h
......@@ -358,9 +383,11 @@ WavefunctionHandler.o: Basis.h Matrix.h Timer.h FourierTransform.h StrX.h
WavefunctionHandler.o: StructureHandler.h UnitCell.h D3vector.h
WavefunctionHandler.o: Wavefunction.h SlaterDet.h Context.h Basis.h Matrix.h
WavefunctionHandler.o: Timer.h
WavefunctionStepper.o: WavefunctionStepper.h Wavefunction.h D3vector.h
WavefunctionStepper.o: UnitCell.h SlaterDet.h Context.h Basis.h Matrix.h
WavefunctionStepper.o: Timer.h Sample.h AtomSet.h Atom.h Species.h Control.h
WavefunctionStepper.o: WavefunctionStepper.h Sample.h AtomSet.h Context.h
WavefunctionStepper.o: Atom.h D3vector.h Species.h Wavefunction.h UnitCell.h
WavefunctionStepper.o: Control.h Timer.h SlaterDet.h Basis.h Matrix.h
WavefunctionStepper.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h
WavefunctionStepper.o: Species.h Wavefunction.h UnitCell.h Control.h Timer.h
WfDiag.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
WfDiag.o: Wavefunction.h UnitCell.h Control.h
WfDyn.o: Sample.h AtomSet.h Context.h Atom.h D3vector.h Species.h
......
......@@ -3,7 +3,7 @@
// NonLocalPotential.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: NonLocalPotential.h,v 1.2 2003-10-02 17:36:34 fgygi Exp $
// $Id: NonLocalPotential.h,v 1.3 2004-02-04 19:55:17 fgygi Exp $
#ifndef NONLOCALPOTENTIAL_H
#define NONLOCALPOTENTIAL_H
......@@ -19,9 +19,9 @@ class NonLocalPotential
private:
const Context& ctxt_;
const AtomSet& atoms_;
const SlaterDet& sd_;
const Basis& basis_;
const AtomSet& atoms_;
int nsp; // number of species
int nspnl; // number of non-local species
......@@ -36,7 +36,7 @@ class NonLocalPotential
vector<vector<int> > lproj; // lproj[is][ipr]
vector<vector<double> > wt; // wt[is][ipr]
vector<vector<double> > twnl; // twnl[is][npr*ngwl]
vector<vector<double> > dtwnl; // dtwnl[is][3*npr*ngwl]
vector<vector<double> > dtwnl; // dtwnl[is][6*npr*ngwl], ij=0,..,5
vector<DoubleMatrix*> anl; // anl[is][ipr*ia][ig]
vector<vector<double> > singr; // singr[is][naloc*2*ngwloc]
......@@ -51,7 +51,7 @@ class NonLocalPotential
public:
NonLocalPotential(const AtomSet& as, const SlaterDet& sd) :
atoms_(as), sd_(sd), ctxt_(sd.context()), basis_(sd.basis()) { init(); }
ctxt_(sd.context()), atoms_(as), sd_(sd), basis_(sd.basis()) { init(); }
~NonLocalPotential(void);
void update_twnl(void);
......@@ -59,6 +59,6 @@ class NonLocalPotential
void update_anl(void);
double energy(bool compute_hpsi, SlaterDet& dsd,
bool compute_forces, vector<vector<double> >& fion,
bool compute_stress, UnitCell& dcell);
bool compute_stress, valarray<double>& sigma_enl);
};
#endif
......@@ -3,7 +3,7 @@
// PSDAWavefunctionStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: PSDAWavefunctionStepper.C,v 1.3 2004-01-22 01:31:40 fgygi Exp $
// $Id: PSDAWavefunctionStepper.C,v 1.4 2004-02-04 19:55:16 fgygi Exp $
#include "PSDAWavefunctionStepper.h"
#include "Wavefunction.h"
......@@ -14,12 +14,16 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////
PSDAWavefunctionStepper::PSDAWavefunctionStepper(Sample& s, TimerMap& tmap) :
s_(s), wf_(s.wf), wf_last_(s.wf), dwf_last_(s.wf), tmap_(tmap),
WavefunctionStepper(s,tmap), wf_last_(s.wf), dwf_last_(s.wf),
extrapolate_(false)
{
dt_ = s_.ctrl.dt;
const double emass = s_.ctrl.emass;
dt2bye_ = (emass == 0.0) ? 0.5 / wf_.ecut() : dt_*dt_/emass;
// divide dt2bye by facs coefficient if stress == ON
if ( s_.ctrl.stress == "ON" )
dt2bye_ /= s_.ctrl.facs;
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -3,29 +3,19 @@
// PSDAWavefunctionStepper.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: PSDAWavefunctionStepper.h,v 1.1 2003-11-27 01:30:31 fgygi Exp $
// $Id: PSDAWavefunctionStepper.h,v 1.2 2004-02-04 19:55:16 fgygi Exp $
#ifndef PSDAWAVEFUNCTIONSTEPPER_H
#define PSDAWAVEFUNCTIONSTEPPER_H
class Sample;
#include "Wavefunction.h"
#include "WavefunctionStepper.h"
#include "Timer.h"
#include <map>
#include <string>
#include <valarray>
using namespace std;
typedef map<string,Timer> TimerMap;
class PSDAWavefunctionStepper : public WavefunctionStepper
{
private:
Sample& s_;
Wavefunction& wf_;
Wavefunction wf_last_, dwf_last_;
double dt_, dt2bye_;
TimerMap& tmap_;
// Anderson acceleration flag
bool extrapolate_;
......
......@@ -3,7 +3,7 @@
// PSDWavefunctionStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: PSDWavefunctionStepper.C,v 1.2 2003-12-19 00:33:32 fgygi Exp $
// $Id: PSDWavefunctionStepper.C,v 1.3 2004-02-04 19:55:16 fgygi Exp $
#include "PSDWavefunctionStepper.h"
#include "Wavefunction.h"
......@@ -14,11 +14,15 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////
PSDWavefunctionStepper::PSDWavefunctionStepper(Sample& s, TimerMap& tmap) :
s_(s), wf_(s.wf), tmap_(tmap)
WavefunctionStepper(s,tmap)
{
dt_ = s_.ctrl.dt;
const double emass = s_.ctrl.emass;
dt2bye_ = (emass == 0.0) ? 0.5 / wf_.ecut() : dt_*dt_/emass;
// divide dt2bye by facs coefficient if stress == ON
if ( s_.ctrl.stress == "ON" )
dt2bye_ /= s_.ctrl.facs;
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -3,27 +3,18 @@
// PSDWavefunctionStepper.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: PSDWavefunctionStepper.h,v 1.1 2003-11-21 20:01:06 fgygi Exp $
// $Id: PSDWavefunctionStepper.h,v 1.2 2004-02-04 19:55:16 fgygi Exp $
#ifndef PSDWAVEFUNCTIONSTEPPER_H
#define PSDWAVEFUNCTIONSTEPPER_H
class Sample;
class Wavefunction;
#include "WavefunctionStepper.h"
#include "Timer.h"
#include <map>
#include <string>
using namespace std;
typedef map<string,Timer> TimerMap;
class PSDWavefunctionStepper : public WavefunctionStepper
{
private:
Sample& s_;
Wavefunction& wf_;
double dt_, dt2bye_;
TimerMap& tmap_;
public:
......
......@@ -3,7 +3,7 @@
// SDWavefunctionStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SDWavefunctionStepper.C,v 1.1 2003-11-21 20:01:06 fgygi Exp $
// $Id: SDWavefunctionStepper.C,v 1.2 2004-02-04 19:55:16 fgygi Exp $
#include "SDWavefunctionStepper.h"
#include "Wavefunction.h"
......@@ -14,11 +14,15 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////
SDWavefunctionStepper::SDWavefunctionStepper(Sample& s, TimerMap& tmap) :
s_(s), wf_(s.wf), tmap_(tmap)
WavefunctionStepper(s,tmap)
{
dt_ = s_.ctrl.dt;
const double emass = s_.ctrl.emass;
dt2bye_ = (emass == 0.0) ? 0.5 / wf_.ecut() : dt_*dt_/emass;
dt2bye_ = (emass == 0.0) ? 0.5 / wf_.ecut() : dt_*dt_/emass;
// divide dt2bye by facs coefficient if stress == ON
if ( s_.ctrl.stress == "ON" )
dt2bye_ /= s_.ctrl.facs;
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -3,27 +3,18 @@
// SDWavefunctionStepper.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SDWavefunctionStepper.h,v 1.1 2003-11-21 20:01:06 fgygi Exp $
// $Id: SDWavefunctionStepper.h,v 1.2 2004-02-04 19:55:16 fgygi Exp $
#ifndef SDWAVEFUNCTIONSTEPPER_H
#define SDWAVEFUNCTIONSTEPPER_H
class Sample;
class Wavefunction;
#include "WavefunctionStepper.h"
#include "Timer.h"
#include <map>
#include <string>
using namespace std;
typedef map<string,Timer> TimerMap;
class SDWavefunctionStepper : public WavefunctionStepper
{
private:
Sample& s_;
Wavefunction& wf_;
double dt_, dt2bye_;
TimerMap& tmap_;
public:
......
......@@ -3,7 +3,7 @@
// Sample.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Sample.h,v 1.5 2003-06-11 22:10:11 fgygi Exp $
// $Id: Sample.h,v 1.6 2004-02-04 19:55:16 fgygi Exp $
#ifndef SAMPLE_H
#define SAMPLE_H
......@@ -27,6 +27,7 @@ class Sample
Wavefunction* wfv; // wavefunction velocity
Control ctrl;
Sample(const Context& ctxt) : ctxt_(ctxt), atoms(ctxt), wf(ctxt), wfv(0) {}
Sample(const Context& ctxt) : ctxt_(ctxt), atoms(ctxt), wf(ctxt), wfv(0)
{ ctrl.sigmas = 0.5; ctrl.facs = 2.0; }
};
#endif
......@@ -3,7 +3,7 @@
// UnitCell.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: UnitCell.C,v 1.6 2003-09-16 16:24:26 fgygi Exp $
// $Id: UnitCell.C,v 1.7 2004-02-04 19:55:17 fgygi Exp $
#include "UnitCell.h"
#include <iostream>
......@@ -166,9 +166,9 @@ bool UnitCell::contains(D3vector v) const
const double p0 = fac * v * b_[0];
const double p1 = fac * v * b_[1];
const double p2 = fac * v * b_[2];
return ( (p0 > 0.0) && (p0 < 1.0) &&
(p1 > 0.0) && (p1 < 1.0) &&
(p2 > 0.0) && (p2 < 1.0) );
return ( (p0 > 0.0) && (p0 <= 1.0) &&
(p1 > 0.0) && (p1 <= 1.0) &&
(p2 > 0.0) && (p2 <= 1.0) );
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -3,23 +3,36 @@
// WavefunctionStepper.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: WavefunctionStepper.h,v 1.3 2003-11-27 01:20:59 fgygi Exp $
// $Id: WavefunctionStepper.h,v 1.4 2004-02-04 19:55:16 fgygi Exp $
#ifndef WAVEFUNCTIONSTEPPER_H
#define WAVEFUNCTIONSTEPPER_H