本文整理汇总了C++中SweepParams::get_keep_states_ls方法的典型用法代码示例。如果您正苦于以下问题:C++ SweepParams::get_keep_states_ls方法的具体用法?C++ SweepParams::get_keep_states_ls怎么用?C++ SweepParams::get_keep_states_ls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SweepParams
的用法示例。
在下文中一共展示了SweepParams::get_keep_states_ls方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dmrg
void dmrg(double sweep_tol)
{
double last_fe = 10.e6;
double last_be = 10.e6;
double old_fe = 0.;
double old_be = 0.;
SweepParams sweepParams;
int old_states=sweepParams.get_keep_states();
int new_states;
double old_error=0.0;
double old_energy=0.0;
// warm up sweep ...
bool dodiis = false;
int domoreIter = 0;
bool direction;
//this is regular dmrg calculation
if(!dmrginp.setStateSpecific()) {
sweepParams.current_root() = -1;
last_fe = Sweep::do_one(sweepParams, true, true, false, 0);
direction = false;
while ((fabs(last_fe - old_fe) > sweep_tol) || (fabs(last_be - old_be) > sweep_tol) ||
(dmrginp.algorithm_method() == TWODOT_TO_ONEDOT && dmrginp.twodot_to_onedot_iter()+1 >= sweepParams.get_sweep_iter()) )
{
old_fe = last_fe;
old_be = last_be;
if(dmrginp.max_iter() <= sweepParams.get_sweep_iter())
break;
last_be = Sweep::do_one(sweepParams, false, false, false, 0);
direction = true;
pout << "\t\t\t Finished Sweep Iteration "<<sweepParams.get_sweep_iter()<<endl;
if(dmrginp.max_iter() <= sweepParams.get_sweep_iter())
break;
//For obtaining the extrapolated energy
old_states=sweepParams.get_keep_states();
new_states=sweepParams.get_keep_states_ls();
last_fe = Sweep::do_one(sweepParams, false, true, false, 0);
direction = false;
new_states=sweepParams.get_keep_states();
pout << "\t\t\t Finished Sweep Iteration "<<sweepParams.get_sweep_iter()<<endl;
if (domoreIter == 2) {
dodiis = true;
break;
}
}
}
else { //this is state specific calculation
const int nroots = dmrginp.nroots();
bool direction=true;
int restartsize;
//sweepParams.restorestate(direction, restartsize);
//sweepParams.set_sweep_iter() = 0;
//sweepParams.set_restart_iter() = 0;
algorithmTypes atype;
pout << "STARTING STATE SPECIFIC CALCULATION "<<endl;
for (int i=0; i<nroots; i++) {
atype = dmrginp.algorithm_method();
dmrginp.set_algorithm_method() = ONEDOT;
sweepParams.current_root() = i;
p1out << "RUNNING GENERATE BLOCKS FOR STATE "<<i<<endl;
if (mpigetrank()==0) {
Sweep::InitializeStateInfo(sweepParams, direction, i);
Sweep::InitializeStateInfo(sweepParams, !direction, i);
Sweep::CanonicalizeWavefunction(sweepParams, direction, i);
Sweep::CanonicalizeWavefunction(sweepParams, !direction, i);
Sweep::CanonicalizeWavefunction(sweepParams, direction, i);
Sweep::InitializeStateInfo(sweepParams, direction, i);
Sweep::InitializeStateInfo(sweepParams, !direction, i);
}
for (int j=0; j<i ; j++) {
int integralIndex = 0;
Sweep::InitializeOverlapSpinBlocks(sweepParams, direction, i, j, integralIndex);
Sweep::InitializeOverlapSpinBlocks(sweepParams, !direction, i, j, integralIndex);
}
dmrginp.set_algorithm_method() = atype;
p1out << "RUNNING GENERATE BLOCKS FOR STATE "<<i<<endl;
SweepGenblock::do_one(sweepParams, false, !direction, false, 0, i, i);
sweepParams.set_sweep_iter() = 0;
sweepParams.set_restart_iter() = 0;
sweepParams.savestate(!direction, restartsize);
pout << "STATE SPECIFIC CALCULATION FOR STATE: "<<i<<endl;
//.........这里部分代码省略.........