Commit a1d2c640 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

PrintHamiltonianAverage=

PrintHamiltonianAverage=predicate awesome

The predicate awesome accepts two optional variables,
s, which represents the site of the current center of
orthogonality, and c, which is the center site of the lattice.
To print only when at the middle of the lattice, say,
PrintHamiltonianAverage=s==c
To print at every center, say
PrintHamiltonianAverage=1==1
To never print, don't add PrintHamiltonianAverage
parent 112c3c3b
......@@ -206,6 +206,7 @@ public:
knownLabels_.push_back("ThreadsStackSize");
knownLabels_.push_back("RecoverySave");
knownLabels_.push_back("Intent");
knownLabels_.push_back("PrintHamiltonianAverage");
for (SizeType i = 0; i < 10; ++i)
knownLabels_.push_back("Term" + ttos(i));
}
......@@ -357,7 +358,6 @@ public:
them for all sites. This is will use more RAM, but might be needed
to target expressions.
\item [calcAndPrintEntropies] Calculate entropies and print to cout file
\item [printHamiltonianAverage] Print <...|H|...> in NGSTs.
\item [blasNotThreadSafe] TBW
\end{itemize}
*/
......@@ -425,7 +425,6 @@ public:
registerOpts.push_back("shrinkStacksOnDisk");
registerOpts.push_back("OperatorsChangeAll");
registerOpts.push_back("calcAndPrintEntropies");
registerOpts.push_back("printHamiltonianAverage");
registerOpts.push_back("blasNotThreadSafe");
PsimagLite::Options::Writeable optWriteable(registerOpts,
......
......@@ -159,6 +159,7 @@ struct ParametersDmrgSolver {
PsimagLite::String model;
PsimagLite::String insitu;
PsimagLite::String recoverySave;
PsimagLite::String printHamiltonianAverage;
RestartStruct checkpoint;
typename QnType::VectorQnType adjustQuantumNumbers;
VectorFiniteLoopType finiteLoop;
......@@ -187,6 +188,7 @@ struct ParametersDmrgSolver {
ioSerializer.write(root + "/model", model);
ioSerializer.write(root + "/insitu", insitu);
ioSerializer.write(root + "/recoverySave", recoverySave);
ioSerializer.write(root + "/printHamiltonianAverage", printHamiltonianAverage);
checkpoint.write(label + "/checkpoint", ioSerializer);
ioSerializer.write(root + "/adjustQuantumNumbers", adjustQuantumNumbers);
ioSerializer.write(root + "/finiteLoop", finiteLoop);
......@@ -359,6 +361,10 @@ struct ParametersDmrgSolver {
keptStatesInfinite = 0;
}
try {
io.readline(printHamiltonianAverage, "PrintHamiltonianAverage=");
} catch (std::exception&) {}
if (options.find("restart")!=PsimagLite::String::npos) {
if (!infLoopsIsAnInt and hasRestartFrom) {
PsimagLite::String tmp = "FATAL: RestartFilename found in input ";
......
......@@ -87,6 +87,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include "CrsMatrix.h"
#include "TargetingBase.h"
#include "Io/IoSelector.h"
#include "PredicateAwesome.h"
namespace Dmrg {
......@@ -276,11 +277,15 @@ public:
bool doBorderIfBorder = true;
this->common().cocoon(block1, direction, doBorderIfBorder);
PsimagLite::String options = this->model().params().options;
if (options.find("printHamiltonianAverage") != std::string::npos)
PsimagLite::String predicate = model_.params().printHamiltonianAverage;
const SizeType linSize = model_.geometry().numberOfSites();
PsimagLite::PredicateAwesome<>::replaceAll(predicate, "c", ttos(linSize));
PsimagLite::PredicateAwesome<> pAwesome(predicate);
assert(block1.size() > 0);
if (pAwesome.isTrue("s", block1[0]))
printEnergies(); // in-situ
PsimagLite::String options = this->model().params().options;
bool normalizeTimeVectors = true;
if (options.find("neverNormalizeVectors") != std::string::npos)
normalizeTimeVectors = false;
......
......@@ -81,6 +81,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include "TimeVectorsSuzukiTrotter.h"
#include "TargetingBase.h"
#include "BlockDiagonalMatrix.h"
#include "PredicateAwesome.h"
namespace Dmrg {
......@@ -273,11 +274,15 @@ private:
bool doBorderIfBorder = false;
this->common().cocoon(block1, direction, doBorderIfBorder);
PsimagLite::String options = this->model().params().options;
if (options.find("printHamiltonianAverage") != std::string::npos)
PsimagLite::String predicate = this->model().params().printHamiltonianAverage;
const SizeType linSize = this->model().geometry().numberOfSites();
PsimagLite::PredicateAwesome<>::replaceAll(predicate, "c", ttos(linSize));
PsimagLite::PredicateAwesome<> pAwesome(predicate);
assert(block1.size() > 0);
if (pAwesome.isTrue("s", block1[0]))
printEnergies(); // in-situ
PsimagLite::String options = this->model().params().options;
bool normalizeTimeVectors =
(options.find("normalizeTimeVectors") != std::string::npos);
if (options.find("TargetingAncilla") != std::string::npos)
......
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