本文整理汇总了C++中SpinBlock::size方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinBlock::size方法的具体用法?C++ SpinBlock::size怎么用?C++ SpinBlock::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpinBlock
的用法示例。
在下文中一共展示了SpinBlock::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bratracedMatrix
void SpinAdapted::mps_nevpt::type1::BlockDecimateAndCompress (SweepParams &sweepParams, SpinBlock& system, SpinBlock& newSystem, const bool &useSlater, const bool& dot_with_sys, perturber& pb, int baseState)
{
int sweepiter = sweepParams.get_sweep_iter();
if (dmrginp.outputlevel() > 0) {
mcheck("at the start of block and decimate");
pout << "\t\t\t dot with system "<<dot_with_sys<<endl;
pout <<endl<< "\t\t\t Performing Blocking"<<endl;
}
// figure out if we are going forward or backwards
dmrginp.guessgenT -> start();
bool forward = (system.get_sites() [0] == 0);
SpinBlock systemDot;
SpinBlock environment, environmentDot, newEnvironment;
SpinBlock big;
environment.nonactive_orb() = pb.orb();
newEnvironment.nonactive_orb() = pb.orb();
int systemDotStart, systemDotEnd;
int environmentDotStart, environmentDotEnd, environmentStart, environmentEnd;
int systemDotSize = sweepParams.get_sys_add() - 1;
int environmentDotSize = sweepParams.get_env_add() -1;
if (forward)
{
systemDotStart = dmrginp.spinAdapted() ? *system.get_sites().rbegin () + 1 : (*system.get_sites().rbegin ())/2 + 1 ;
systemDotEnd = systemDotStart + systemDotSize;
environmentDotStart = systemDotEnd + 1;
environmentDotEnd = environmentDotStart + environmentDotSize;
}
else
{
systemDotStart = dmrginp.spinAdapted() ? system.get_sites()[0] - 1 : (system.get_sites()[0])/2 - 1 ;
systemDotEnd = systemDotStart - systemDotSize;
environmentDotStart = systemDotEnd - 1;
environmentDotEnd = environmentDotStart - environmentDotSize;
}
systemDot = SpinBlock(systemDotStart, systemDotEnd, pb.orb());
environmentDot = SpinBlock(environmentDotStart, environmentDotEnd, pb.orb());
Sweep::makeSystemEnvironmentBigBlocks(system, systemDot, newSystem, environment, environmentDot, newEnvironment, big, sweepParams, dot_with_sys, useSlater, system.get_integralIndex(), pb.wavenumber(), baseState,pb.braquanta,pb.ketquanta);
//analyse_operator_distribution(big);
dmrginp.guessgenT -> stop();
dmrginp.multiplierT -> start();
std::vector<Matrix> rotatematrix;
if (dmrginp.outputlevel() > 0)
mcheck("");
if (dmrginp.outputlevel() > 0) {
if (!dot_with_sys && sweepParams.get_onedot()) { pout << "\t\t\t System Block"<<system; }
else pout << "\t\t\t System Block"<<newSystem;
pout << "\t\t\t Environment Block"<<newEnvironment<<endl;
pout << "\t\t\t Solving wavefunction "<<endl;
}
std::vector<Wavefunction> solution; solution.resize(1);
std::vector<Wavefunction> outputState; outputState.resize(1);
DiagonalMatrix e;
//read the 0th wavefunction which we keep on the ket side because by default the ket stateinfo is used to initialize wavefunction
//also when you use spinblock operators to multiply a state, it does so from the ket side i.e. H|ket>
//GuessWave::guess_wavefunctions(solution, e, big, sweepParams.set_guesstype(), sweepParams.get_onedot(), dot_with_sys, 0.0, baseState);
GuessWave::guess_wavefunctions(solution[0], e, big, sweepParams.set_guesstype(), sweepParams.get_onedot(), baseState, dot_with_sys, 0.0);
#ifndef SERIAL
mpi::communicator world;
broadcast(world, solution, 0);
#endif
outputState[0].AllowQuantaFor(big.get_leftBlock()->get_braStateInfo(), big.get_rightBlock()->get_braStateInfo(),pb.braquanta);
outputState[0].set_onedot(sweepParams.get_onedot());
outputState[0].Clear();
if (pb.type() == TwoPerturbType::Va)
big.multiplyCDD_sum(solution[0],&(outputState[0]),MAX_THRD);
if (pb.type() == TwoPerturbType::Vi)
big.multiplyCCD_sum(solution[0],&(outputState[0]),MAX_THRD);
//davidson_f(solution[0], outputState[0]);
SpinBlock newbig;
if (sweepParams.get_onedot() && !dot_with_sys)
{
InitBlocks::InitNewSystemBlock(system, systemDot, newSystem, baseState, pb.wavenumber(), systemDot.size(), dmrginp.direct(), system.get_integralIndex(), DISTRIBUTED_STORAGE, false, true,NO_PARTICLE_SPIN_NUMBER_CONSTRAINT,pb.braquanta,pb.ketquanta);
InitBlocks::InitBigBlock(newSystem, environment, newbig,pb.braquanta,pb.ketquanta);
Wavefunction tempwave = outputState[0];
GuessWave::onedot_shufflesysdot(big.get_braStateInfo(), newbig.get_braStateInfo(), outputState[0], tempwave);
outputState[0] = tempwave;
tempwave = solution[0];
GuessWave::onedot_shufflesysdot(big.get_ketStateInfo(), newbig.get_ketStateInfo(), solution[0], tempwave);
solution[0] = tempwave;
big.get_rightBlock()->clear();
big.clear();
}
else
newbig = big;
//.........这里部分代码省略.........