Commit fe82c329 by Francois Gygi

stress-related variables


git-svn-id: http://qboxcode.org/svn/qb/trunk@172 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 0674f5ce
////////////////////////////////////////////////////////////////////////////////
//
// CellDyn.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: CellDyn.h,v 1.1 2004-02-04 19:52:27 fgygi Exp $
#ifndef CELLDYN_H
#define CELLDYN_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
#include "Wavefunction.h"
#include "SlaterDet.h"
class CellDyn : public Var
{
Sample *s;
public:
char *name ( void ) const { return "cell_dyn"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " cell_dyn takes only one value" << endl;
return 1;
}
string v = argv[1];
if ( !( v == "LOCKED" || v == "SD" || v == "MD" ) )
{
if ( ui->onpe0() )
cout << " cell_dyn must be in [LOCKED,SD,MD]" << endl;
return 1;
}
s->ctrl.cell_dyn = v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << s->ctrl.cell_dyn;
return st.str();
}
CellDyn(Sample *sample) : s(sample) { s->ctrl.cell_dyn = "LOCKED"; };
};
#endif
////////////////////////////////////////////////////////////////////////////////
//
// CellLock.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: CellLock.h,v 1.1 2004-02-04 19:52:27 fgygi Exp $
#ifndef CELLLOCK_H
#define CELLLOCK_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class CellLock : public Var
{
Sample *s;
public:
char *name ( void ) const { return "cell_lock"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " cell_lock takes only one value" << endl;
return 1;
}
string v = argv[1];
if ( !( v == "OFF" || v == "A" || v == "B" || v == "C" ||
v == "AB" || v == "AC" || v == "BC" ) )
{
if ( ui->onpe0() )
cout << " cell_lock must be in [OFF,A,B,C,AB,AC,BC]" << endl;
return 1;
}
s->ctrl.cell_lock = v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << s->ctrl.cell_lock;
return st.str();
}
CellLock(Sample *sample) : s(sample) { s->ctrl.cell_lock = "OFF"; }
};
#endif
////////////////////////////////////////////////////////////////////////////////
//
// CellMass.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: CellMass.h,v 1.1 2004-02-04 19:52:27 fgygi Exp $
#ifndef CELLMASS_H
#define CELLMASS_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class CellMass : public Var
{
Sample *s;
public:
char *name ( void ) const { return "cell_mass"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " cell_mass takes only one value" << endl;
return 1;
}
double v = atof(argv[1]);
if ( v <= 0.0 )
{
if ( ui->onpe0() )
cout << " cell_mass must be positive" << endl;
return 1;
}
s->ctrl.cell_mass = v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << s->ctrl.cell_mass;
return st.str();
}
CellMass(Sample *sample) : s(sample) { s->ctrl.cell_mass = 10000.0; }
};
#endif
////////////////////////////////////////////////////////////////////////////////
//
// Ecuts.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Ecuts.h,v 1.1 2004-02-04 19:52:27 fgygi Exp $
#ifndef ECUTS_H
#define ECUTS_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class Ecuts : public Var
{
Sample *s;
public:
char *name ( void ) const { return "ecuts"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " ecuts takes only one value" << endl;
return 1;
}
double v = atof(argv[1]);
if ( v < 0.0 )
{
if ( ui->onpe0() )
cout << " ecuts must be non-negative" << endl;
return 1;
}
s->ctrl.ecuts = 0.5 * v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << 2 * s->ctrl.ecuts;
return st.str();
}
Ecuts(Sample *sample) : s(sample) { s->ctrl.ecuts = 0.0; }
};
#endif
////////////////////////////////////////////////////////////////////////////////
//
// ExtStress.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: ExtStress.h,v 1.1 2004-02-04 19:52:27 fgygi Exp $
#ifndef EXTSTRESS_H
#define EXTSTRESS_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class ExtStress : public Var
{
Sample *s;
public:
char *name ( void ) const { return "ext_stress"; };
int set ( int argc, char **argv )
{
if ( argc != 7 )
{
if ( ui->onpe0() )
cout << " ext_stress must be specified as s_xx,s_yy,s_zz,s_xy,s_yz,s_xz"
<< endl;
return 1;
}
for ( int i = 0; i < 6; i++ )
s->ctrl.ext_stress[i] = atof(argv[i+1]);
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
for ( int i = 0; i < 6; i++ )
st << setw(10) << s->ctrl.ext_stress[i];
return st.str();
}
ExtStress(Sample *sample) : s(sample) {};
};
#endif
////////////////////////////////////////////////////////////////////////////////
//
// RefCell.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: RefCell.h,v 1.1 2004-02-04 19:52:27 fgygi Exp $
#ifndef REFCELL_H
#define REFCELL_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class RefCell : public Var
{
Sample *s;
public:
char *name ( void ) const { return "ref_cell"; };
int set ( int argc, char **argv )
{
if ( argc != 10 )
{
if ( ui->onpe0() )
cout << " ref_cell must be specified with 3 vectors (9 values)" << endl;
return 1;
}
D3vector a0(atof(argv[1]),atof(argv[2]),atof(argv[3]));
D3vector a1(atof(argv[4]),atof(argv[5]),atof(argv[6]));
D3vector a2(atof(argv[7]),atof(argv[8]),atof(argv[9]));
UnitCell ref_cell(a0,a1,a2);
if ( ref_cell.volume() < 0.0 )
{
if ( ui->onpe0() )
cout << " ref_cell volume must be positive" << endl;
return 1;
}
s->wf.resize(s->wf.cell(), ref_cell,s->wf.ecut());
if ( s->wfv != 0 )
{
s->wfv->resize(s->wf.cell(),s->wf.refcell(),s->wf.ecut());
s->wfv->clear();
}
if ( ui->onpe0() )
{
cout << " <reference_unit_cell>\n"
<< s->wf.refcell()
<< " </reference_unit_cell>" << endl;
}
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << s->wf.refcell();
return st.str();
}
RefCell(Sample *sample) : s(sample) {}
};
#endif
////////////////////////////////////////////////////////////////////////////////
//
// Stress.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Stress.h,v 1.1 2004-02-04 19:52:27 fgygi Exp $
#ifndef STRESS_H
#define STRESS_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class Stress : public Var
{
Sample *s;
public:
char *name ( void ) const { return "stress"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " stress takes only one value" << endl;
return 1;
}
string v = argv[1];
if ( !( v == "ON" || v == "OFF" ) )
{
if ( ui->onpe0() )
cout << " stress must be ON or OFF" << endl;
return 1;
}
s->ctrl.stress = v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << s->ctrl.stress;
return st.str();
}
Stress(Sample *sample) : s(sample) { s->ctrl.stress = "OFF"; }
};
#endif
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