SyTen
syten::T3N::DMRG::Run Struct Reference

One run of T3N-DMRG. More...

#include <dmrg.h>

+ Collaboration diagram for syten::T3N::DMRG::Run:

Public Types

typedef syten::DMRG::DMRGConfig DMRGConfig
 DMRG Config type. More...
 
typedef syten::DMRG::DMRGStage DMRGStage
 DMRG Stage type. More...
 

Public Member Functions

void adaptAlpha (SRDef const preTrunc, SRDef const postTrunc)
 Adapt the mixing factor alpha based on energy gain. More...
 
void adaptConf (SRDef error, IterativeExit const &r)
 Adapts parameters after sweep. More...
 
MemoryUsage::MemorySize allocSize () const
 Returns the total alloced memory. More...
 
bool converged ()
 Returns if the state is converged. More...
 
void saveState ()
 Saves state. More...
 
void setConf (DMRGConfig conf_)
 Sets new DMRGConfig to continue with. More...
 
DMRGConfig const & showConf () const
 Shows the DMRGConfig. More...
 
Operator const & showH (Index const i) const
 Overload because pyten does not like the implicit cast and deletes the operator otherwise. More...
 
std::vector< Operator > const & showHs () const
 Returns the operators. More...
 
State const & showPsi () const
 Gives a const. More...
 
Constructors & assignment operators.
 Run ()=default
 Default constructor. More...
 
Runoperator= (Run &&other)
 Move assignment. More...
 
Runoperator= (Run const &other)=delete
 Copy assignment. More...
 
 Run (Run const &other)=delete
 Delete copy constructor. More...
 
 Run (Run &&other)
 Move constructor. More...
 
Logging
void initLog ()
 Initializes logfiles. More...
 
void closeLog ()
 Closes logfiles. More...
 
template<typename... Args>
void logIteration (Args &&... data)
 Log the data for a single iteration. More...
 
template<typename... Args>
void logTrace (Args &&... data)
 Log traceing information. More...
 
External interface
void initArgs (int argc_, char **argv_)
 Initialize arguments. More...
 
 Run (State &&psi_, std::vector< Operator > &&ops_, DMRGConfig &&conf_, std::vector< State > &&ortho_={})
 Construction. More...
 
void run ()
 Peforms a DMRG run. More...
 
template<typename TypePtr , typename TypeVal >
void setConfig (TypePtr ptr, TypeVal value)
 Use to set configuration for all workers. More...
 
std::vector< DenseTensor< 2 > > const & get_global_Us () const
 Gives back the rotation. More...
 
void init_obs (Vec< Operator > obs_)
 Inititalses observables to rotate during MT. More...
 
Vec< Operatorget_obs ()
 Returns observables. More...
 
void setCaching (bool const val)
 Sets caching flag to state operator and contractions. More...
 
void randomise_state ()
 Randomises current state. More...
 
DMRGStage const & currentStage () const
 Const reference to current stage. More...
 
Boost serialisation.
template<typename Archive >
void save (Archive &ar, unsigned int const in_version)
 Save a worker object to a boost archive. More...
 
template<class Archive >
void save (Archive &ar, unsigned int const in_version) const
 Overload to satisfy Boost. More...
 
template<typename Archive >
void load (Archive &ar, unsigned int const in_version)
 Load a worker object from a boost archive. More...
 

Static Public Attributes

static std::string const uuid = "589F7D2E-2992-4F54-A34B-114FC3A19886"
 UUID. More...
 
static constexpr unsigned int version = 4
 Version. More...
 

Private Member Functions

Contraction of operator and state.
void build_descendantContr (LegType const which, Position const &pos) const
 Build a contraction pointing towards the requested direction. More...
 
void build_rootContr (Position const &pos) const
 Build a local root-pointing contraction of the operator with the state (based on) the nodes given as arguments. More...
 
void build_rootContr_rec (Position &pos)
 Recursively build an entire tree of root-pointing contractions. More...
 
Internal functionality
bool checkSignals ()
 Checks for signals. More...
 
void resetPosition ()
 Set position to start. More...
 
void checkTopology () const
 Compare Operators to each other in order to check if they're valid. More...
 
void uncache (Tree::Position const &pos, LegType const dir=LegType::Invalid)
 Uncaches the requested position in all Hamiltonians. More...
 
void cache (Tree::Position const &pos, bool const do_cache=true, LegType const dir=LegType::Invalid)
 Caches the requested position in all Hamiltonians. More...
 
void sweep ()
 Do one sweep over the entire system. More...
 
