void mainLoop(GeometryType& geometry, InputNgType::Readable& io, const ParametersDmrgSolverType& params, const PsimagLite::String& list) { typedef typename VectorWithOffsetType::value_type ComplexOrRealType; typedef ModelBase<ModelHelperType, ParametersDmrgSolverType, InputNgType::Readable, GeometryType> ModelBaseType; SizeType orbitals = 1.0; try { io.readline(orbitals,"Orbitals="); } catch (std::exception&) {} ModelSelector<ModelBaseType> modelSelector(params.model); const ModelBaseType& model = modelSelector(params,io,geometry); const PsimagLite::String& datafile = params.filename; IoInputType dataIo(datafile); bool iscomplex = false; dataIo.read(iscomplex, "IsComplex"); if (iscomplex != PsimagLite::IsComplexNumber<ComplexOrRealType>::True) err("Previous run was complex and this one is not (or viceversa)\n"); while (!observeOneFullSweep<VectorWithOffsetType,ModelBaseType> (dataIo, model, list, orbitals)); }
void mainLoop0(InputNgType::Readable& io, ParametersDmrgSolverType& dmrgSolverParams, InputCheck& inputCheck, const PsimagLite::String& list) { typedef typename MySparseMatrix::value_type ComplexOrRealType; typedef PsimagLite::Geometry<ComplexOrRealType, InputNgType::Readable, ProgramGlobals> GeometryType; GeometryType geometry(io); int tmp = 0; try { io.readline(tmp,"UseSu2Symmetry="); } catch (std::exception&) {} bool su2 = (tmp > 0); if (su2) { mainLoop1<GeometryType, ModelHelperSu2, MySparseMatrix> (geometry, io, dmrgSolverParams, list); } else { mainLoop1<GeometryType, ModelHelperLocal, MySparseMatrix> (geometry, io, dmrgSolverParams, list); } }
void mainLoop0(InputNgType::Readable& io, const ParametersDmrgSolverType& dmrgSolverParams, PsimagLite::String targeting, const OperatorOptions& opOptions) { typedef typename MySparseMatrix::value_type ComplexOrRealType; typedef PsimagLite::Geometry<ComplexOrRealType, InputNgType::Readable, ProgramGlobals> GeometryType; GeometryType geometry(io); if (dmrgSolverParams.options.find("printgeometry") != PsimagLite::String::npos) std::cout<<geometry; int tmp = 0; try { io.readline(tmp,"UseSu2Symmetry="); } catch (std::exception&) {} bool su2 = (tmp > 0); if (targeting != "GroundStateTargetting" && su2) { PsimagLite::String str("SU(2) supports only GroundStateTargetting (sorry!)\n"); throw PsimagLite::RuntimeError(str); } if (su2) { mainLoop1<GeometryType,ModelHelperSu2,MySparseMatrix,CvectorSizeType>(geometry, dmrgSolverParams, io, opOptions, targeting); return; } if (dmrgSolverParams.options.find("useComplex") != PsimagLite::String::npos && targeting != "TimeStepTargetting" && targeting != "GroundStateTargetting") { PsimagLite::String str("SolverOptions=useComplex not allowed for "); str += targeting + "\n"; throw PsimagLite::RuntimeError(str); } if (targeting=="TimeStepTargetting") { mainLoop1<GeometryType,ModelHelperLocal,MySparseMatrix,CvectorSizeType>(geometry, dmrgSolverParams, io, opOptions, targeting); return; } mainLoop1<GeometryType,ModelHelperLocal,MySparseMatrix,CvectorSizeType>(geometry, dmrgSolverParams, io, opOptions, targeting); }
void mainLoop0(InputNgType::Readable& io, ParametersDmrgSolverType& dmrgSolverParams, InputCheck& inputCheck, const PsimagLite::String& list) { typedef typename MySparseMatrix::value_type ComplexOrRealType; typedef PsimagLite::Geometry<ComplexOrRealType, InputNgType::Readable, ProgramGlobals> GeometryType; GeometryType geometry(io); int tmp = 0; try { io.readline(tmp,"UseSu2Symmetry="); } catch (std::exception&) {} bool su2 = (tmp > 0); PsimagLite::String targetting=inputCheck.getTargeting(dmrgSolverParams.options); if (targetting!="GroundStateTargetting" && su2) throw PsimagLite::RuntimeError("SU(2) supports only GroundStateTargetting"); if (su2) { mainLoop1<GeometryType,ModelHelperSu2,MySparseMatrix> (geometry,targetting,io,dmrgSolverParams, list); return; } if (targetting=="GroundStateTargetting") { mainLoop1<GeometryType,ModelHelperLocal,MySparseMatrix> (geometry,targetting,io,dmrgSolverParams, list); } else if (targetting=="TimeStepTargetting") { mainLoop1<GeometryType,ModelHelperLocal,MySparseMatrixComplex> (geometry,targetting,io,dmrgSolverParams, list); } else { mainLoop1<GeometryType,ModelHelperLocal,MySparseMatrix> (geometry,targetting,io,dmrgSolverParams, list); } }
void mainLoop(GeometryType& geometry, const PsimagLite::String& targetting, InputNgType::Readable& io, const ParametersDmrgSolverType& params, const PsimagLite::String& list) { typedef ModelBase<ModelHelperType, ParametersDmrgSolverType, InputNgType::Readable, GeometryType> ModelBaseType; SizeType orbitals = 1.0; try { io.readline(orbitals,"Orbitals="); } catch (std::exception&) {} ModelSelector<ModelBaseType> modelSelector(params.model); const ModelBaseType& model = modelSelector(params,io,geometry); bool moreData = true; const PsimagLite::String& datafile = params.filename; ArchiveFiles<ParametersDmrgSolverType>::unpackIfNeeded(datafile); IoInputType dataIo(datafile); bool hasTimeEvolution = (targetting == "TimeStepTargetting" || targetting=="MettsTargetting" || targetting=="TargetingAncilla"); while (moreData) { try { moreData = !observeOneFullSweep<VectorWithOffsetType,ModelBaseType> (dataIo,model,list,hasTimeEvolution,orbitals); } catch (std::exception& e) { std::cerr<<"CAUGHT: "<<e.what(); std::cerr<<"There's no more data\n"; break; } } }
void mainLoop0(InputNgType::Readable& io, const ParametersDmrgSolverType& dmrgSolverParams, InputCheck& inputCheck, const OperatorOptions& opOptions) { typedef typename MySparseMatrix::value_type ComplexOrRealType; typedef PsimagLite::Geometry<ComplexOrRealType, InputNgType::Readable, ProgramGlobals> GeometryType; GeometryType geometry(io); int tmp = 0; try { io.readline(tmp,"UseSu2Symmetry="); } catch (std::exception&) {} bool su2 = (tmp > 0); PsimagLite::String targetting=inputCheck.getTargeting(dmrgSolverParams.options); if (targetting!="GroundStateTargetting" && su2) { PsimagLite::String str("SU(2) supports only GroundStateTargetting (sorry!)\n"); throw PsimagLite::RuntimeError(str); } if (su2) { mainLoop1<GeometryType, ModelHelperSu2, TargetingGroundState, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); return; } #ifdef USE_COMPLEX if (targetting != "TimeStepTargetting" && targetting != "GroundStateTargetting") { PsimagLite::String str("USE_COMPLEX not allowed for "); str += targetting + "\n"; throw PsimagLite::RuntimeError(str); } #endif if (targetting=="TimeStepTargetting") { mainLoop1<GeometryType,ModelHelperLocal,TargetingTimeStep, MySparseMatrixComplex>(geometry,dmrgSolverParams,io,opOptions); return; } if (targetting=="DynamicTargetting") { mainLoop1<GeometryType,ModelHelperLocal,TargetingDynamic, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); return; } if (targetting=="AdaptiveDynamicTargetting") { mainLoop1<GeometryType,ModelHelperLocal,TargetingAdaptiveDynamic, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); return; } if (targetting=="CorrectionVectorTargetting") { mainLoop1<GeometryType,ModelHelperLocal,TargetingCorrectionVector, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); return; } if (targetting=="CorrectionTargetting") { mainLoop1<GeometryType,ModelHelperLocal,TargetingCorrection, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); return; } if (targetting=="MettsTargetting") { mainLoop1<GeometryType,ModelHelperLocal,MettsTargetting, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); return; } if (targetting=="TargetingAncilla") { mainLoop1<GeometryType,ModelHelperLocal,TargetingTimeStep, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); return; } mainLoop1<GeometryType,ModelHelperLocal,TargetingGroundState, MySparseMatrix>(geometry,dmrgSolverParams,io,opOptions); }