本文整理汇总了C++中SweepParams::calc_niter方法的典型用法代码示例。如果您正苦于以下问题:C++ SweepParams::calc_niter方法的具体用法?C++ SweepParams::calc_niter怎么用?C++ SweepParams::calc_niter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SweepParams
的用法示例。
在下文中一共展示了SweepParams::calc_niter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: responseSweep
void responseSweep(double sweep_tol, int targetState, vector<int>& projectors, vector<int>& baseStates)
{
double last_fe = 1.e6;
double last_be = 1.e6;
double old_fe = 0.;
double old_be = 0.;
SweepParams sweepParams;
bool direction, warmUp, restart;
int restartSize=0;
direction = true; //forward
warmUp = true; //startup sweep
restart = false; //not a restart
sweepParams.current_root() = -1;
algorithmTypes atype = dmrginp.algorithm_method();
dmrginp.set_algorithm_method() = ONEDOT;
//the baseState is the initial guess for the targetState
if (FULLRESTART) {
sweepParams.restorestate(direction, restartSize);
direction = !direction;
dmrginp.setGuessState() = targetState;
last_fe = SweepResponse::do_one(sweepParams, warmUp, direction, restart, restartSize, targetState, projectors, baseStates);
bool tempdirection;
sweepParams.restorestate(tempdirection, restartSize);
sweepParams.calc_niter();
sweepParams.set_sweep_iter() = 0;
sweepParams.set_restart_iter() = 0;
sweepParams.savestate(tempdirection, restartSize);
}
else if (RESTART) {
dmrginp.set_algorithm_method() = atype;
warmUp = false;
restart = true;
sweepParams.restorestate(direction, restartSize);
last_fe = SweepResponse::do_one(sweepParams, warmUp, direction, restart, restartSize, targetState, projectors, baseStates);
}
else
last_fe = SweepResponse::do_one(sweepParams, warmUp, direction, restart, restartSize, targetState, projectors, baseStates);
dmrginp.set_algorithm_method() = atype;
restart = false;
restartSize = 0;
warmUp = false;
while ( true)
{
old_fe = last_fe;
old_be = last_be;
if(dmrginp.max_iter() <= sweepParams.get_sweep_iter())
break;
last_be = SweepResponse::do_one(sweepParams, warmUp, !direction, restart, restartSize, targetState, projectors, baseStates);
p1out << "\t\t\t Finished Sweep Iteration "<<sweepParams.get_sweep_iter()<<endl;
if(dmrginp.max_iter() <= sweepParams.get_sweep_iter())
break;
last_fe = SweepResponse::do_one(sweepParams, warmUp, direction, restart, restartSize, targetState, projectors, baseStates);
pout << "\t\t\t Finished Sweep Iteration "<<sweepParams.get_sweep_iter()<<endl;
}
}
示例2: calldmrg
//.........这里部分代码省略.........
break;
}
case (CALCHAMILTONIAN):
{
pout.precision(12);
for (int istate = 0; istate<dmrginp.nroots(); istate++) {
bool direction;
int restartsize;
sweepParams.restorestate(direction, restartsize);
if (mpigetrank() == 0) {
Sweep::InitializeStateInfo(sweepParams, !direction, istate);
Sweep::InitializeStateInfo(sweepParams, direction, istate);
Sweep::CanonicalizeWavefunction(sweepParams, !direction, istate);
Sweep::CanonicalizeWavefunction(sweepParams, direction, istate);
Sweep::CanonicalizeWavefunction(sweepParams, !direction, istate);
}
}
//Sweep::calculateHMatrixElements(H);
pout << "overlap "<<endl<<O<<endl;
pout << "hamiltonian "<<endl<<H<<endl;
break;
}
case (DMRG):
{
if (RESTART && !FULLRESTART)
restart(sweep_tol, reset_iter);
else if (FULLRESTART) {
fullrestartGenblock();
reset_iter = true;
sweepParams.restorestate(direction, restartsize);
sweepParams.calc_niter();
sweepParams.savestate(direction, restartsize);
restart(sweep_tol, reset_iter);
}
else if (BACKWARD) {
fullrestartGenblock();
reset_iter = true;
sweepParams.restorestate(direction, restartsize);
sweepParams.calc_niter();
sweepParams.savestate(direction, restartsize);
restart(sweep_tol, reset_iter);
}
else {
dmrg(sweep_tol);
}
break;
}
case (FCI):
Sweep::fullci(sweep_tol);
break;
case (TINYCALC):
Sweep::tiny(sweep_tol);
break;
case (ONEPDM):
Npdm::npdm(NPDM_ONEPDM);
if (dmrginp.hamiltonian() == BCS) {
Npdm::npdm(NPDM_PAIRMATRIX,true);
}
break;
case (TWOPDM):
Npdm::npdm(NPDM_TWOPDM);