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


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

本文整理汇总了C++中SweepParams::get_additional_noise方法的典型用法代码示例。如果您正苦于以下问题:C++ SweepParams::get_additional_noise方法的具体用法?C++ SweepParams::get_additional_noise怎么用?C++ SweepParams::get_additional_noise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SweepParams的用法示例。


在下文中一共展示了SweepParams::get_additional_noise方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: hq

void SpinAdapted::Sweep::fullci(double sweep_tol)
{
  int integralIndex = 0;
  SweepParams sweepParams;
  sweepParams.set_sweep_parameters();


  StackSpinBlock system, sysdot;
  InitBlocks::InitStartingBlock(system, true, 0, 0, sweepParams.get_forward_starting_size(),  sweepParams.get_backward_starting_size(), 0, false, true, integralIndex);
  int numsites = dmrginp.spinAdapted() ? dmrginp.last_site() : dmrginp.last_site()/2;
  int forwardsites = numsites/2+numsites%2;
  int backwardsites = numsites - forwardsites;
  SpinQuantum hq(0,SpinSpace(0),IrrepSpace(0));


  StackSpinBlock newSystem;
  for (int i=0; i<forwardsites-1; i++) {
    sysdot = StackSpinBlock(i+1, i+1, integralIndex, true);
    system.addAdditionalOps();
    newSystem.set_integralIndex() = integralIndex;
    if (i == forwardsites-2)
      newSystem.default_op_components(true, true, false, true);
    else
      newSystem.default_op_components(false, true, false, true);

    newSystem.setstoragetype(DISTRIBUTED_STORAGE);
    newSystem.BuildSumBlock (NO_PARTICLE_SPIN_NUMBER_CONSTRAINT, system, sysdot);

    long memoryToFree = newSystem.getdata() - system.getdata();
    long newsysMemory = newSystem.memoryUsed();
    if (i != forwardsites-2) {
      if (i != 0) {
	newSystem.moveToNewMemory(system.getdata());
	Stackmem[0].deallocate(newSystem.getdata()+newSystem.memoryUsed(), memoryToFree);
      }
      system.clear();
      system = newSystem;
    }
  }

  StackSpinBlock environment, newEnvironment, envdot;
  InitBlocks::InitStartingBlock(environment, false, 0, 0, sweepParams.get_forward_starting_size(),  sweepParams.get_backward_starting_size(), 0, false, true, integralIndex);
  for (int i=0;i <backwardsites-1; i++) {
    envdot = StackSpinBlock(numsites-2-i, numsites-2-i, integralIndex, true);
    environment.addAdditionalOps();
    newEnvironment.set_integralIndex() = integralIndex;
    if (i == backwardsites-2)
      newEnvironment.default_op_components(true, false, true, true);
    else
      newEnvironment.default_op_components(false, false, true, true);
    newEnvironment.setstoragetype(DISTRIBUTED_STORAGE);
    newEnvironment.BuildSumBlock (NO_PARTICLE_SPIN_NUMBER_CONSTRAINT, environment, envdot);

    if (i!=backwardsites-2) {
      if (i != 0) {
	long memoryToFree = newEnvironment.getdata() - environment.getdata();
	long newenvMemory = newEnvironment.memoryUsed();
	newEnvironment.moveToNewMemory(environment.getdata());
	Stackmem[0].deallocate(newEnvironment.getdata()+newEnvironment.memoryUsed(), memoryToFree);
      }
      environment.clear();
      environment = newEnvironment;
    }
  }

  pout <<"\t\t\t System Block :: "<< newSystem;
  pout <<"\t\t\t Environment Block :: "<< newEnvironment;
  newSystem.set_loopblock(true); newEnvironment.set_loopblock(false);
  StackSpinBlock big;
  InitBlocks::InitBigBlock(newSystem, newEnvironment, big); 


  int nroots = dmrginp.nroots(0);
  std::vector<StackWavefunction> solution(nroots);

  solution[0].initialise(dmrginp.effective_molecule_quantum_vec(), big.get_leftBlock()->get_stateInfo(), big.get_rightBlock()->get_stateInfo(), false);
  solution[0].Clear();
  if (mpigetrank() == 0) {
    for (int i=1; i<nroots; i++) {
      solution[i].initialise(dmrginp.effective_molecule_quantum_vec(), big.get_leftBlock()->get_stateInfo(), big.get_rightBlock()->get_stateInfo(), false);
      solution[i].Clear();
    }
  }


  std::vector<double> energies(nroots);
  double tol = sweepParams.get_davidson_tol();

  pout << "\t\t\t Solving the Wavefunction "<<endl;
  int currentState = 0;
  std::vector<StackWavefunction> lowerStates;
  Solver::solve_wavefunction(solution, energies, big, tol, BASIC, false, true, false, false, sweepParams.get_additional_noise(), currentState, lowerStates);

  pout << "tensormultiply "<<*dmrginp.tensormultiply<<endl;

  for (int i=0; i<nroots; i++) {
    pout << "fullci energy "<< energies[i]<<endl;
  }
  if (!mpigetrank())
  {
//.........这里部分代码省略.........
开发者ID:sanshar,项目名称:StackBlock,代码行数:101,代码来源:fci.C


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