Commit 79f2ba55 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

TwoPointCorrelations: prepare to implement actions

parent 2d7de1d5
......@@ -28,6 +28,8 @@ public:
return pred.isTrue("%0", s0, "%1", s1, "%2", s2, "%3", s3);
}
bool nonTrivial() const { return nonTrivial_; }
private:
bool nonTrivial_;
......
......@@ -206,7 +206,8 @@ public:
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
"gs",
"gs");
"gs",
manyPointAction);
std::cout << str << std::endl;
std::cout << out;
}
......@@ -606,7 +607,13 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
ManyPointActionType emptyAction(false, "");
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
//std::cout << m;
std::cout << "PairPair Correlations S^{l}_{on}" << std::endl;
SliceOrbital(m,0,0);
......@@ -851,6 +858,7 @@ private:
SizeType orbitals = logBase2(model_.hilbertSize(site));
assert(!(orbitals & 1));
orbitals /= 2;
ManyPointActionType emptyAction(false, "");
if (flag==0) {
SizeType orb1 = 0; // lower orbital
......@@ -876,7 +884,12 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
std::cout << m;
} else if (flag==1) {
......@@ -902,7 +915,12 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
std::cout << m;
} else if (flag==2) {
SizeType spin0 = 0; // up
......@@ -932,7 +950,12 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
std::cout << m;
} else if (flag==3) {
SizeType spin0 = 0; // up
......@@ -962,7 +985,12 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
std::cout << m;
} else if (flag==4) {
SizeType orb0 = 0; // lower orbital
......@@ -987,7 +1015,12 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
std::cout << m;
} else if (flag==5) {
SizeType orb0 = 0; // lower orbital
......@@ -1012,7 +1045,12 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
std::cout << m;
} else if (flag==6) {
SizeType spin0 = 0; // up
......@@ -1043,7 +1081,12 @@ private:
su2Related);
BraketType braket(model_, "<gs|c'*c;c'*c|gs>");
braket.forceOperators(opA, opB);
observe_.twoPoint(m, braket, ProgramGlobals::FermionOrBosonEnum::BOSON, bra, ket);
observe_.twoPoint(m,
braket,
ProgramGlobals::FermionOrBosonEnum::BOSON,
bra,
ket,
emptyAction);
std::cout << m;
} else {
err("Unknown flag: " + ttos(flag));
......@@ -1310,7 +1353,7 @@ private:
storage = new MatrixType(rows,cols);
}
observe_.twoPoint(*storage, braket, needsPrinting);
observe_.twoPoint(*storage, braket, needsPrinting, someAction);
if (needsPrinting) {
delete storage;
......
......@@ -151,7 +151,10 @@ public:
return (!es && helper_.site(ptr) == 1);
}
void twoPoint(MatrixType& storage, const BraketType& braket, bool needsPrinting) const
void twoPoint(MatrixType& storage,
const BraketType& braket,
bool needsPrinting,
const ManyPointActionType& action) const
{
assert(braket.points() == 2);
......@@ -175,13 +178,16 @@ public:
switch (flag) {
case 0: // no sites given
twopoint_(storage, braket, fermionSign, braket.bra(), braket.ket());
twopoint_(storage, braket, fermionSign, braket.bra(), braket.ket(), action);
if (needsPrinting)
std::cout<<(storage);
break;
case 1: //first site given
if (action.nonTrivial())
err("For non trivial action, give no sites\n");
for (site1 = braket.site(0); site1 < sites; ++site1) {
storage(braket.site(0),site1) = twopoint_.calcCorrelation(braket.site(0),
site1,
......@@ -199,6 +205,9 @@ public:
break;
case 3:
if (action.nonTrivial())
err("For non trivial action, give no sites\n");
storage(braket.site(0),braket.site(1)) = twopoint_.calcCorrelation(braket.site(0),
braket.site(1),
braket,
......@@ -219,9 +228,10 @@ public:
const BraketType braket,
ProgramGlobals::FermionOrBosonEnum fermionicSign,
PsimagLite::String bra,
PsimagLite::String ket) const
PsimagLite::String ket,
const ManyPointActionType& action) const
{
twopoint_(m, braket, fermionicSign, bra, ket);
twopoint_(m, braket, fermionicSign, bra, ket, action);
}
FieldType threePoint(const BraketType& braket,
......
......@@ -89,6 +89,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include "ProgramGlobals.h"
#include "GetBraOrKet.h"
#include "SdhsReinterpret.h"
#include "ManyPointAction.h"
namespace Dmrg {
......@@ -110,6 +111,7 @@ public:
typedef Parallel2PointCorrelations<ThisType> Parallel2PointCorrelationsType;
typedef typename Parallel2PointCorrelationsType::PairType PairType;
typedef SdhsReinterpret<BraketType> SdhsReinterpretType;
typedef ManyPointAction ManyPointActionType;
TwoPointCorrelations(const CorrelationsSkeletonType& skeleton) : skeleton_(skeleton)
{}
......@@ -118,7 +120,8 @@ public:
const BraketType& braket,
ProgramGlobals::FermionOrBosonEnum fermionicSign,
const PsimagLite::GetBraOrKet& bra,
const PsimagLite::GetBraOrKet& ket) const
const PsimagLite::GetBraOrKet& ket,
const ManyPointActionType& action) const
{
SizeType rows = w.n_row();
SizeType cols = w.n_col();
......
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