Commit 7e8b36d5 by Francois Gygi

fix -wfs option

git-svn-id: http://qboxcode.org/svn/qb/trunk@1561 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 4278d4ab
......@@ -63,6 +63,7 @@ int PlotCmd::action(int argc, char **argv)
bool xyz = true;
bool plot_density = false;
bool plot_wf = false;
bool plot_wfs = false;
int nmin,nmax,nwf;
// ispin = 0: plot both spins
// ispin = 1: plot first spin
......@@ -79,7 +80,6 @@ int PlotCmd::action(int argc, char **argv)
{
plot_density = true;
xyz = false;
filename = argv[iarg];
}
else if ( !strcmp(argv[iarg],"-wf") )
{
......@@ -106,7 +106,7 @@ int PlotCmd::action(int argc, char **argv)
}
else if ( !strcmp(argv[iarg],"-wfs") )
{
plot_wf = true;
plot_wfs = true;
xyz = false;
// process argument: nmin
iarg++;
......@@ -137,7 +137,7 @@ int PlotCmd::action(int argc, char **argv)
}
else if ( !strcmp(argv[iarg],"-spin") )
{
if ( !(plot_density || plot_wf ) )
if ( !(plot_density || plot_wf || plot_wfs) )
{
if ( ui->onpe0() )
cout << usage << endl;
......@@ -176,7 +176,7 @@ int PlotCmd::action(int argc, char **argv)
} // while iarg
// Must specify spin if plotting wave functions when nspin==2
if ( s->wf.nspin()==2 && plot_wf && ispin==0 )
if ( s->wf.nspin()==2 && (plot_wf||plot_wfs) && ispin==0 )
{
if ( ui->onpe0() )
cout << " must use -spin if nspin==2" << endl;
......@@ -269,9 +269,9 @@ int PlotCmd::action(int argc, char **argv)
}
}
} // plot_density
else if ( plot_wf )
else if ( plot_wf || plot_wfs )
{
// compute wf and store in tmpr
// compute wf or wf squared and store in tmpr
if ( ctxt.onpe0() )
{
ctxt.ibcast_send(1,1,&nwf,1);
......@@ -319,6 +319,7 @@ int PlotCmd::action(int argc, char **argv)
vector<complex<double> > wftmp(ft.np012loc());
vector<double> wftmpr(ft.np012());
tmpr.resize(ft.np012());
tmpr.assign(ft.np012(),0.0);
for ( int isp = isp_min; isp <= isp_max; isp++ )
{
......@@ -412,26 +413,26 @@ int PlotCmd::action(int argc, char **argv)
if ( c.context().onpe0() )
{
// wftmpr is now complete on task 0
if ( nwf == 1 )
if ( plot_wfs )
{
// only one wf
// multiple wfs, accumulate square
for ( int i = 0; i < ft.np012(); i++ )
{
tmpr[i] = wftmpr[i];
tmpr[i] += wftmpr[i]*wftmpr[i];
}
}
else
{
// multiple wfs, accumulate square
// plot individual wf
for ( int i = 0; i < ft.np012(); i++ )
{
tmpr[i] += wftmpr[i]*wftmpr[i];
tmpr[i] = wftmpr[i];
}
}
}
} // for n
} // for isp
} // if plot_wf
} // if plot_wf || plot_wfs
// tmpr now contains the function to plot on task 0
......@@ -495,7 +496,7 @@ int PlotCmd::action(int argc, char **argv)
}
} // if plot_atoms
if ( plot_density || plot_wf )
if ( plot_density || plot_wf || plot_wfs )
{
// process the function in tmpr
if ( ctxt.onpe0() )
......
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