Commit e51d2ffd by mahe

re-wrote part of response and vext code, added base64-encoded IO mode

parent 8dc36961
......@@ -31,17 +31,31 @@ class ExternalPotential
Sample& s_;
int n_[3]; // real space grid size in 3 dimensions
// read from cube file in cube file mode,
// otherwise must be given in constructer
int n012_;
double ecut_;
double magnitude_; // the magnitude of external potential, defined as
// the average of its largest 0.1% (absolute) values
double amplitude_; // overall scaling factor of external potential
vector<double> vext_r_; // vext in real space
std::string filename_; // file name for external potential
std::string io_; // "cube", "base64_serial" or "base64_parallel"
public:
ExternalPotential(Sample& s,std::string name): s_(s),
filename_(name), ecut_(0.0), amplitude_(1.0) {}
ExternalPotential(Sample& s, std::string name, std::string io="cube",
int nx=0, int ny=0, int nz=0):
s_(s), filename_(name), ecut_(0.0), amplitude_(0.0), magnitude_(0.0), io_(io){
assert( io_ == "cube" || io == "base64_serial" || io == "base64_parallel" );
if (io != "cube")
{
n_[0] = nx;
n_[1] = ny;
n_[2] = nz;
n012_ = n_[0] * n_[1] * n_[2];
}
}
~ExternalPotential() {}
int n(int i) const { return n_[i]; }
......
......@@ -27,7 +27,8 @@ class ResponseCmd : public Cmd
{
private:
void responseVext(bool rpa, int nitscf, int nite);
void responseVext(bool rpa, int nitscf, int nite,
string io, int nx, int ny, int nz);
void responseEfield(double amplitude, int nitscf, int nite);
public:
......@@ -42,12 +43,22 @@ class ResponseCmd : public Cmd
return
"\n response\n\n"
" syntax: response amplitude nitscf [nite]\n"
" response -vext vext_file [-RPA] [-amplitude a] nitscf [nite]\n\n"
" response -vext vext_file [-RPA] [-amplitude a] \n"
" [-io iomode -nx nx -ny ny -nz nz] nitscf [nite]\n\n"
" The response command computes the polarizability tensor by\n"
" finite differences using external electric fields in the x,y,z\n"
" directions with magnitude defined by the amplitude argument.\n"
" If the -vext option is used, the response command computes the\n"
" response to the external potential defined in the file vext_file.\n\n";
" response to the external potential defined in the file vext_file.\n"
" Acceptable control flags are:\n"
" 1. -RPA. Compute response within Random Phase Approximation, Vxc is frozen.\n"
" 2. -amplitude a. Scale the Vext by a before any calculations, \n"
" then scale the charge density response by 1/a before output.\n"
" 3. -io iomode. How the vext/response file shall be read/write. Possible choice:\n"
" cube: Gaussian cube format.\n"
" base64_serial or base64_parallel: base64-encoded binary grid function.\n"
" grid size need to be specified by nx, ny, nz.\n"
" use cube for best compatibility and base64_parallel for best performance\n\n";
}
int action(int argc, char **argv);
......
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