void update_rec (Position &pos)
 Updates a subtree recursively. More...
 
void update_node (Position const &pos, LegType const dir)
 A helper function in order to distinguish the kinds of updates. More...
 
void update_branch (LegType const direction, Position const &pos)
 Performs the actual update on a Branching Node. More...
 
void update_phys_branching (Position const &pos, LegType const direction)
 Contracts the current site w/ a neighboring Branching Node and optimizes. More...
 
void update_phys_branching_2site (LegType const direction, LegType const secondDir, Position const &pos)
 Updates Physical-Branching-Physical Contraction. More...
 
void update_phys_1site (LegType const direction, Position const &pos)
 Does single site DMRG on Physical Node w/ neighboring Physical Node. More...
 
void update_phys_2site (Position const &pos, LegType const direction)
 Does two site DMRG on Physical Node w/ neighboring Physical Node. More...
 
void checkNormAndStabilise (STensor &t, Vec< SBasisId > const &keep_size={})
 Checks the norm of a tensor and randomises it if needed. More...
 
DMRGStagecurrentStage ()
 Reference to current stage. More...
 
IterativeExit solveContractionWithBranching (Vec< STensor > const &operatorContrs, STensor &stateContr, LegType const contracted, Position const &pos) const
 Solves for the tensor on a Physical Node, given a neighboring Branching Node. More...
 
IterativeExit solvePhysical (Position const &pos, Vec< std::reference_wrapper< T3NTensor const > > const &w_refs)
 Solves for the tensor on a Physical Node. More...
 
IterativeExit solveBranching (Position const &pos, Vec< std::reference_wrapper< T3NTensor const > > const &w_refs)
 Solves for the tensor on a Branching Node. More...
 
IterativeExit solve2Site (Position const &pos, LegType const direction, Vec< std::reference_wrapper< T3NTensor const > > const &w_refs, STensor &site) const
 Solves two-site. More...
 
IterativeExit solve2SitePhysicalBranching (Vec< std::reference_wrapper< T3NTensor const > > const &operatorContrs, STensor &stateContr, LegType const contracted, LegType const secondContr, Position const &pos) const
 Solves two-site-branching contraction. More...
 
void normalise_network (Position const &pos, LegType const towards)
 Normalises the entire network towards given direction. More...
 
std::string directionSymbol (NodeType const posType, NodeType const nextType, LegType const direction, LegType const rootType) const
 Returns the symbol for the direction of sweeping. More...
 
std::string positionInfo (Position const &pos) const
 Returns position information. More...
 
void expand (Position const &pos, LegType const direction)
 Performs subspace expansion. More...
 
void expandPhysical (Position const &pos, LegType const direction)
 Performs subspace expansion. More...
 
void expandBranch (Position const &pos, LegType const direction)
 Performs subspace expansion. More...
 
SRDef normalise (State::Ptr ptr, LegType const dir)
 Normalises the state on node pptr in direction dir. More...
 
void contract (Position const &pos, LegType const dir)
 Forwarder to build the contraction on node cptr from the neighbours of cptr, pptr and optr in direction dir. More...
 
Pair< SRDef, SRDefenergy (Position const &pos) const
 Calculates the energy on the specified node, assuming that all neighbouring contractions exist and point in the correct direction. More...
 
Pair< SRDef, SRDefenergy (Position const &pos, LegType const dir) const
 Forwarder to calculate the energy on the neighbouring node of that pointed to be the arguments in the given direction. More...
 

Private Attributes

int argc
 
char ** argv
 
DMRGConfig conf
 Configuration of the run. More...
 
Contractions contrs
 Contractions of op & psi. More...
 
std::ofstream iterLog
 output filestream for each iteration More...
 
Vec< Operatormt_observables = {}
 Observables to rotate during MT. More...
 
Vec< Operatorops
 (Hamiltonian-) Operator of which we calculate the ground state. More...
 
Vec< Stateortho
 Orthogonalise against there vectors. More...
 
Contractions orthoContrs
 Contractions of orthogonal states. More...
 
Position position
 Shows the current position during optimisation. More...
 
State psi
 Ground state (approximation) for op. More...
 
bool smp
 True if all nodes are physical. More...
 
Timer timer
 For performance testing reasons. More...
 
std::ofstream traceLog
 output filestream for the debug info More...
 
Vec< DenseTensor< 2 > > Us = {}
 For transforming the creation and annihilation operators. More...
 

Detailed Description

One run of T3N-DMRG.


The documentation for this struct was generated from the following files: