当前位置: 首页>>代码示例>>C++>>正文


C++ SweepParams::calc_niter方法代码示例

本文整理汇总了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;
      
    }
  
}
开发者ID:chrinide,项目名称:Block,代码行数:67,代码来源:dmrg.C

示例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);
开发者ID:chrinide,项目名称:Block,代码行数:67,代码来源:dmrg.C


注:本文中的SweepParams::calc_niter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。