107 (*lineq) = *orig.
lineq;
138 std::function<double(int,int)> getT = [&hamin] (
int a,
int b) ->
double {
return hamin.
getTmat(a,b); };
139 std::function<double(int,int,int,int)> getV = [&hamin] (
int a,
int b,
int c,
int d) ->
double {
return hamin.
getVmat(a,b,c,d); };
141 ham->ham(getT, getV);
167 unsigned int tot_iter = 0;
174 std::ostream* fp = &std::cout;
178 fout.open(
outfile, std::ios::out | std::ios::app);
181 std::ostream &out = *fp;
183 out.setf(std::ios::scientific | std::ios::fixed, std::ios_base::floatfield);
185 auto start = std::chrono::high_resolution_clock::now();
191 out << iter <<
"\t" << std::setw(16) <<
t <<
"\t" << std::setw(16) <<
rdm->getMatrices().trace() <<
"\t" << std::setw(16) <<
rdm->getVectors().trace() <<
"\t" << std::setw(16) <<
rdm->ddot(*
ham)*
norm_ham +
nuclrep <<
"\t" << std::setw(16) <<
rdm->S_2() << std::endl;
193 double convergence = 1.0;
226 convergence = a*a*delta.
ddot(delta);
229 out << cg_iters <<
"\t" << convergence << std::endl;
255 extrapol -= backup_rdm;
262 rdm->daxpy(a,extrapol);
265 auto end = std::chrono::high_resolution_clock::now();
271 out <<
"Trace: " <<
rdm->trace() << std::endl;
272 out <<
"pd gap: " <<
t*
rdm->gn() << std::endl;
273 out <<
"S^2: " <<
rdm->S_2() << std::endl;
274 out <<
"Runtime: " << std::fixed << std::chrono::duration_cast<std::chrono::duration<double,std::ratio<1>>>(end-start).count() <<
" s" << std::endl;
277 out <<
"total nr of iterations = " << tot_iter << std::endl;
void BuildHam(const CheMPS2::Hamiltonian &)
PotentialReduction * Clone() const
std::unique_ptr< TPM > ham
double line_search(double t, SUP &, const TPM &) const
std::unique_ptr< Lineq > lineq
double getVmat(const int index1, const int index2, const int index3, const int index4) const
Get a Vmat element.
double ddot(const Container &) const
PotentialReduction * Move()
bool FullyConverged() const
void constr_grad(double t, const SUP &, const TPM &, const Lineq &)
double getTmat(const int index1, const int index2) const
Get a Tmat element.
PotentialReduction(const CheMPS2::Hamiltonian &)
PotentialReduction & operator=(PotentialReduction &&)=default
void set_tolerance(double)
std::unique_ptr< TPM > rdm
double getFullEnergy() const
double getEconst() const
Get the constant energy.
double evalEnergy() const
int getL() const
Get the number of orbitals.
int solve(double t, const SUP &, TPM &, const Lineq &)
void set_reduction(double)