Commit 2a968697 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

ChemicalH: placeholders in BasisWithOperators

parent 8f80cd89
......@@ -243,7 +243,7 @@ public:
assert(operatorsPerSite_.size() > 0);
}
PairType getOperatorIndices(SizeType i,SizeType sigma) const
PairType localOperatorIndices(SizeType i,SizeType sigma) const
{
SizeType sum = 0;
for (SizeType j=0;j<i;j++) {
......@@ -255,7 +255,7 @@ public:
return PairType(sum + sigma,operatorsPerSite_[i]);
}
const OperatorType& getOperatorByIndex(int i) const
const OperatorType& localOperatorByIndex(int i) const
{
return operators_.getLocalByIndex(i);
}
......@@ -273,10 +273,9 @@ public:
return operatorsPerSite_[i];
}
int fermionicSign(SizeType i,int fsign) const
int fermionicSign(SizeType i, int fsign) const
{
const BasisType &parent = *this;
return parent.fermionicSign(i,fsign);
return BasisType::fermionicSign(i, fsign);
}
template<typename SomeOutputType>
......@@ -326,7 +325,7 @@ private:
const SizeType nlocalOps = numberOfLocalOperators();
for (SizeType i = 0; i < nlocalOps; ++i) {
if (i<basis2.numberOfLocalOperators()) {
const OperatorType& myOp = basis2.getOperatorByIndex(i);
const OperatorType& myOp = basis2.localOperatorByIndex(i);
bool isFermion = (myOp.fermionOrBoson() ==
ProgramGlobals::FermionOrBosonEnum::FERMION);
if (savedSign != myOp.fermionOrBoson() || fermionicSigns.size() == 0) {
......@@ -345,7 +344,7 @@ private:
} else {
const OperatorType& myOp = basis3.
getOperatorByIndex(i - basis2.numberOfLocalOperators());
localOperatorByIndex(i - basis2.numberOfLocalOperators());
bool isFermion = (myOp.fermionOrBoson() ==
ProgramGlobals::FermionOrBosonEnum::FERMION);
......
......@@ -109,10 +109,10 @@ private:
{
PairSizeType ii;
if (type == ProgramGlobals::SysOrEnvEnum::SYSTEM) {
ii = lrs_.left().getOperatorIndices(i, sigma);
ii = lrs_.left().localOperatorIndices(i, sigma);
} else {
assert(type == ProgramGlobals::SysOrEnvEnum::ENVIRON);
ii = lrs_.right().getOperatorIndices(i, sigma);
ii = lrs_.right().localOperatorIndices(i, sigma);
}
return ii.first;
......
......@@ -203,7 +203,7 @@ public:
bool isSuperExcluded(SizeType) const
{
throw PsimagLite::RuntimeError("Operators.h: isLocalExcluded not written yet\n");
throw PsimagLite::RuntimeError("Operators.h: isSuperExcluded not written yet\n");
}
VectorOperatorType& operators_;
......@@ -245,6 +245,7 @@ public:
if (prefix[last] != '/') prefix += "/";
io.read(operators_, prefix + "Operators");
//io.read(superOps_, prefix + "SuperOperators");
io.read(hamiltonian_, prefix + "Hamiltonian");
}
......@@ -306,6 +307,7 @@ public:
SizeType x)
{
operators_.resize(x);
// ChemicalH: Set super ops here
}
/* PSIDOC OperatorsExternalProduct
......@@ -394,6 +396,7 @@ public:
PsimagLite::IsOutputLike<SomeIoOutType>::True, int*>::Type = 0) const
{
io.overwrite(operators_, s + "/Operators");
// io.overwrite(superOps_, s + "/SuperOperators");
io.overwrite(hamiltonian_, s + "/Hamiltonian");
}
......@@ -401,20 +404,21 @@ public:
const PsimagLite::String& s,
PsimagLite::IoNgSerializer::WriteMode mode) const
{
if (mode == PsimagLite::IoNgSerializer::ALLOW_OVERWRITE)
if (mode == PsimagLite::IoNgSerializer::ALLOW_OVERWRITE) {
io.overwrite(operators_, s + "/Operators");
else
io.write(operators_, s + "/Operators");
if (mode == PsimagLite::IoNgSerializer::ALLOW_OVERWRITE)
// io.overwrite(superOps_, s + "/SuperOperators");
io.overwrite(hamiltonian_, s + "/Hamiltonian");
else
} else {
io.write(operators_, s + "/Operators");
// io.write(superOps_, s + "/SuperOperators");
io.write(hamiltonian_, s + "/Hamiltonian");
}
}
void clear()
{
operators_.clear();
superOps_.clear();
hamiltonian_.clear();
}
......
......@@ -59,10 +59,10 @@ public:
const OperatorStorageType* m = 0;
if (type == ProgramGlobals::SysOrEnvEnum::SYSTEM) {
m = &(lrs_.left().getOperatorByIndex(iifirst).getStorage());
m = &(lrs_.left().localOperatorByIndex(iifirst).getStorage());
} else {
assert(type == ProgramGlobals::SysOrEnvEnum::ENVIRON);
m =&(lrs_.right().getOperatorByIndex(iifirst).getStorage());
m =&(lrs_.right().localOperatorByIndex(iifirst).getStorage());
}
m->checkValidity();
......
......@@ -57,9 +57,11 @@ private:
os<<"Operators at site "<<site<<" ("<<siteC<<")\n";
for (SizeType sigma = 0; sigma < end; ++sigma) {
typename BasisWithOperatorsType::PairType p = basis.getOperatorIndices(siteC, sigma);
os<<sigma<<" non-zeroes="<<basis.getOperatorByIndex(p.first).getStorage().nonZeros();
os<<" rows="<<basis.getOperatorByIndex(p.first).getStorage().rows()<<"\n";
typename BasisWithOperatorsType::PairType p = basis.localOperatorIndices(siteC,
sigma);
os<<sigma<<" non-zeroes=";
os<<basis.localOperatorByIndex(p.first).getStorage().nonZeros();
os<<" rows="<<basis.localOperatorByIndex(p.first).getStorage().rows()<<"\n";
}
}
......
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