Commit cc980738 by Francois Gygi

fix mlwf calculation for spin polarized case

git-svn-id: http://qboxcode.org/svn/qb/trunk@1292 cba15fb0-1239-40c8-b417-11db7ca47a34
parent d1e2f6f0
......@@ -998,10 +998,11 @@ void BOSampleStepper::step(int niter)
if ( onpe0 )
{
D3vector edipole_sum;
cout << "<mlwfs>" << endl;
for ( int ispin = 0; ispin < nspin; ispin++ )
{
SlaterDet& sd = *(wf.sd(ispin,0));
cout << " <mlwf_set spin=\"" << ispin
cout << " <mlwfset spin=\"" << ispin
<< "\" size=\"" << sd.nst() << "\">" << endl;
for ( int i = 0; i < sd.nst(); i++ )
{
......@@ -1017,11 +1018,11 @@ void BOSampleStepper::step(int niter)
<< endl;
}
cout << " </mlwf_set>" << endl;
D3vector edipole = mlwft[ispin]->dipole();
cout << " <electronic_dipole spin=\"" << ispin << "\"> " << edipole
<< " </electronic_dipole>" << endl;
edipole_sum += edipole;
cout << " </mlwfset>" << endl;
}
D3vector idipole = atoms.dipole();
cout << " <ionic_dipole> " << idipole
......@@ -1030,6 +1031,7 @@ void BOSampleStepper::step(int niter)
<< " </total_dipole>" << endl;
cout << " <total_dipole_length> " << length(idipole + edipole_sum)
<< " </total_dipole_length>" << endl;
cout << "</mlwfs>" << endl;
}
}
......
......@@ -42,6 +42,7 @@ int ComputeMLWFCmd::action(int argc, char **argv)
if ( ui->onpe0() )
cout << "<mlwfs>" << endl;
D3vector edipole_sum;
for ( int ispin = 0; ispin < wf.nspin(); ispin++ )
{
SlaterDet& sd = *(wf.sd(ispin,0));
......@@ -68,20 +69,24 @@ int ComputeMLWFCmd::action(int argc, char **argv)
<< endl;
}
D3vector edipole = mlwft->dipole();
cout << " <electronic_dipole> " << edipole
cout << " <electronic_dipole spin=\"" << ispin << "\"> " << edipole
<< " </electronic_dipole>" << endl;
D3vector idipole = s->atoms.dipole();
cout << " <ionic_dipole> " << idipole
<< " </ionic_dipole>" << endl;
cout << " <total_dipole> " << idipole + edipole
<< " </total_dipole>" << endl;
cout << " <total_dipole_length> " << length(idipole + edipole)
<< " </total_dipole_length>" << endl;
cout << " </mlwfset>" << endl;
edipole_sum += edipole;
}
delete mlwft;
}
if ( ui->onpe0() )
{
D3vector idipole = s->atoms.dipole();
cout << " <ionic_dipole> " << idipole
<< " </ionic_dipole>" << endl;
cout << " <total_dipole> " << idipole + edipole_sum
<< " </total_dipole>" << endl;
cout << " <total_dipole_length> " << length(idipole + edipole_sum)
<< " </total_dipole_length>" << endl;
cout << "</mlwfs>" << endl;
}
return 0;
}
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