Commit e3dc87a6 by Francois Gygi

added -no_wfv option


git-svn-id: http://qboxcode.org/svn/qb/trunk@647 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 5b3031d6
......@@ -15,7 +15,7 @@
// SampleWriter.C:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SampleWriter.C,v 1.9 2008-09-08 15:56:19 fgygi Exp $
// $Id: SampleWriter.C,v 1.10 2008-09-08 16:26:36 fgygi Exp $
#include "SampleWriter.h"
......@@ -34,8 +34,8 @@ SampleWriter::SampleWriter(const Context& ctxt) : ctxt_(ctxt) {}
////////////////////////////////////////////////////////////////////////////////
void SampleWriter::writeSample(const Sample& s, const string filename,
string description,
bool base64, bool atomsonly, bool serial)
string description, bool base64,
bool atomsonly, bool serial, bool save_wfv)
{
Timer tm;
tm.start();
......@@ -71,7 +71,7 @@ void SampleWriter::writeSample(const Sample& s, const string filename,
if ( !atomsonly )
{
s.wf.print(os,encoding,"wavefunction");
if ( s.wfv != 0 )
if ( save_wfv && s.wfv != 0 )
s.wfv->print(os,encoding,"wavefunction_velocity");
}
......@@ -132,7 +132,7 @@ void SampleWriter::writeSample(const Sample& s, const string filename,
if ( !atomsonly )
{
s.wf.write(sfp,encoding,"wavefunction");
if ( s.wfv != 0 )
if ( save_wfv && s.wfv != 0 )
s.wfv->write(sfp,encoding,"wavefunction_velocity");
}
......
......@@ -15,7 +15,7 @@
// SampleWriter.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SampleWriter.h,v 1.6 2008-09-08 15:56:19 fgygi Exp $
// $Id: SampleWriter.h,v 1.7 2008-09-08 16:26:36 fgygi Exp $
#ifndef SAMPLEWRITER_H
#define SAMPLEWRITER_H
......@@ -34,7 +34,7 @@ class SampleWriter
SampleWriter(const Context& ctxt);
void writeSample(const Sample& s, const std::string filename,
std::string description,
bool base64, bool atomsonly, bool serial);
bool base64, bool atomsonly, bool serial, bool save_wfv);
};
class SampleWriterException
......
......@@ -15,7 +15,7 @@
// SaveCmd.C:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SaveCmd.C,v 1.16 2008-09-08 15:56:19 fgygi Exp $
// $Id: SaveCmd.C,v 1.17 2008-09-08 16:26:36 fgygi Exp $
#include "SaveCmd.h"
......@@ -28,7 +28,8 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////
int SaveCmd::action(int argc, char **argv)
{
string usage(" Use: save [-text|-base64] [-atomsonly] [-serial] filename");
string usage(" Use: save [-text] [-atomsonly]");
usage += string(" [-serial] [-no_wfv] filename");
if ( !(argc>=2 && argc<=4 ) )
{
if ( ui->onpe0() )
......@@ -36,10 +37,11 @@ int SaveCmd::action(int argc, char **argv)
return 1;
}
// set default encoding
// set default encoding and flags
bool base64 = true;
bool atomsonly = false;
bool serial = false;
bool save_wfv = true;
char* filename = 0;
// check for -text or -base64 or -atomsonly or -serial arguments
......@@ -59,6 +61,10 @@ int SaveCmd::action(int argc, char **argv)
{
serial = true;
}
else if ( arg=="-no_wfv" )
{
save_wfv = false;
}
else if ( arg[0] != '-' && i == argc-1 )
{
filename = argv[i];
......@@ -80,7 +86,8 @@ int SaveCmd::action(int argc, char **argv)
SampleWriter swriter(s->ctxt_);
string description = string(" Created ") + isodate() +
string(" by qbox-") + release() + string(" ");
swriter.writeSample(*s, filename, description, base64, atomsonly, serial);
swriter.writeSample(*s, filename, description, base64, atomsonly, serial,
save_wfv);
return 0;
}
......@@ -15,7 +15,7 @@
// SaveCmd.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SaveCmd.h,v 1.5 2008-09-08 15:56:19 fgygi Exp $
// $Id: SaveCmd.h,v 1.6 2008-09-08 16:26:36 fgygi Exp $
#ifndef SAVECMD_H
#define SAVECMD_H
......@@ -42,10 +42,14 @@ class SaveCmd : public Cmd
{
return
"\n save\n\n"
" syntax: save [-serial] [-text] filename \n\n"
" syntax: save [-serial] [-text] [-atomsonly] [-no_wfv] filename \n\n"
" The save command saves the sample to the file filename.\n\n"
" When using the -serial option, I/O is performed from the \n"
" head node only. \n\n";
" head node only. If the -text option is used, wavefunctions\n"
" are saved in formatted form instead of base64 encoding. The\n"
" -atomsonly option is used to save the atomset only without the\n"
" wavefunctions. If the -no_wfv option is used, wavefunction\n"
" velocities are not saved.\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