Commit b490b0d6 by Francois Gygi

spin polarization added

git-svn-id: http://qboxcode.org/svn/qb/trunk@1099 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 527b1490
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
// SampleReader.C: // SampleReader.C:
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: SampleReader.C,v 1.31 2009-11-30 02:45:55 fgygi Exp $
#include "Sample.h" #include "Sample.h"
#include "SampleReader.h" #include "SampleReader.h"
...@@ -75,8 +73,8 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial) ...@@ -75,8 +73,8 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
Wavefunction* current_wf = &s.wf; Wavefunction* current_wf = &s.wf;
vector<vector<vector<double> > > dmat; vector<vector<vector<double> > > dmat;
int nx, ny, nz; // size of <grid> in wavefunction int nx, ny, nz; // size of <grid> in wavefunction
const int nspin = 1; int nspin = 1;
const int current_ispin = 0; int current_ispin = 0;
int current_ikp; int current_ikp;
dmat.resize(nspin); dmat.resize(nspin);
...@@ -292,7 +290,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial) ...@@ -292,7 +290,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
current_ikp = 0; current_ikp = 0;
// Wavefunction // Wavefunction
read_wf = true; read_wf = true;
int nel,nspin,nempty; int nel,nempty;
ctxt_.ibcast_recv(1,1,&nel,1,0,0); ctxt_.ibcast_recv(1,1,&nel,1,0,0);
ctxt_.ibcast_recv(1,1,&nspin,1,0,0); ctxt_.ibcast_recv(1,1,&nspin,1,0,0);
ctxt_.ibcast_recv(1,1,&nempty,1,0,0); ctxt_.ibcast_recv(1,1,&nempty,1,0,0);
...@@ -388,9 +386,12 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial) ...@@ -388,9 +386,12 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
{ {
// process SlaterDet // process SlaterDet
// receive kpoint and weight // receive kpoint and weight
double buf[4]; double buf[6];
ctxt_.dbcast_recv(4,1,buf,4,0,0); ctxt_.dbcast_recv(6,1,buf,6,0,0);
current_wf->add_kpoint(D3vector(buf[0],buf[1],buf[2]),buf[3]); current_ispin=(int) buf[4];
current_ikp=(int) buf[5];
if ( current_ispin == 0 )
current_wf->add_kpoint(D3vector(buf[0],buf[1],buf[2]),buf[3]);
// receive density_matrix // receive density_matrix
vector<double> dmat_tmp(current_wf->nst()); vector<double> dmat_tmp(current_wf->nst());
...@@ -515,7 +516,8 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial) ...@@ -515,7 +516,8 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
DoubleMatrix wftmpr(sd->context(),wftmpr_size,sd->nst(), DoubleMatrix wftmpr(sd->context(),wftmpr_size,sd->nst(),
wftmpr_block_size,c.nb()); wftmpr_block_size,c.nb());
wftmpr.getsub(gfdata,wftmpr_size,sd->nst(),0,ikp*sd->nst()); wftmpr.getsub(gfdata,wftmpr_size,sd->nst(),0,
ikp*sd->nst()+ispin*s.wf.nkp()*sd->nst());
#if DEBUG #if DEBUG
// Check orthogonality by computing overlap matrix // Check orthogonality by computing overlap matrix
......
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