Skip to content
Snippets Groups Projects
Commit 96cf1a1d authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

RashbaSOC: without Rashba works

parent 576bbc24
No related branches found
No related tags found
No related merge requests found
......@@ -88,27 +88,27 @@ namespace LanczosPlusPlus {
SizeType electrons() const { return npart_; }
SizeType isThereAnElectronAt(WordType ket,SizeType site) const
static SizeType isThereAnElectronAt(WordType ket,SizeType site)
{
return (ket & bitmask_[site]) ? 1 : 0;
}
SizeType getN(WordType ket,SizeType site) const
static SizeType getN(WordType ket,SizeType site)
{
return isThereAnElectronAt(ket,site);
}
int doSign(WordType a, SizeType i) const
static int doSign(WordType a, SizeType i)
{
if (i==nsite_-1) return 1;
if (i == nsite_ - 1) return 1;
a &= ((1 << (i+1)) - 1) ^ ((1 << nsite_) - 1);
// Parity of single occupied between i and nsite-1
int s=(PsimagLite::BitManip::count(a) & 1) ? FERMION_SIGN : 1;
int s = (PsimagLite::BitManip::count(a) & 1) ? FERMION_SIGN : 1;
return s;
}
int doSign(WordType ket,SizeType i,SizeType j) const
static int doSign(WordType ket,SizeType i,SizeType j)
{
assert(i <= j);
SizeType x0 = (i+1); // i+1 cannot be the last site, 'cause i<j
......@@ -170,9 +170,11 @@ namespace LanczosPlusPlus {
}
}
static SizeType comb(SizeType n, SizeType m) { return comb_(n, m); }
private:
SizeType getNbyKet(SizeType ket,SizeType from,SizeType upto) const
static SizeType getNbyKet(SizeType ket,SizeType from,SizeType upto)
{
SizeType sum = 0;
SizeType counter = from;
......@@ -180,13 +182,14 @@ namespace LanczosPlusPlus {
if (ket & bitmask_[counter]) sum++;
counter++;
}
return sum;
}
void doCombinatorial()
static void doCombinatorial()
{
/* look-up table for binomial coefficients */
comb_.resize(2*nsite_, 2*nsite_, 0);
comb_.resize(2*nsite_ + 2, 2*nsite_ + 2, 0);
for (SizeType n=0;n<comb_.n_row();n++) {
SizeType m = 0;
......
......@@ -19,14 +19,36 @@ public:
typedef BasisOneSpin BasisType;
typedef BasisBase<GeometryType> BaseType;
typedef typename BaseType::WordType WordType;
typedef std::pair<WordType, WordType> PairWordType;
typedef typename PsimagLite::Vector<PairWordType>::Type VectorPairWordType;
typedef typename BaseType::VectorWordType VectorWordType;
typedef typename BaseType::LabeledOperatorType LabeledOperatorType;
static int const FERMION_SIGN = BasisType::FERMION_SIGN;
BasisRashbaSOC(const GeometryType& geometry, SizeType ne)
: ne_(ne),
basis_(geometry.numberOfSites(), ne)
{}
: ne_(ne)
{
const SizeType nsite = geometry.numberOfSites();
BasisOneSpin bogus(nsite, 1); // does the comb
const SizeType hilbert = BasisOneSpin::comb(2*nsite, ne);
data_.resize(hilbert);
SizeType k = 0;
for (SizeType ndown = 0; ndown <= ne; ++ndown) {
const SizeType nup = ne - ndown;
BasisOneSpin basisUp(nsite, nup);
BasisOneSpin basisDown(nsite, ndown);
const SizeType sizeUp = basisUp.size();
const SizeType sizeDown = basisDown.size();
for (SizeType i = 0; i < sizeUp; ++i) {
for (SizeType j = 0; j < sizeDown; ++j) {
data_[k++] = PairWordType(basisUp[i], basisDown[j]);
}
}
}
assert(k == hilbert);
}
PairIntType parts() const
{
......@@ -38,7 +60,7 @@ public:
return BasisType::bitmask(i);
}
SizeType size() const { return basis_.size(); }
SizeType size() const { return data_.size(); }
//! Spin up and spin down
SizeType dofs() const
......@@ -58,7 +80,10 @@ public:
SizeType perfectIndex(WordType ket1,WordType ket2) const
{
throw PsimagLite::RuntimeError("dofs() perfectIndex\n");
const PairWordType p(ket1, ket2);
auto it = std::find(data_.begin(), data_.end(), p);
if (it != data_.end()) return it - data_.begin();
throw PsimagLite::RuntimeError("perfectIndex(): Index not found for state\n");
}
SizeType perfectIndex(WordType newKet,
......@@ -70,55 +95,59 @@ public:
WordType operator()(SizeType i,SizeType spin) const
{
throw PsimagLite::RuntimeError("operator()\n");
assert(i < data_.size());
return (spin == ProgramGlobals::SPIN_UP) ? data_[i].first : data_[i].second;
}
PairIntType getBraIndex(WordType ket1,
WordType ket2,
const LabeledOperatorType&,
SizeType site,
SizeType spin,
SizeType orb) const
WordType ket2,
const LabeledOperatorType&,
SizeType site,
SizeType spin,
SizeType orb) const
{
throw PsimagLite::RuntimeError("getBraIndex()\n");
}
int doSign(WordType ket1,
WordType ket2,
SizeType i,
SizeType orb1,
SizeType j,
SizeType orb2,
SizeType spin) const
WordType ket2,
SizeType i,
SizeType orb1,
SizeType j,
SizeType orb2,
SizeType spin) const
{
throw PsimagLite::RuntimeError("doSign()\n");
assert(i <= j);
return (spin == SPIN_UP) ? BasisOneSpin::doSign(ket1, i, j)
: BasisOneSpin::doSign(ket2,i,j);
}
int doSignGf(WordType a,
WordType b,
SizeType ind,
SizeType spin,
SizeType orb) const
WordType b,
SizeType ind,
SizeType spin,
SizeType orb) const
{
throw PsimagLite::RuntimeError("doSignGf()\n");
}
int doSignSpSm(WordType a,
WordType b,
SizeType ind,
SizeType spin,
SizeType orb) const
WordType b,
SizeType ind,
SizeType spin,
SizeType orb) const
{
return 1;
}
SizeType isThereAnElectronAt(WordType ket1,
WordType ket2,
SizeType site,
SizeType spin,
SizeType orb) const
WordType ket2,
SizeType site,
SizeType spin,
SizeType) const
{
throw PsimagLite::RuntimeError("isThereAnElectronAt()\n");
return (spin == ProgramGlobals::SPIN_UP) ? BasisOneSpin::isThereAnElectronAt(ket1, site)
: BasisOneSpin::isThereAnElectronAt(ket2, site);
}
SizeType orbsPerSite(SizeType i) const { return 1; }
......@@ -126,20 +155,21 @@ public:
SizeType orbs() const { return 1; }
SizeType getN(WordType ket1,
WordType ket2,
SizeType site,
SizeType spin,
SizeType orb) const
WordType ket2,
SizeType site,
SizeType spin,
SizeType) const
{
throw PsimagLite::RuntimeError("getN()\n");
return (spin == ProgramGlobals::SPIN_UP) ? BasisOneSpin::getN(ket1, site)
: BasisOneSpin::getN(ket2, site);
}
bool getBra(WordType&,
WordType,
WordType,
const LabeledOperatorType&,
SizeType,
SizeType) const
WordType,
WordType,
const LabeledOperatorType&,
SizeType,
SizeType) const
{
throw PsimagLite::RuntimeError("getBra()\n");
}
......@@ -152,7 +182,7 @@ public:
private:
SizeType ne_;
BasisType basis_;
VectorPairWordType data_;
}; // class BasisRashbaSOC
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment